syncfusion-wpf-spreadsheet-editor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Syncfusion WPF Spreadsheet Editor

Syncfusion WPF 电子表格编辑器

Overview

概述

Build Excel-like spreadsheet applications in WPF using Syncfusion SfSpreadsheet control with full support for workbook operations, formulas, charts, data validation, and ribbon customization.
使用Syncfusion SfSpreadsheet控件在WPF中构建类Excel的电子表格应用,全面支持工作簿操作、公式、图表、数据验证和功能区自定义。

Key Capabilities

核心功能

  • Workbook Operations: Create/open/save Excel files (XLS, XLSX, XLSM, CSV), multiple worksheets, freeze panes, zoom, protection
  • Cell Operations: Editing, formatting (fonts, colors, borders, alignment), merge cells, comments, hyperlinks, bookmarks
  • Data Features: 400+ Excel-compatible formulas, named ranges, data validation, conditional formatting, fill series
  • Advanced Features: Charts, sparklines, clipboard operations, undo/redo, grouping/outlines
  • Conversion: Export to PDF, HTML, Image, CSV
  • 工作簿操作: 创建/打开/保存Excel文件(XLS、XLSX、XLSM、CSV)、多工作表、冻结窗格、缩放、保护
  • 单元格操作: 编辑、格式设置(字体、颜色、边框、对齐方式)、合并单元格、批注、超链接、书签
  • 数据特性: 400+兼容Excel的公式、命名区域、数据验证、条件格式、序列填充
  • 高级特性: 图表、迷你图、剪贴板操作、撤销/重做、分组/大纲
  • 格式转换: 导出为PDF、HTML、图片、CSV

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 WPF Code — Workflow

生成WPF代码 — 工作流程

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: Ask User for Delivery Option

步骤1:询问用户交付选项

Before showing code, ask:
"How would you like me to provide the solution?

Option 1: Create a new file in skill folder (.codestudio/skills/wpf-spreadsheet-editor/output/)
Option 2: Add code to an existing file in your project (you provide the file path)
Option 3: Just show the code (no files created/modified)

Please select Option 1, 2, or 3."
⏸️ WAIT for explicit user selection before proceeding.
展示代码前,询问:
"您希望我如何提供解决方案?

选项1:在技能文件夹中创建新文件(.codestudio/skills/wpf-spreadsheet-editor/output/)
选项2:将代码添加到项目中的现有文件(请提供文件路径)
选项3:仅展示代码(不创建/修改文件)

请选择选项1、2或3。"
⏸️ 等待用户明确选择后再继续。

Step 2: Generate Code from Reference Files

