syncfusion-winforms-spreadsheet-editor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Syncfusion 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 — 分析用户请求

  1. Read the user’s request and extract the feature keywords.
  2. If relevant reference/*.md files exist, use them as the only source of truth for generating code.
  3. If no matching reference file exists, generate code using the samples in references/getting-started.md.
  1. 读取用户请求并提取功能关键词。
  2. 若存在相关的reference/*.md文件,仅以此作为生成代码的唯一依据。
  3. 若没有匹配的参考文件,则使用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
    references/getting-started.md
    (Prerequisites and Setup Requirements section). If missing, ask user consent and add them.
在生成或写入任何内容之前,询问用户:
我已准备好为您生成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
    output/
    at the skill root (if it does not already exist).
  • 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

  1. Ask: "Which file should I modify? Provide the COMPLETE file path (e.g., D:\Project\Form1.cs)"
  2. Wait for explicit confirmation.
  3. If the user only replies with “2” (option number) and no path → ask again.
  4. Never guess or infer file paths.
  5. 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 — 修改用户项目中的文件

  1. 询问: "应修改哪个文件?请提供完整文件路径(例如:D:\Project\Form1.cs)"
  2. 等待用户明确确认。
  3. 若用户仅回复选项编号“2”而未提供路径 → 再次询问。
  4. 切勿猜测或推断文件路径。
  5. 确认后,执行请求的更改(覆盖或追加)。

选项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/
文件夹)

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.
FileContents
getting-started.mdSetup, assemblies (required/optional), instantiate Spreadsheet/SpreadsheetRibbon, create/open/save workbooks, display charts/sparklines, register renderers
formulas.mdSetCellValue, named ranges (add/edit/delete), 409 formula functions (Database, Date/Time, Engineering, Financial, Information, Logical, Lookup, Math, Statistical, Text, Web)
editing.mdEnable/disable editing, BeginEdit/EndEdit/ValidateAndEndEdit, cell locking (Locked property), properties, methods, events (CurrentCellBeginEdit, CurrentCellValueChanged, etc.)
data-management.mdImport from DataTable/DataView/Business Objects/Arrays, export to DataTable (ImportDataTable, ExportDataTable, ExcelExportDataTableOptions), refresh display (InvalidateCells)
data-validation.mdNumber/date/time/text length validation, list validation (dropdowns), custom formula validation, IDataValidation interface, comparison operators, error messages
hyperlinks.mdCreate hyperlinks (URL, email, file, workbook cell references), add/edit/remove, ExcelHyperLinkType enum, IHyperLink interface properties
clipboard-operations.mdCut/Copy/Paste, Paste Special (ExcelPasteType, ExcelPasteOptions), Fill Series (Down/Right/Up/Left)
conditional-formatting.mdHighlight cell rules (value, formula, text, time period), Data Bars, Color Scales, Icon Sets, IConditionalFormat interface
conversion.mdConvert to Image (Bitmap/Metafile), PDF (ExcelToPdfConverter, settings), HTML (SaveAsHtml), required assemblies
formatting.mdCell background, font, borders, alignment (horizontal/vertical/orientation/indent), wrap text, number formats, built-in styles, format as table, clear formatting
freeze-panes.mdFreezeRows, FreezeColumns, FreezePanes, UnfreezePanes, XlsIO SetFreezePanes/RemoveFreezePanes
localization.mdCurrentUICulture setup, resource files (.resx), culture-specific localization, modify default strings
merge-cells.mdMerge/unmerge cells, CoveredCellInfo, IRange.Merge/UnMerge methods, InvalidateCell
overview.mdFeature overview (Ribbon, editing, formulas, data validation, conditional formatting, charts, sparklines, protection, conversion, supported file types)
outline.mdGroup/ungroup rows and columns, collapse/expand groups, outline settings (summary row/column location), clear outlines, OutlineLocation enum
protection.mdWorksheet protection (Protect/Unprotect, ExcelSheetProtection options), workbook protection, lock/unlock cells, check protection status
rows-columns-operations.mdInsert/delete rows and columns, set row height/column width, hide/show rows and columns, adjust row/column dimensions
worksheet.mdAdd/remove/rename worksheets, navigate between worksheets, access worksheets, move/copy worksheets, show/hide worksheets, worksheet events
filtering-and-sorting.mdAutoFilter enable/disable, filter data (number, text, date, custom), sort data (ascending/descending, custom sort), clear filters/sorting
find-and-replace.mdFind cells (FindAll, FindNext), replace functionality, find options (case-sensitive, whole word), search by criteria, navigate results
selection.mdSelect ranges (single cell, multiple cells, entire row/column), get active cell, select named ranges, selection change events, clear selection
shapes.mdImport 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.mdSetCellValue、命名区域(添加/编辑/删除)、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.mdFreezeRows、FreezeColumns、FreezePanes、UnfreezePanes、XlsIO SetFreezePanes/RemoveFreezePanes
localization.mdCurrentUICulture设置、资源文件(.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

规则

  1. 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
  2. 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.
  1. Unsupported Feature Handling
    • If the user requests a feature with no corresponding snippet in
      references/*.md
      , respond with:
      That 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
  2. Validation Before Write
    • Re-validate before writing that all code blocks originate from
      references/*.md
      files
    • If validation fails, stop and inform the user
  1. 仅使用参考代码片段
    • 仅从
      references/
      下的Markdown文件生成代码
    • 禁止自行发明/猜测/包含任何
      references/*.md
      中未提及的属性、事件、API方法、组件名称或参数
  2. 未经许可不得修改文件
  • 未经用户明确选择和确认,切勿在用户工作区创建或修改文件/文件夹。
  • 未经用户许可,不得创建按钮、表单、对话框、MessageBox或任何Spreadsheet之外的UI元素。
  1. 不支持功能的处理方式
    • 若用户请求的功能在
      references/*.md
      中无对应代码片段,请回复:
      该功能目前不受Syncfusion Windows Forms Spreadsheet组件支持。
    • 仅在存在对应代码片段的情况下,建议最接近的支持功能
    • 明确列出不支持的项,切勿合成相关代码
  2. 写入前验证
    • 写入前重新验证所有代码块均源自
      references/*.md
      文件
    • 若验证失败,停止操作并告知用户