Skip to content

Commit

Permalink
excel视图移除数据内换行符
Browse files Browse the repository at this point in the history
  • Loading branch information
cweijan committed Jun 15, 2024
1 parent 983593d commit d11078a
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/react/view/excel/excel_reader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@ export function loadSheets(buffer: ArrayBuffer, ext: string): S2DataConfig[] {
if (data.length < 26) {
for (let i = data.length; i < 22; i++) data.push({})
}
const columns = Array(maxCols).fill(0).map((_, i) => (String.fromCharCode(65 + i)));
return {
name: sheet.name,
fields: {
columns: Array(maxCols).fill(0).map((_, i) => (String.fromCharCode(65 + i)))
},
data,
fields: { columns }, data,
meta: columns.map(c => ({
field: c,
formatter: (value: any) => {
if (typeof value == 'string') {
return value.replace(/\n/, ' ')
}
return value
},
})),
}
})
}
Expand Down

0 comments on commit d11078a

Please sign in to comment.