|
Syncfusion.Pdf.Base.dll |
@@ -123,11 +124,11 @@ WPF Spreadsheet control can be added to an application either through the design
{% tabcontent Via Designer %}
-1. Add the theme and the [SfSkinManager](https://help.syncfusion.com/cr/wpf/Syncfusion.SfSkinManager.html) namespace to style the control correctly. Then, include the SfSkinManager namespace in the XAML code and apply the desired theme.
+1. Add the theme and the [SfSkinManager](https://help.syncfusion.com/cr/wpf/Syncfusion.SfSkinManager.html) namespace to style the control correctly. Include the SfSkinManager namespace in the XAML code, declare a `Grid` root with two rows, and apply the desired theme.
{% tabs %}
{% highlight xaml tabtitle="MainWindow.xaml" %}
-® Controls tab, and find the SfSpreadsheet/SfSpreadsheetRibbon toolbox items.
+2. Open the Visual Studio **Toolbox**. Navigate to the Syncfusion® Controls tab and find the `SfSpreadsheet` and `SfSpreadsheetRibbon` toolbox items. (If the Syncfusion tab is missing, install the controls using the [Syncfusion® WinForms/WPF installer](https://help.syncfusion.com/wpf/visual-studio-integration/visual-studio-extensions/extensions) and restart Visual Studio.)

-3. Drag `SfSpreadsheetRibbon` and drop in the Designer area from the Toolbox.
+3. Drag `SfSpreadsheet` and `SfSpreadsheetRibbon` from the Toolbox and drop them in the Designer area.

@@ -178,7 +179,7 @@ WPF Spreadsheet control can be added to an application either through the design
{% endhighlight %}
{% endtabs %}
-N> Declare a name for the Spreadsheet component as shown above for reference.
+N> Declare a name for the Spreadsheet component (for example, `x:Name="spreadsheet"`) so that it can be referenced from the Ribbon.

@@ -189,7 +190,7 @@ N> Declare a name for the Spreadsheet component as shown above for reference.
@@ -231,33 +232,39 @@ Spreadsheet is available in the following namespace “_Syncfusion_._UI_._Xaml_.
{% endhighlight %}
{% highlight c# tabtitle="MainWindow.xaml.cs" %}
-public MainWindow()
+using Syncfusion.SfSkinManager;
+using Syncfusion.UI.Xaml.Spreadsheet;
+
+public partial class MainWindow : Window
{
- InitializeComponent();
+ public MainWindow()
+ {
+ InitializeComponent();
- SfSkinManager.ApplyThemeAsDefaultStyle = true;
+ SfSkinManager.ApplyThemeAsDefaultStyle = true;
- SfSkinManager.SetTheme(this, new Theme("Windows11Light"));
+ SfSkinManager.SetTheme(this, new Theme("Windows11Light"));
- Grid grid = new Grid();
+ Grid grid = new Grid();
- grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
+ grid.RowDefinitions.Add(new RowDefinition { Height = GridLength.Auto });
- grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
+ grid.RowDefinitions.Add(new RowDefinition { Height = new GridLength(1, GridUnitType.Star) });
- SfSpreadsheet spreadsheet = new SfSpreadsheet();
+ SfSpreadsheet spreadsheet = new SfSpreadsheet();
- SfSpreadsheetRibbon ribbon = new SfSpreadsheetRibbon() { SfSpreadsheet = spreadsheet };
+ SfSpreadsheetRibbon ribbon = new SfSpreadsheetRibbon() { SfSpreadsheet = spreadsheet };
- Grid.SetRow(ribbon, 0);
+ Grid.SetRow(ribbon, 0);
- Grid.SetRow(spreadsheet, 1);
+ Grid.SetRow(spreadsheet, 1);
- grid.Children.Add(ribbon);
+ grid.Children.Add(ribbon);
- grid.Children.Add(spreadsheet);
+ grid.Children.Add(spreadsheet);
- this.Content = grid;
+ this.Content = grid;
+ }
}
{% endhighlight %}
{% endtabs %}
@@ -272,10 +279,15 @@ Press Ctrl+F5 (Windows) or ⌘+F5 (m

-To learn how to create, open, and save files in the WPF Spreadsheet Component, see [Workbook Operations.](Workbook-Operations)
+## Next steps
+
+To learn how to create, open, and save files in the WPF Spreadsheet Component, see [Workbook Operations](Workbook-Operations).
+
+[Find the complete WPF Spreadsheet sample on GitHub.](https://github.com/SyncfusionExamples/create-view-edit-excel-files-using-wpf-spreadsheet)
-N>[View Sample in GitHub.](https://github.com/SyncfusionExamples/create-view-edit-excel-files-using-wpf-spreadsheet). Looking for the full WPF Spreadsheet Editor component overview, features, pricing, and documentation? Visit the [WPF Spreadsheet Editor](https://www.syncfusion.com/spreadsheet-editor-sdk/wpf-spreadsheet-editor) page.
+For the full WPF Spreadsheet Editor component overview, features, pricing, and documentation, visit the [WPF Spreadsheet Editor](https://www.syncfusion.com/spreadsheet-editor-sdk/wpf-spreadsheet-editor) page.
## See Also
+- [Workbook Operations](Workbook-Operations)
- [Data Management](Data-Management)
-- [Display Charts and Sparklines ](Shapes)
\ No newline at end of file
+- [Shapes](Shapes)
\ No newline at end of file
diff --git a/Document-Processing/Excel/Spreadsheet/WPF/Worksheet-Management.md b/Document-Processing/Excel/Spreadsheet/WPF/Worksheet-Management.md
index 3e2a09cd39..96b6291032 100644
--- a/Document-Processing/Excel/Spreadsheet/WPF/Worksheet-Management.md
+++ b/Document-Processing/Excel/Spreadsheet/WPF/Worksheet-Management.md
@@ -8,132 +8,140 @@ documentation: ug
---
# Worksheet Management in WPF Spreadsheet (SfSpreadsheet)
-This section explains about the operations that are performed with the worksheet.
+This section explains the operations that are performed with the worksheet.
-## Insert and Delete worksheet
+> **Prerequisites** — The following namespaces must be imported in your code-behind file:
+> ```csharp
+> using Syncfusion.UI.Xaml.Spreadsheet;
+> using Syncfusion.XlsIO;
+> ```
+
+## Inserting and Deleting a Worksheet
SfSpreadsheet provides support to insert and delete the worksheets in a workbook.
{% tabs %}
{% highlight c# %}
//Insert Sheet
- spreadsheet.AddSheet();
+spreadsheet.AddSheet();
-//Insert sheet with name
- spreadsheet.AddSheet("Sheet4", 3);
+//Insert sheet with name and position (1-based index)
+spreadsheet.AddSheet("Sheet4", 3);
-//Delete Sheet
+//Delete Sheet by name
spreadsheet.RemoveSheet("Sheet2");
{% endhighlight %}
{% endtabs %}
-## Hide and Unhide worksheets
+## Hiding and Unhiding Worksheets
SfSpreadsheet provides support to hide and unhide the worksheets in a workbook.
{% tabs %}
{% highlight c# %}
//Hide Sheet
-spreadsheet.HideSheet("Sheet 2");
+spreadsheet.HideSheet("Sheet2");
//Unhide Sheet
-spreadsheet.UnhideSheet("Sheet 2");
+spreadsheet.UnhideSheet("Sheet2");
{% endhighlight %}
{% endtabs %}
-## Hide or unhide sheet tabs
+## Hiding or Unhiding Sheet Tabs
-Spreadsheet provides support to hide and unhide the all worksheet tabs in the workbook using the [ShowSheetTabs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_ShowSheetTabs) property. The Default value is `true`.
+SfSpreadsheet provides support to hide and unhide all worksheet tabs in the workbook using the [ShowSheetTabs](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_ShowSheetTabs) property. The default value is `true`.
{% tabs %}
{% highlight c# %}
+//Subscribe to the Loaded event of SfSpreadsheet in the constructor
+spreadsheet.Loaded += SpreadsheetControl_Loaded;
+
private void SpreadsheetControl_Loaded(object sender, RoutedEventArgs e)
{
- spreadsheetControl.ShowSheetTabs = false;
+ spreadsheet.ShowSheetTabs = false;
}
{% endhighlight %}
{% highlight XAML %}
-
+
{% endhighlight %}
{% endtabs %}
-## Rename a worksheet
+## Renaming a Worksheet Programmatically
-SfSpreadsheet provides support to rename a worksheet in the workbook by using [RenameSheet](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_RenameSheet_System_String_) method. After invoking this method, the sheet tab enters into editing mode and now the users can change the name of the sheet in the tab.
+SfSpreadsheet provides support to rename a worksheet in the workbook programmatically by using the [RenameSheet](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_RenameSheet_System_String_System_String_) method, which accepts the existing sheet name and the new sheet name.
{% tabs %}
{% highlight c# %}
-//Rename sheet
-spreadsheet.RenameSheet("Sheet1");
+//To Rename a sheet programmatically
+spreadsheet.RenameSheet("ExistingSheetName", "NewSheetName");
{% endhighlight %}
{% endtabs %}
-### Rename a worksheet programmatically
+> **Note** — The new sheet name must be unique within the workbook. If the new name already exists, is empty, or contains invalid characters, the rename operation will be rejected and an exception will be thrown.
+
+### Renaming a Worksheet through the UI
-SfSpreadsheet provides support to rename a worksheet in the workbook programmatically by using [RenameSheet](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_RenameSheet_System_String_System_String_) method.
+SfSpreadsheet also provides support to rename a worksheet through the sheet tab UI by using the [RenameSheet](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_RenameSheet_System_String_) method. After invoking this method, the sheet tab enters edit mode, allowing the user to change the sheet name in its tab.
{% tabs %}
{% highlight c# %}
-//To Rename a sheet programmatically
-spreadsheet.RenameSheet("ExistingSheetName", "NewSheetName");
+//Rename sheet through the UI
+spreadsheet.RenameSheet("Sheet1");
{% endhighlight %}
{% endtabs %}
## Worksheet Protection
-### Protecting a worksheet
-
-SfSpreadsheet provides support to protect the worksheet with or without password. This helps to prevent a user from modifying the contents of the worksheet. The protection of worksheet can be done with [ExcelSheetProtection](https://help.syncfusion.com/cr/wpf/Syncfusion.XlsIO.ExcelSheetProtection.html) options also.
-
-The Protect sheet options are
-
-* LockedCells - Allows the users to select the locked cells of the protected worksheet.
+> **Required assembly** — The `ExcelSheetProtection` flags used in the following examples are defined in the `Syncfusion.XlsIO.Base` assembly.
-* UnLockedCells - Allows the users to select the unlocked cells of the protected worksheet.
+### Protecting a Worksheet
-* FormattingCells - Allows the users to format any cell on a protected worksheet.
+SfSpreadsheet provides support to protect the worksheet with or without a password. This helps to prevent a user from modifying the contents of the worksheet. The protection of a worksheet can also be done with [ExcelSheetProtection](https://help.syncfusion.com/cr/wpf/Syncfusion.XlsIO.ExcelSheetProtection.html) options.
-* FormattingRows - Allows the users to format any row on a protected worksheet.
+The Protect Sheet options are
-* FormattingColumns - Allows the users to format any column on a protected worksheet.
+* **LockedCells** - Allows the users to select the locked cells of the protected worksheet.
+* **UnLockedCells** - Allows the users to select the unlocked cells of the protected worksheet.
+* **FormattingCells** - Allows the users to format any cell on a protected worksheet.
-* InsertingRows - Allows the users to insert rows on the protected worksheet.
-
-* InsertingColumns - Allows the users to insert columns on the protected worksheet.
-
-* InsertingHyperlinks - Allows the users to insert hyperlinks on the protected worksheet.
-
-* DeletingRows - Allows the users to delete rows on the protected worksheet.
-
-* DeletingColumns - Allows the users to delete columns on the protected worksheet.
-
-* Objects - Allows the users to edit the objects such as Graphic cells like charts,rich textbox, etc.
+* **FormattingRows** - Allows the users to format any row on a protected worksheet.
+* **FormattingColumns** - Allows the users to format any column on a protected worksheet.
+* **InsertingRows** - Allows the users to insert rows on the protected worksheet.
+* **InsertingColumns** - Allows the users to insert columns on the protected worksheet.
+* **InsertingHyperlinks** - Allows the users to insert hyperlinks on the protected worksheet.
+* **DeletingRows** - Allows the users to delete rows on the protected worksheet.
+* **DeletingColumns** - Allows the users to delete columns on the protected worksheet.
+* **Objects** - Allows the users to edit the objects such as Graphic cells like charts, rich text box, etc.
{% tabs %}
{% highlight c# %}
//Protect the sheet with password
spreadsheet.ProtectSheet(spreadsheet.ActiveSheet, "123");
-//Protect the sheet with Protection options
+//Protect the sheet with a single Protection option
spreadsheet.ProtectSheet(spreadsheet.ActiveSheet, "123", ExcelSheetProtection.FormattingCells);
+//Protect the sheet with multiple Protection options (combined using the bitwise OR operator)
+spreadsheet.ProtectSheet(spreadsheet.ActiveSheet, "123",
+ ExcelSheetProtection.FormattingCells | ExcelSheetProtection.InsertingRows | ExcelSheetProtection.DeletingColumns);
+
//Unprotect the sheet
spreadsheet.UnProtectSheet(spreadsheet.ActiveSheet, "123");
{% endhighlight %}
{% endtabs %}
-### Protecting a workbook
+### Protecting a Workbook
-SfSpreadsheet provides support to protect the structure and windows of a workbook. By protecting the structure, prevent a user from adding or deleting worksheets or from displaying hidden worksheets. By protecting the windows in the workbook, you can control the size of the workbook, etc.
+SfSpreadsheet provides support to protect the structure and windows of a workbook. Protecting the structure prevents a user from adding, deleting, renaming, or reordering worksheets, and from viewing hidden worksheets. Protecting the windows controls the workbook window's size and position, and prevents the user from moving, resizing, or closing the window when the workbook is opened.
{% tabs %}
{% highlight c# %}
-// To Protect the Workbook
+// To Protect the Workbook (protectStructure: true, protectWindows: true, password)
spreadsheet.Protect(true, true, "123");
//To Unprotect the Workbook
@@ -143,7 +151,7 @@ spreadsheet.Unprotect("123");
## Gridlines
-SfSpreadsheet provides support to control the visibility and color of the Gridlines in a worksheet.
+SfSpreadsheet provides support to control the visibility and color of the gridlines in a worksheet.
{% tabs %}
{% highlight c# %}
@@ -157,33 +165,37 @@ spreadsheet.SetGridLinesVisibility(false);
## Headings
-SfSpreadsheet provides support to control the visibility of row and column headers in a worksheet
+SfSpreadsheet provides support to control the visibility of row and column headers in a worksheet.
{% tabs %}
{% highlight c# %}
//To hide the Header cells visibility
spreadsheet.SetRowColumnHeadersVisibility(false);
+
+//To show the Header cells visibility
+spreadsheet.SetRowColumnHeadersVisibility(true);
{% endhighlight %}
{% endtabs %}
## Zooming
-SfSpreadsheet provides support to zoom in and zoom out of a worksheet view. The property [AllowZooming](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_AllowZooming) determines whether to allow zooming or not.
+SfSpreadsheet provides support to zoom in and zoom out of a worksheet view. The property [AllowZooming](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_AllowZooming) determines whether zooming is enabled.
{% tabs %}
{% highlight c# %}
-//zoom factor
+//Disable zooming
+spreadsheet.AllowZooming = false;
+
+//Set the zoom factor (percentage) for a specific sheet
spreadsheet.SetZoomFactor("Sheet1", 200);
{% endhighlight %}
{% endtabs %}
-The Events associated with the Zooming are
-
-. [ZoomFactorChanged](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_ZoomFactorChanged)
+## Events
-. [ZoomFactorChanging](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html#Syncfusion_UI_Xaml_Spreadsheet_SfSpreadsheet_ZoomFactorChanging)
+The following tables list the events raised by the SfSpreadsheet control and its associated grid components.
-## Events
+### SfSpreadsheet Events
@@ -197,7 +209,7 @@ Occurs when the workbook is to be created in SfSpreadsheet.
|
{{ '[WorkbookLoaded](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html) ' | markdownify }} |
-Occur when the workbook is loaded in SfSpreadsheet. |
+Occurs when the workbook is loaded in SfSpreadsheet.
|
{{ '[WorksheetAdding](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SfSpreadsheet.html) ' | markdownify }}
@@ -253,7 +265,7 @@ Occurs when opening the context menu of the cell in SfSpreadsheet. |
|
{{ '[QueryRange](https://help.syncfusion.com/cr/wpf/Syncfusion.UI.Xaml.Spreadsheet.SpreadsheetGrid.html) ' | markdownify }} |
-Occurs when grid queries for IRange information about a specific cell while rendering. |
+Occurs when the SpreadsheetGrid queries for IRange information about a specific cell while rendering.
|