Export
Previous
Advanced Sort
Next
Graphic style
Loading...
<SheetComponentdataCfg={dataCfg}options={options}header={{ export: { open: true } }}/>
Attributes | illustrate | type | Defaults | required |
---|---|---|---|---|
open | open component | boolean | false | ✓ |
className | class name | string | ||
icon | display icon | ReactNode | ||
copyOriginalText | Copy original data copy | string | ||
copyFormatText | copy formatted data copy | string | ||
downloadOriginalText | Download the original data copy | string | ||
downloadFormatText | Download formatted data copy | string | ||
successText | Successful operation copy | string | ||
errorText | Operation failure copy | string | ||
fileName | Customize the download file name | string | sheet | |
async | Copy data asynchronously (default is asynchronous) | boolean | false | |
drop down | Dropdown menu configuration, transparently passed to the Dropdown component of antd | DropdownProps |
Functions such as copying and exporting of the component layer are encapsulated based on a series of tools and methods exposed by the core layer @antv/s2
, which can be self-encapsulated based on tools and methods according to actual business
import { copyData, copyToClipboard, download } from '@antv/s2'// 拿到复制数据const data = copyData(spreadsheet, '\t', false)// 复制数据到剪贴板// 同步复制:copyToClipboard(data, false)copyToClipboard(data).then(() => {console.log('复制成功')}).catch(() => {console.log('复制失败')})// 导出数据download(data, 'filename')
parameter | illustrate | type | Defaults | required |
---|---|---|---|---|
spreadsheet | s2 instance | SpreadSheet | ✓ | |
split | delimiter | string | ✓ | |
formatOptions | Whether to format, you can format the data cell and row header separately, and passing Boolean values will take effect on the cell and row header at the same time. | boolean | { formatHeader?: boolean, formatData?: boolean} | false |
parameter | illustrate | type | Defaults | required |
---|---|---|---|---|
data | data source | string | ✓ | |
async | Whether to copy data asynchronously (default is asynchronous) | boolean | true |
parameter | illustrate | type | Defaults | required |
---|---|---|---|---|
data | data source | string | ✓ | |
filename | file name | string | ✓ |
According to the CSV specification and Excel's handling rules, S2
will process special characters as follows:
,
"
\r
\n
\t
"
within a field will be escaped as two double quotes ""
.\n
will be replaced with \r\n
\r\n
will remain unchangedIn development, please look forward to