|
1 | 1 | # Import and Export Capabilities |
2 | | -The import and export functionality in VTable-Sheet relies on export plugins from VTable's plugin package @visactor/vtable-plugins. |
| 2 | +Import and export capabilities in VTable-Sheet rely on plugin packages from @visactor/vtable-plugins. |
3 | 3 |
|
4 | | -Export plugin: @visactor/vtable-plugins/table-export-plugin, refer to the tutorial documentation: [Table Export](../plugin/table-export) |
| 4 | +Export plugin: @visactor/vtable-plugins/table-export-plugin, refer to the tutorial documentation: [table export](../plugin/table-export) |
5 | 5 |
|
6 | | -Import plugin: @visactor/vtable-plugins/excel-import-plugin, refer to the tutorial documentation: [Table Import](../plugin/excel-import) |
| 6 | +Import plugin: @visactor/vtable-plugins/excel-import-plugin, refer to the tutorial documentation: [table import](../plugin/excel-import) |
7 | 7 |
|
8 | | -Since VTable plugins only work on a single table instance, VTableSheet's current import and export capabilities are limited. It can only export data from the current sheet or import external data files into the current sheet. The export and import capabilities of VTableSheet will be expanded and improved in the future. |
| 8 | +If you want to modify the plugin configuration, you can configure the parameters of the import and export plugins through VTablePluginModules. |
9 | 9 |
|
10 | | -If you want to modify the plugin configuration options, you can configure various parameters for the import and export plugins through VTablePluginModules. |
| 10 | +Import and export capabilities usually need to be used together with menu functionality, so you need to configure menu functionality, which can be referred to [menu functionality](./menu.md). |
| 11 | + |
| 12 | +## Export sheet |
| 13 | +Export the current sheet, you can configure menuKey as VTableSheet.TYPES.MenuKey.EXPORT_CURRENT_SHEET_CSV to export a csv file, or configure menuKey as VTableSheet.TYPES.MenuKey.EXPORT_CURRENT_SHEET_XLSX to export an excel file. |
| 14 | + |
| 15 | +Export excel file supports exporting all sheets, you can configure menuKey as VTableSheet.TYPES.MenuKey.EXPORT_ALL_SHEETS_XLSX to export an excel file. |
| 16 | + |
| 17 | +Example: |
| 18 | + |
| 19 | +```typescript |
| 20 | + mainMenu: { |
| 21 | + show: true, |
| 22 | + items: [ |
| 23 | + ...... |
| 24 | + { |
| 25 | + name: 'Export', |
| 26 | + items: [ |
| 27 | + { |
| 28 | + name: 'Export CSV', |
| 29 | + menuKey: TYPES.MainMenuItemKey.EXPORT_CURRENT_SHEET_CSV, |
| 30 | + description: 'Export current sheet data to csv' |
| 31 | + }, |
| 32 | + { |
| 33 | + name: 'Export XLSX', |
| 34 | + menuKey: TYPES.MainMenuItemKey.EXPORT_CURRENT_SHEET_XLSX, |
| 35 | + description: 'Export current sheet data to xlsx' |
| 36 | + }, |
| 37 | + { |
| 38 | + name: 'Export All Sheets', |
| 39 | + menuKey: TYPES.MainMenuItemKey.EXPORT_ALL_SHEETS_XLSX, |
| 40 | + description: 'Export all sheets to xlsx' |
| 41 | + } |
| 42 | + ], |
| 43 | + description: 'Export current sheet data' |
| 44 | + } |
| 45 | + ] |
| 46 | + } |
| 47 | +``` |
| 48 | + |
| 49 | +It also supports calling the export function through APIs, which can be referred to [API](../../api/SheetAPI#Methods.exportSheetToFile). |
| 50 | + |
| 51 | +## Import sheet |
| 52 | + |
| 53 | +Import sheet, you can configure menuKey as VTableSheet.TYPES.MenuKey.IMPORT to import a csv file or excel file. |
| 54 | + |
| 55 | +Example: |
| 56 | + |
| 57 | +```typescript |
| 58 | +mainMenu: { |
| 59 | + ...... |
| 60 | + items: [ |
| 61 | + { |
| 62 | + name: 'Import', |
| 63 | + menuKey: VTableSheet.TYPES.MenuKey.IMPORT, |
| 64 | + description: 'Import data to current sheet' |
| 65 | + } |
| 66 | + ] |
| 67 | +} |
| 68 | +``` |
| 69 | + |
| 70 | +It also supports calling the import function through APIs, which can be referred to [API](../../api/SheetAPI#Methods.importFileToSheet). |
| 71 | + |
| 72 | +Import supports excel files and csv files, and supports multi-sheet import for excel files. |
0 commit comments