步骤2:从参考文件生成代码

  • Read relevant
    references/*.md
    file(s) for requested feature
  • Build C# and/or XAML code using ONLY snippets from reference files
  • Do NOT show code yet, do NOT create files yet
  • 读取与请求功能相关的
    references/*.md
    文件
  • 仅使用参考文件中的代码片段构建C#和/或XAML代码
  • 暂不展示代码,也不创建文件

Step 3: Handle User Selection

步骤3:处理用户选择

Option 1: Show code → automatically save to
.codestudio/skills/wpf-spreadsheet-editor/output/
(skill folder only) Option 2: Ask for file path → show code → wait for explicit YES confirmation → apply code → ask to build Option 3: Show code with summary and required assemblies → done (no files created/modified)
  • 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.

选项1: 展示代码 → 自动保存到
.codestudio/skills/wpf-spreadsheet-editor/output/
(仅限技能文件夹) 选项2: 请求文件路径 → 展示代码 → 等待用户明确确认YES → 应用代码 → 询问是否构建 选项3: 展示代码及摘要和所需程序集 → 完成(不创建/修改文件)
  • 仅针对选项2: 生成代码前,检查项目是否满足
    references/getting-started.md
    中的前提条件(前提条件和设置要求部分)。如果缺失,请求用户同意后添加。

Out-of-Scope Requests

超出范围的请求

When a user asks a question that does NOT match the skill domain (i.e., not related to WPF 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 WPF 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", "UI", "code", "Ribbon", "WPF" (in context of spreadsheet/Excel).

当用户提出的问题不属于本技能领域(即与WPF电子表格、Excel处理或Syncfusion电子表格控件无关)时,回复:
"无法处理该输入,请换一种方式提供输入。"
请勿尝试:
  • 生成电子表格/Excel领域外的代码
  • 提供与电子表格功能无关的通用WPF指导
  • 处理其他Syncfusion控件或无关框架的请求
  • 协助处理非电子表格特性
仅当用户请求匹配触发关键词时,才激活本技能及其工作流: "spreadsheet"、"Excel"、"UI"、"code"、"Ribbon"、"WPF"(在电子表格/Excel语境下)。

Code 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.mdAssemblies, XAML setup, create/open/save workbook, import from datatable and export to datatable
localization.mdLocalization and language support in spreadsheet
ribbon.mdBuilt-in ribbon overview and integration
ribbon-customization.mdAdd/remove ribbon tabs and items, cancel ribbon commands
worksheet-management.mdInsert sheet/delete sheet/rename sheet/ hide sheets, gridlines, headings, zoom, events
editing-and-selection.mdCell editing, cut/copy/paste, keyboard interaction
selection.mdCell selection modes, select ranges, select rows/columns
find-and-replace.mdFind All, Find Next, Find Conditional Formatting, Find Constants, Find Formulas, Find Data Validation, Replace All, and Replace operations
formulas.md400+ Excel-compatible formulas, formula bar, multi-threaded calculation, name ranges
name-manager.mdCreate, edit, and manage named ranges
cell-comments.mdCreate, edit, and manage cell comments and notes
cell-formatting.mdset Text values , numbers values , dates values , borders, fonts, fill colors, alignment, font styles, wrap text, build in styles, format as table, clear formatting
resizing-and-hiding.mdInsert/Delete, Hide/unhide rows and columns, set row height and column width
sorting-and-filtering.mdSorting and filtering data, apply filters, custom sort orders, filter by values and criteria
conditional-formatting.mdData bars, icon sets, color scales, rule-based formatting
data-validation.mdInput restrictions, error alerts, list and cross-sheet validation
freeze-panes.mdFreeze rows and columns for easy navigation and scrolling
clipboard-operations.mdCut, copy, paste with paste-special options
charts-pictures-textboxes.mdImport and display charts, images, and textboxes
outlines.mdGroup/ungroup rows and columns, expand/collapse outline levels
sparklines.mdImport line, column, and win/loss sparklines
merge-cells.mdMerge and unmerge cells
workbook-worksheet-protection.mdPassword-protect worksheets and workbook structure
conversion.mdExport to PDF, HTML, image, and CSV; printing spreadsheet
fill-series.mdAuto-fill cells with series values and patterns
floating-cells.mdWork with floating cells and textboxes
hyperlinks-and-bookmarks.mdCreate and manage hyperlinks and bookmarks
supported-file-types.mdSupported file formats and import/export options
undo-redo.mdUndo and redo operations in spreadsheet
zooming.mdZoom in/out and adjust view levels

所有模板和功能代码片段均存储在
references/*.md
中。代理生成示例时会组合这些聚焦的代码片段。
流程:始终从
references/getting-started.md
(前提条件和设置要求部分)开始,然后合并匹配的功能代码片段。如果没有匹配的功能关键词,仅返回基础示例。
文件内容
getting-started.md程序集、XAML设置、创建/打开/保存工作簿、从数据表导入和导出到数据表
localization.md电子表格中的本地化和语言支持
ribbon.md内置功能区概述与集成
ribbon-customization.md添加/移除功能区选项卡和项、取消功能区命令
worksheet-management.md插入/删除/重命名/隐藏工作表、网格线、标题、缩放、事件
editing-and-selection.md单元格编辑、剪切/复制/粘贴、键盘交互
selection.md单元格选择模式、选择范围、选择行/列
find-and-replace.md全部查找、查找下一个、查找条件格式、查找常量、查找公式、查找数据验证、全部替换和替换操作
formulas.md400+兼容Excel的公式、公式栏、多线程计算、命名区域
name-manager.md创建、编辑和管理命名区域
cell-comments.md创建、编辑和管理单元格批注和注释
cell-formatting.md设置文本值、数值、日期值、边框、字体、填充颜色、对齐方式、字体样式、自动换行、内置样式、表格格式、清除格式
resizing-and-hiding.md插入/删除、隐藏/取消隐藏行和列、设置行高和列宽
sorting-and-filtering.md数据排序和筛选、应用筛选器、自定义排序顺序、按值和条件筛选
conditional-formatting.md数据条、图标集、色阶、基于规则的格式设置
data-validation.md输入限制、错误提示、列表和跨表验证
freeze-panes.md冻结行和列以便于导航和滚动
clipboard-operations.md剪切、复制、粘贴及选择性粘贴选项
charts-pictures-textboxes.md导入和显示图表、图片和文本框
outlines.md分组/取消分组行和列、展开/折叠大纲级别
sparklines.md导入折线、柱形和盈亏迷你图
merge-cells.md合并和取消合并单元格
workbook-worksheet-protection.md用密码保护工作表和工作簿结构
conversion.md导出为PDF、HTML、图片和CSV;打印电子表格
fill-series.md使用序列值和模式自动填充单元格
floating-cells.md处理浮动单元格和文本框
hyperlinks-and-bookmarks.md创建和管理超链接和书签
supported-file-types.md支持的文件格式及导入/导出选项
undo-redo.md电子表格中的撤销和重做操作
zooming.md放大/缩小和调整视图级别

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 StackPanel, buttons, textblocks, dialogs, ,MessageBox or any UI elements beyond the Spreadsheet without user permission.
  3. 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 WPF Spreadsheet component.
    • Suggest the closest supported features only if they have snippets
    • Explicitly list unsupported items and do not synthesize code for them
  4. 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. 未经许可不得修改文件
    • 未经用户明确选择和确认,不得在用户工作区中创建或修改文件/文件夹
    • 未经用户许可,不得创建StackPanel、按钮、文本块、对话框、MessageBox或任何超出Spreadsheet的UI元素
  3. 不支持特性的处理
    • 如果用户请求的特性在
      references/*.md
      中没有对应的代码片段,回复:
      该特性目前不受Syncfusion WPF Spreadsheet组件支持。
    • 仅当存在代码片段时,建议最接近的支持特性
    • 明确列出不支持的项,不得合成相关代码
  4. 写入前验证
    • 写入前重新验证所有代码块均来自
      references/*.md
      文件
    • 如果验证失败,停止操作并通知用户