syncfusion-flutter-excel
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseExcel Document Processing Using Syncfusion Flutter XlsIO Library
使用Syncfusion Flutter XlsIO库处理Excel文档
Overview
概述
Create, edit, and save Excel workbooks (.xlsx) using the Syncfusion Flutter XlsIO library.
This skill supports generating Dart code snippets for Flutter projects targeting mobile, web, and desktop platforms.
使用Syncfusion Flutter XlsIO库创建、编辑和保存Excel工作簿(.xlsx)。
此技能支持为面向移动、Web和桌面平台的Flutter项目生成Dart代码片段。
Key Capabilities
核心功能
- Create & Edit: Workbooks, worksheets, cells, rows, columns, cell formatting, styles, formulas, named ranges, charts, images, hyperlinks, data validation, conditional formatting
- Data Management: Import data (lists, typed data, hyperlinks, images), export data, advanced filtering (text, custom, date, dynamic, color filters), freeze panes, show/hide rows/columns
- Advanced Features: RTL layout for international support, CSV export, template-based operations, data validation rules (text, list, number, date, decimal, custom)
- Charts & Visualization: Create and configure all chart types (pie, bar, column, line, stacked, 3D, specialized), customize elements (title, legends, labels, positioning)
- Security: Password protection, worksheet/workbook encryption, cell protection with unlock options
- Page Setup: Margins, page breaks, print areas, page orientation, headers/footers
- 创建与编辑: 工作簿、工作表、单元格、行、列、单元格格式设置、样式、公式、命名区域、图表、图片、超链接、数据验证、条件格式
- 数据管理: 导入数据(列表、类型化数据、超链接、图片)、导出数据、高级筛选(文本、自定义、日期、动态、颜色筛选)、冻结窗格、显示/隐藏行/列
- 高级特性: 支持国际化的RTL布局、CSV导出、基于模板的操作、数据验证规则(文本、列表、数字、日期、小数、自定义)
- 图表与可视化: 创建并配置所有图表类型(饼图、条形图、柱状图、折线图、堆叠图、3D图、专用图表),自定义元素(标题、图例、标签、位置)
- 安全性: 密码保护、工作表/工作簿加密、带解锁选项的单元格保护
- 页面设置: 边距、分页符、打印区域、页面方向、页眉/页脚
Prerequisites
前提条件
- Flutter SDK installed
- Add dependencies to :
pubspec.yamlyamldependencies: syncfusion_flutter_xlsio: ^xx.x.xx syncfusion_officechart: ^xx.x.xx - Run:
flutter pub get - Import in Dart code:
dart
import 'package:syncfusion_flutter_xlsio/xlsio.dart'; import 'package:syncfusion_officechart/officechart.dart';
- 已安装 Flutter SDK
- 向添加依赖:
pubspec.yamlyamldependencies: syncfusion_flutter_xlsio: ^xx.x.xx syncfusion_officechart: ^xx.x.xx - 运行:
flutter pub get - 在Dart代码中导入:
dart
import 'package:syncfusion_flutter_xlsio/xlsio.dart'; import 'package:syncfusion_officechart/officechart.dart';
Quick Start Example
快速入门示例
Generate Dart Code
生成Dart代码
User: "Show me how to create an Excel workbook with multiple sheets"
Result: Dart code snippet displayed (no files created)
用户:“展示如何创建包含多个工作表的Excel工作簿”
**结果:**显示Dart代码片段(不创建文件)
Mode: Generate Dart Code for the User's Flutter Project
模式:为用户的Flutter项目生成Dart代码
Trigger keywords: "show me how", "how to", "how can I", "how do I", "provide code", "provide an example", "give an example", "demonstrate", "code snippet", "sample code", "example", "sample", "give me", "show me", "main.dart", "example code", "generate code for", "codesnippet".
Workflow:
触发关键词:"show me how", "how to", "how can I", "how do I", "provide code", "provide an example", "give an example", "demonstrate", "code snippet", "sample code", "example", "sample", "give me", "show me", "main.dart", "example code", "generate code for", "codesnippet"
工作流程:
Step 1 — Detect the Platform and Suggest the Correct Package
步骤1 — 检测平台并建议正确的包
- Inspect the workspace project files (,
pubspec.yaml, etc.) to identify the Flutter platform target (mobile, web, desktop).main.dart - Tell the user to add to their
syncfusion_flutter_xlsiobefore generating any code.pubspec.yaml
- 检查工作区项目文件(、
pubspec.yaml等)以确定Flutter目标平台(移动、Web、桌面)。main.dart - 在生成任何代码之前,告知用户将添加到他们的
syncfusion_flutter_xlsio中。pubspec.yaml
Step 2 — Generate Code from Reference Files Only
步骤2 — 仅从参考文件生成代码
Do NOT invent, guess, or suggest any API, class, method, or property not explicitly present in the reference files.
- Read the relevant file(s) for the requested feature
references/*.md - Build Dart code strictly from the APIs and snippets found in those files
- Use the correct save/launch pattern for the target platform:
- Mobile → +
getApplicationSupportDirectory()OpenFile.open() - Desktop → +
getApplicationSupportDirectory()OpenFile.open() - Web → base64 + JavaScript download or package approach
web
- Mobile →
- Do not create or run any standalone Dart script
请勿发明、猜测或建议任何未在参考文件中明确提及的API、类、方法或属性。
- 读取与请求功能相关的文件
references/*.md - 严格根据这些文件中的API和片段构建Dart代码
- 针对目标平台使用正确的保存/启动模式:
- 移动 → +
getApplicationSupportDirectory()OpenFile.open() - 桌面 → +
getApplicationSupportDirectory()OpenFile.open() - Web → base64 + JavaScript下载或包方法
web
- 移动 →
- 请勿创建或运行任何独立的Dart脚本
Code References
代码参考
All snippets are in the folder:
references/| File | Contents |
|---|---|
| references/workbook.md | Create, save/dispose, async operations, RTL layout, CSV export |
| references/worksheet.md | Create, access, tab color, sizing, freeze panes, page setup |
| references/cell-data.md | Add text, numbers, dates, and other data types to cells; create hyperlinks |
| references/hyperlinks.md | Add URL and mailto hyperlinks |
| references/named-ranges.md | Create and use named ranges in formulas |
| references/data-filtering.md | Text, custom, date, dynamic, and color filters |
| references/cell-formatting.md | Create styles, apply globally, merge/unmerge cells, built-in styles |
| references/number-formats.md | Number, currency, percentage, date, time, accounting, scientific, fraction, text formats |
| references/rows-columns-manipulation.md | Insert, delete, auto-fit, show/hide rows and columns; set width/height; number formats |
| references/formulas.md | Enable calculations, apply formulas, access values, nested functions, and 25+ functions (general, logical, text, time, lookup, statistical, math) |
| references/charts-basics.md | Create charts, customize elements (title, legends, labels, positioning) |
| references/charts-types.md | All chart types (pie, bar, column, line, stacked, markers, 3D, specialized) |
| references/images.md | Insert, resize, flip, and rotate images (JPEG, PNG) in worksheets |
| references/security.md | Protect workbooks and worksheets with passwords, unlock cells for editing |
| references/conditional-formatting-basics.md | Cell value, text, date, unique/duplicate, top/bottom, above/below average formatting |
| references/conditional-formatting-advanced.md | Color scales, icon sets, data bars, custom icons with visual analytics |
| references/data-import.md | Import lists, typed data, hyperlinks, and images into worksheets |
| references/data-validation.md | Text, time, list, number, decimal, date, and custom formula validation rules |
| references/tables.md | Create, style, and manage Excel tables with built-in themes |
| references/culture.md | Culture/locale settings for dates, times, numbers, and currency formatting |
| references/page-setup.md | Page setup and print settings (orientation, margins, page breaks, print area) |
所有片段都位于文件夹中:
references/| 文件 | 内容 |
|---|---|
| references/workbook.md | 创建、保存/释放、异步操作、RTL布局、CSV导出 |
| references/worksheet.md | 创建、访问、标签颜色、大小调整、冻结窗格、页面设置 |
| references/cell-data.md | 向单元格添加文本、数字、日期和其他数据类型;创建超链接 |
| references/hyperlinks.md | 添加URL和mailto超链接 |
| references/named-ranges.md | 在公式中创建和使用命名区域 |
| references/data-filtering.md | 文本、自定义、日期、动态和颜色筛选 |
| references/cell-formatting.md | 创建样式、全局应用、合并/取消合并单元格、内置样式 |
| references/number-formats.md | 数字、货币、百分比、日期、时间、会计、科学计数、分数、文本格式 |
| references/rows-columns-manipulation.md | 插入、删除、自动调整、显示/隐藏行和列;设置宽度/高度;数字格式 |
| references/formulas.md | 启用计算、应用公式、访问值、嵌套函数,以及25+种函数(常规、逻辑、文本、时间、查找、统计、数学) |
| references/charts-basics.md | 创建图表、自定义元素(标题、图例、标签、位置) |
| references/charts-types.md | 所有图表类型(饼图、条形图、柱状图、折线图、堆叠图、标记图、3D图、专用图表) |
| references/images.md | 在工作表中插入、调整大小、翻转和旋转图片(JPEG、PNG) |
| references/security.md | 用密码保护工作簿和工作表,解锁单元格以进行编辑 |
| references/conditional-formatting-basics.md | 单元格值、文本、日期、唯一/重复值、前/后N项、高于/低于平均值的格式设置 |
| references/conditional-formatting-advanced.md | 色阶、图标集、数据条、带视觉分析的自定义图标 |
| references/data-import.md | 将列表、类型化数据、超链接和图片导入工作表 |
| references/data-validation.md | 文本、时间、列表、数字、小数、日期和自定义公式验证规则 |
| references/tables.md | 使用内置主题创建、设置样式和管理Excel表格 |
| references/culture.md | 日期、时间、数字和货币格式的区域性/区域设置 |
| references/page-setup.md | 页面设置和打印设置(方向、边距、分页符、打印区域) |
Rules
规则
- Do NOT create or run temp scripts — this skill only generates code for user projects (Mode 1)
- Generate code strictly from reference files — never invent APIs or methods
- Always include proper imports: and
import 'package:syncfusion_flutter_xlsio/xlsio.dart';import 'package:syncfusion_officechart/officechart.dart'; - For mobile/desktop apps: Use +
getApplicationSupportDirectory()for file savingOpenFile.open() - For web apps: Use base64 + JavaScript download or package approach
web - Always call after saving to release memory
workbook.dispose() - Save workbooks synchronously using or asynchronously using
saveSync()save() - Remind users to add and
syncfusion_flutter_xlsiotosyncfusion_officechartbefore using generated codepubspec.yaml
- 请勿创建或运行临时脚本——此技能仅为用户项目生成代码(模式1)
- 严格从参考文件生成代码——绝不发明API或方法
- 始终包含正确的导入:和
import 'package:syncfusion_flutter_xlsio/xlsio.dart';import 'package:syncfusion_officechart/officechart.dart'; - 对于移动/桌面应用:使用+
getApplicationSupportDirectory()进行文件保存OpenFile.open() - 对于Web应用:使用base64 + JavaScript下载或包方法
web - 保存后务必调用以释放内存
workbook.dispose() - 使用同步保存工作簿,或使用
saveSync()异步保存save() - 提醒用户在使用生成的代码之前,将和
syncfusion_flutter_xlsio添加到syncfusion_officechart中pubspec.yaml