syncfusion-winforms-spreadsheet-editor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseSyncfusion Windows Forms Spreadsheet Editor
Syncfusion Windows Forms 电子表格编辑器
Overview
概述
Create Excel-like viewer/editor UI in Windows Forms using Syncfusion Spreadsheet control. This skill generates C# Windows Forms code for interactive spreadsheet functionality.
使用Syncfusion Spreadsheet控件在Windows Forms中创建类Excel风格的查看器/编辑器UI。此技能可生成具备交互式电子表格功能的C# Windows Forms代码。
Key Capabilities
核心功能
- Create & Edit: Workbooks (.xlsx, .xls, .xlsm), worksheets, cell editing, formatting, styles
- Advanced Features: 400+ formulas, named ranges, data validation, dropdown lists, cell locking, worksheet protection
- UI Components: SpreadsheetRibbon (File, Home, Insert, Formulas tabs), interactive editing
- Visual Elements: Charts (Column, Line, Pie, Bar, Area, Scatter, etc.), sparklines (Line, Column, Win/Loss)
- Navigation: Hyperlinks (web URLs, email, files, workbook navigation)
- 创建与编辑: 工作簿(.xlsx、.xls、.xlsm)、工作表、单元格编辑、格式设置、样式
- 高级功能: 400余种公式、命名区域、数据验证、下拉列表、单元格锁定、工作表保护
- UI组件: SpreadsheetRibbon(文件、开始、插入、公式选项卡)、交互式编辑
- 可视化元素: 图表(柱状图、折线图、饼图、条形图、面积图、散点图等)、迷你图(折线、柱状、盈亏)
- 导航功能: 超链接(网页URL、邮件、文件、工作簿内导航)
Quick Start Examples
快速入门示例
Example 1
示例1
User: "Show me how to create a spreadsheet with data and formulas"
Result: C# code generated to create workbook, set cell values, and add formulas
用户: "展示如何创建带有数据和公式的电子表格"
结果: 生成用于创建工作簿、设置单元格值及添加公式的C#代码
Example 2
示例2
User: "Add data validation and rules in the spreadsheet control"
Result: C# code generated for spreadsheet control validation and custom rules
用户: "在电子表格控件中添加数据验证和规则"
结果: 生成用于电子表格控件验证和自定义规则的C#代码
Generate C# Code for the User's Project (default)
为用户项目生成C#代码(默认行为)
Trigger keywords: "how to", "add spreadsheet", "code sample", "show me", "example", "snippet", "integrate", "component", "create sample", "code", "sample code", "generate code", "implement", "add to project", "configure spreadsheet"
触发关键词: "how to"、"add spreadsheet"、"code sample"、"show me"、"example"、"snippet"、"integrate"、"component"、"create sample"、"code"、"sample code"、"generate code"、"implement"、"add to project"、"configure spreadsheet"
STEP 1 — Analyze User Request
步骤1 — 分析用户请求
- Read the user’s request and extract the feature keywords.
- If relevant reference/*.md files exist, use them as the only source of truth for generating code.
- If no matching reference file exists, generate code using the samples in references/getting-started.md.
- 读取用户请求并提取功能关键词。
- 若存在相关的reference/*.md文件,仅以此作为生成代码的唯一依据。
- 若没有匹配的参考文件,则使用references/getting-started.md中的示例生成代码。
STEP 2 — Consent & Destination Gate (MUST ASK BEFORE ANY FILE ACTIONS)
步骤2 — 同意确认与目标选择(执行任何文件操作前必须询问)
Before generating or writing anything, ask the user:
I'm ready to generate your Syncfusion Windows Forms Spreadsheet sample.
Where should I place it?
1) Create a new Form file in the skill's "output" folder (recommended for quick tryout)
2) Add or modify an existing file in your project (please provide the full file path; choose append or replace)
3) Say "Just show me the code" to get the snippet here without modifying any files.Rules
- Do NOT proceed until the user selects an option or says "Just show me the code."
- If the user refuses file modifications:
- Only show the C# code in chat
- No file creation or changes
- For Option 2 only: Before generating code, check if the project has the prerequisites from (Prerequisites and Setup Requirements section). If missing, ask user consent and add them.
references/getting-started.md
在生成或写入任何内容之前,询问用户:
我已准备好为您生成Syncfusion Windows Forms Spreadsheet示例。
请问应将其放置在何处?
1) 在技能的"output"文件夹中创建新的Form文件(推荐用于快速试用)
2) 在您的项目中添加或修改现有文件(请提供完整文件路径;选择追加或替换)
3) 回复"Just show me the code"仅在此处显示代码片段,不修改任何文件。规则
- 在用户选择选项或回复"Just show me the code"之前,请勿继续操作。
- 若用户拒绝修改文件:
- 仅在聊天中显示C#代码
- 不创建或更改任何文件
- 仅针对选项2: 生成代码前,检查项目是否满足(前提条件与设置要求部分)中的依赖项。若缺失,需征得用户同意后添加。
references/getting-started.md
STEP 3 — Generate Code (Strict Reference-Only Rules)
步骤3 — 生成代码(严格遵循参考文件规则)
- ALWAYS use the sample code structure from the "Minimal code" section in getting-started.md as the base template for spreadsheet creation.
- Use APIs exactly as shown in references/*.md (e.g., getting-started.md, formulas.md).
- Never invent APIs or guess behavior.
- If the feature is not documented in any reference file, inform the user that it is unavailable.
- 始终以getting-started.md中「最小代码」部分的示例代码结构作为创建电子表格的基础模板。
- 严格按照references/*.md(如getting-started.md、formulas.md)中展示的方式使用API。
- 切勿自行发明API或猜测其行为。
- 若参考文件中未记录该功能,需告知用户此功能不可用。
STEP 4 — Apply Changes (Only After Consent)
步骤4 — 应用更改(仅在获得同意后执行)
Option A — Create New File in Skill’s Folder
- Create a folder named at the skill root (if it does not already exist).
output/ - Default filename:
SpreadsheetSample.cs - If the file already exists, ask: "A file named 'SpreadsheetSample.cs' already exists. Overwrite, append, or use a different name?"
- Wait for the user’s decision before writing anything.
- Write the generated C# content.
Option B — Modify a File in the User’s Project
- Ask: "Which file should I modify? Provide the COMPLETE file path (e.g., D:\Project\Form1.cs)"
- Wait for explicit confirmation.
- If the user only replies with “2” (option number) and no path → ask again.
- Never guess or infer file paths.
- Once confirmed, apply the requested change (overwrite or append).
Option C — Show the Code Only
- Display the generated C# code in chat.
- Do NOT create or modify any files.
选项A — 在技能文件夹中创建新文件
- 在技能根目录创建名为的文件夹(若不存在)。
output/ - 默认文件名:
SpreadsheetSample.cs - 若文件已存在,询问: "名为'SpreadsheetSample.cs'的文件已存在。是否覆盖、追加或使用其他名称?"
- 在获得用户决定前,请勿写入任何内容。
- 写入生成的C#内容。
选项B — 修改用户项目中的文件
- 询问: "应修改哪个文件?请提供完整文件路径(例如:D:\Project\Form1.cs)"
- 等待用户明确确认。
- 若用户仅回复选项编号“2”而未提供路径 → 再次询问。
- 切勿猜测或推断文件路径。
- 确认后,执行请求的更改(覆盖或追加)。
选项C — 仅显示代码
- 在聊天中展示生成的C#代码。
- 不创建或修改任何文件。
Out-of-Scope Requests
超出范围的请求
When a user asks a question that does NOT match the skill domain (i.e., not related to Windows Forms Spreadsheet, Excel processing, or Syncfusion spreadsheet control), respond with:
"Unable to process the input. Please provide the input in a different way."
Do NOT attempt to:
- Generate code outside the spreadsheet/Excel domain
- Provide general Windows Forms guidance unrelated to spreadsheet functionality
- Process requests for other Syncfusion controls or unrelated frameworks
- Assist with non-spreadsheet features
ONLY activate this skill and its workflows when the user's request matches trigger keywords: "spreadsheet", "Excel", "form", "UI", "code", "Ribbon", "WinForms" (in context of spreadsheet/Excel).
当用户提出与技能领域不匹配的问题(即与Windows Forms Spreadsheet、Excel处理或Syncfusion电子表格控件无关),请回复:
"无法处理该输入,请更换方式提供输入。"
切勿尝试:
- 生成电子表格/Excel领域之外的代码
- 提供与电子表格功能无关的通用Windows Forms指导
- 处理其他Syncfusion控件或无关框架的请求
- 协助处理非电子表格相关的功能
仅当用户请求匹配以下触发关键词时,才激活此技能及其工作流: "spreadsheet"、"Excel"、"form"、"UI"、"code"、"Ribbon"、"WinForms"(需处于电子表格/Excel相关语境中)。
Code References (in references/
folder)
references/代码参考(位于references/
文件夹)
references/All templates and feature snippets live in references/*.md. Each file is a focused snippet the agent combines when generating samples.
Flow: Always start with references/getting-started.md (Prerequisites and Setup Requirements section), then merge matched feature snippets. If no feature keywords match, return only the basic sample.
| File | Contents |
|---|---|
| getting-started.md | Setup, assemblies (required/optional), instantiate Spreadsheet/SpreadsheetRibbon, create/open/save workbooks, display charts/sparklines, register renderers |
| formulas.md | SetCellValue, named ranges (add/edit/delete), 409 formula functions (Database, Date/Time, Engineering, Financial, Information, Logical, Lookup, Math, Statistical, Text, Web) |
| editing.md | Enable/disable editing, BeginEdit/EndEdit/ValidateAndEndEdit, cell locking (Locked property), properties, methods, events (CurrentCellBeginEdit, CurrentCellValueChanged, etc.) |
| data-management.md | Import from DataTable/DataView/Business Objects/Arrays, export to DataTable (ImportDataTable, ExportDataTable, ExcelExportDataTableOptions), refresh display (InvalidateCells) |
| data-validation.md | Number/date/time/text length validation, list validation (dropdowns), custom formula validation, IDataValidation interface, comparison operators, error messages |
| hyperlinks.md | Create hyperlinks (URL, email, file, workbook cell references), add/edit/remove, ExcelHyperLinkType enum, IHyperLink interface properties |
| clipboard-operations.md | Cut/Copy/Paste, Paste Special (ExcelPasteType, ExcelPasteOptions), Fill Series (Down/Right/Up/Left) |
| conditional-formatting.md | Highlight cell rules (value, formula, text, time period), Data Bars, Color Scales, Icon Sets, IConditionalFormat interface |
| conversion.md | Convert to Image (Bitmap/Metafile), PDF (ExcelToPdfConverter, settings), HTML (SaveAsHtml), required assemblies |
| formatting.md | Cell background, font, borders, alignment (horizontal/vertical/orientation/indent), wrap text, number formats, built-in styles, format as table, clear formatting |
| freeze-panes.md | FreezeRows, FreezeColumns, FreezePanes, UnfreezePanes, XlsIO SetFreezePanes/RemoveFreezePanes |
| localization.md | CurrentUICulture setup, resource files (.resx), culture-specific localization, modify default strings |
| merge-cells.md | Merge/unmerge cells, CoveredCellInfo, IRange.Merge/UnMerge methods, InvalidateCell |
| overview.md | Feature overview (Ribbon, editing, formulas, data validation, conditional formatting, charts, sparklines, protection, conversion, supported file types) |
| outline.md | Group/ungroup rows and columns, collapse/expand groups, outline settings (summary row/column location), clear outlines, OutlineLocation enum |
| protection.md | Worksheet protection (Protect/Unprotect, ExcelSheetProtection options), workbook protection, lock/unlock cells, check protection status |
| rows-columns-operations.md | Insert/delete rows and columns, set row height/column width, hide/show rows and columns, adjust row/column dimensions |
| worksheet.md | Add/remove/rename worksheets, navigate between worksheets, access worksheets, move/copy worksheets, show/hide worksheets, worksheet events |
| filtering-and-sorting.md | AutoFilter enable/disable, filter data (number, text, date, custom), sort data (ascending/descending, custom sort), clear filters/sorting |
| find-and-replace.md | Find cells (FindAll, FindNext), replace functionality, find options (case-sensitive, whole word), search by criteria, navigate results |
| selection.md | Select ranges (single cell, multiple cells, entire row/column), get active cell, select named ranges, selection change events, clear selection |
| shapes.md | Import charts, sparklines, pictures, textboxes, add/resize/reposition shapes, access selected shapes, select/clear shape selection, GraphicChartCellRenderer, SparklineCellRenderer |
所有模板和功能代码片段均存储在references/*.md中。Agent会在生成示例时组合这些聚焦于特定功能的代码片段。
流程:始终从references/getting-started.md(前提条件与设置要求部分)开始,然后合并匹配的功能代码片段。若没有匹配的功能关键词,仅返回基础示例。
| 文件 | 内容 |
|---|---|
| getting-started.md | 设置、程序集(必填/可选)、实例化Spreadsheet/SpreadsheetRibbon、创建/打开/保存工作簿、显示图表/迷你图、注册渲染器 |
| formulas.md | SetCellValue、命名区域(添加/编辑/删除)、409种公式函数(数据库、日期/时间、工程、财务、信息、逻辑、查找、数学、统计、文本、Web) |
| editing.md | 启用/禁用编辑、BeginEdit/EndEdit/ValidateAndEndEdit、单元格锁定(Locked属性)、属性、方法、事件(CurrentCellBeginEdit、CurrentCellValueChanged等) |
| data-management.md | 从DataTable/DataView/业务对象/数组导入数据、导出到DataTable(ImportDataTable、ExportDataTable、ExcelExportDataTableOptions)、刷新显示(InvalidateCells) |
| data-validation.md | 数字/日期/时间/文本长度验证、列表验证(下拉菜单)、自定义公式验证、IDataValidation接口、比较运算符、错误提示 |
| hyperlinks.md | 创建超链接(URL、邮件、文件、工作簿单元格引用)、添加/编辑/删除、ExcelHyperLinkType枚举、IHyperLink接口属性 |
| clipboard-operations.md | 剪切/复制/粘贴、选择性粘贴(ExcelPasteType、ExcelPasteOptions)、填充序列(向下/向右/向上/向左) |
| conditional-formatting.md | 突出显示单元格规则(值、公式、文本、时间段)、数据条、色阶、图标集、IConditionalFormat接口 |
| conversion.md | 转换为图片(Bitmap/Metafile)、PDF(ExcelToPdfConverter、设置)、HTML(SaveAsHtml)、所需程序集 |
| formatting.md | 单元格背景、字体、边框、对齐方式(水平/垂直/方向/缩进)、自动换行、数字格式、内置样式、表格格式化、清除格式 |
| freeze-panes.md | FreezeRows、FreezeColumns、FreezePanes、UnfreezePanes、XlsIO SetFreezePanes/RemoveFreezePanes |
| localization.md | CurrentUICulture设置、资源文件(.resx)、特定文化本地化、修改默认字符串 |
| merge-cells.md | 合并/取消合并单元格、CoveredCellInfo、IRange.Merge/UnMerge方法、InvalidateCell |
| overview.md | 功能概述(Ribbon、编辑、公式、数据验证、条件格式、图表、迷你图、保护、转换、支持的文件类型) |
| outline.md | 分组/取消分组行和列、折叠/展开分组、大纲设置(汇总行/列位置)、清除大纲、OutlineLocation枚举 |
| protection.md | 工作表保护(Protect/Unprotect、ExcelSheetProtection选项)、工作簿保护、锁定/解锁单元格、检查保护状态 |
| rows-columns-operations.md | 插入/删除行和列、设置行高/列宽、隐藏/显示行和列、调整行/列尺寸 |
| worksheet.md | 添加/删除/重命名工作表、工作表间导航、访问工作表、移动/复制工作表、显示/隐藏工作表、工作表事件 |
| filtering-and-sorting.md | 启用/禁用自动筛选、筛选数据(数字、文本、日期、自定义)、排序数据(升序/降序、自定义排序)、清除筛选/排序 |
| find-and-replace.md | 查找单元格(FindAll、FindNext)、替换功能、查找选项(区分大小写、全字匹配)、按条件搜索、导航结果 |
| selection.md | 选择区域(单个单元格、多个单元格、整行/整列)、获取活动单元格、选择命名区域、选择更改事件、清除选择 |
| shapes.md | 导入图表、迷你图、图片、文本框、添加/调整大小/重新定位形状、访问选中形状、选择/清除形状选择、GraphicChartCellRenderer、SparklineCellRenderer |
Rules
规则
-
Use Only Reference Snippets
- Generate code exclusively from the Markdown files under `references/
- Do not invent/guess/include any properties, events, API methods, component names, or parameters not present in
references/*.md
-
NO FILE MODIFICATIONS WITHOUT PERMISSION
- Never create or modify files/folders in user workspace without explicit user selection and confirmation.
- Cannot create buttons, forms, dialogs, MessageBox or any UI elements beyond the Spreadsheet without user permission.
-
Unsupported Feature Handling
- If the user requests a feature with no corresponding snippet in , respond with:
references/*.mdThat feature is not currently supported by the Syncfusion Windows Forms Spreadsheet component. - Suggest the closest supported features only if they have snippets
- Explicitly list unsupported items and do not synthesize code for them
- If the user requests a feature with no corresponding snippet in
-
Validation Before Write
- Re-validate before writing that all code blocks originate from files
references/*.md - If validation fails, stop and inform the user
- Re-validate before writing that all code blocks originate from
-
仅使用参考代码片段
- 仅从下的Markdown文件生成代码
references/ - 禁止自行发明/猜测/包含任何中未提及的属性、事件、API方法、组件名称或参数
references/*.md
- 仅从
-
未经许可不得修改文件
- 未经用户明确选择和确认,切勿在用户工作区创建或修改文件/文件夹。
- 未经用户许可,不得创建按钮、表单、对话框、MessageBox或任何Spreadsheet之外的UI元素。
-
不支持功能的处理方式
- 若用户请求的功能在中无对应代码片段,请回复:
references/*.md该功能目前不受Syncfusion Windows Forms Spreadsheet组件支持。 - 仅在存在对应代码片段的情况下,建议最接近的支持功能
- 明确列出不支持的项,切勿合成相关代码
- 若用户请求的功能在
-
写入前验证
- 写入前重新验证所有代码块均源自文件
references/*.md - 若验证失败,停止操作并告知用户
- 写入前重新验证所有代码块均源自