Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
dc93831
1027238: Changes committed
sumathisf3095 May 19, 2026
b94c92d
1027238: Changes committed
sumathisf3095 May 19, 2026
e4330b4
Documentation(1027606): Updated the MAUI getting started.
SrisabariSF4261 May 19, 2026
bb8e478
1023472: Update Document Editor getting started
Sujitha2610 May 19, 2026
dda2003
Merge pull request #2914 from sumathisf3095/1027238-OverviewPageHotfix
MohanaselvamJothi May 19, 2026
be2bc86
Merge branch 'hotfix/hotfix-v33.2.3' into DocumentEditor_hotfix
Sujitha2610 May 19, 2026
299d0ab
Remove extra newline in Next.js getting started guide
MohanaselvamJothi May 19, 2026
151b81a
Update getting-started.md
MohanaselvamJothi May 19, 2026
0e8a1db
Fix formatting in getting-started.md
MohanaselvamJothi May 19, 2026
01bd7af
1023472: Updated WPF Url in getting started
Sujitha2610 May 19, 2026
e80ce33
Merge branch 'DocumentEditor_hotfix' of https://github.com/syncfusion…
Sujitha2610 May 19, 2026
e416a20
Merge pull request #2917 from syncfusion-content/DocumentEditor_hotfix
MohanaselvamJothi May 19, 2026
8814de1
1027606: Updated the UG
SrisabariSF4261 May 19, 2026
aaf65a5
1027606: Updated the UG.
SrisabariSF4261 May 19, 2026
173f7d5
Merge branch 'hotfix/hotfix-v33.2.3' into BLAZ-1027606-MAUI
SrisabariSF4261 May 19, 2026
44a70a2
Merge pull request #2916 from syncfusion-content/BLAZ-1027606-MAUI
SasthaPrathap May 19, 2026
b78821c
documentation(ES-1027035): Updated the getting started images with bo…
Kalaivannan-Ganesan May 19, 2026
f150bfb
Merge pull request #2926 from syncfusion-content/ES-1027035-DOCXEdito…
MohanaselvamJothi May 19, 2026
59e48d1
1027900: Update Note format for DocxEditor getting started
Sujitha2610 May 19, 2026
310939d
Merge branch 'hotfix/hotfix-v33.2.3' into 1027900-DocxEditor-Note
Sujitha2610 May 19, 2026
9ce1ec0
Content Modified
VinothSF5015 May 20, 2026
d80d04d
content modified for issue
VinothSF5015 May 20, 2026
8bea6f2
modified
VinothSF5015 May 20, 2026
cbc0cc5
content corrected
VinothSF5015 May 20, 2026
af9ed28
Merge branch 'hotfix/hotfix-v33.2.3' of https://github.com/syncfusion…
VinothSF5015 May 20, 2026
6e996f9
1027606: Fix the note section for vue3 getting started.
prakashrajsf3945 May 20, 2026
89b97d3
1027606: Added the github for vue getting started.
prakashrajsf3945 May 20, 2026
19444ef
Merge pull request #2942 from syncfusion-content/1027606-GSPage
SasthaPrathap May 20, 2026
e176681
Merge pull request #2929 from syncfusion-content/1027900-DocxEditor-Note
MohanaselvamJothi May 20, 2026
31cca18
1027606: Overview revamp for blazor spreadsheet.
prakashrajsf3945 May 20, 2026
bf86bd5
Merge pull request #2938 from syncfusion-content/Documentation-Struct…
PandikumarSF2691 May 20, 2026
a40ec3f
1027606: Update the overview content.
prakashrajsf3945 May 20, 2026
904741e
Update overview.md
SasthaPrathap May 20, 2026
257b467
Merge branch 'hotfix/hotfix-v33.2.3' into 1027606-Overview
SasthaPrathap May 20, 2026
4cb52c1
1027606: Update the overview content.
SasthaPrathap May 20, 2026
ea4ea15
Merge pull request #2944 from syncfusion-content/1027606-Overview
prakashrajsf3945 May 20, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: Syncfusion Excel to JSON Conversion
description: In this section, you can learn how to Export Excel workbook, worksheet, and custom range Data as JSON
title: Syncfusion Excel to JSON Conversion | Syncfusion
description: This page explains how to export Excel workbook, worksheet, or custom range data into JSON format efficiently.
platform: document-processing
control: XlsIO
documentation: UG
Expand Down
201 changes: 179 additions & 22 deletions Document-Processing/Excel/Excel-Library/NET/Improving-Performance.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ This section gives you an idea for improving performance while developing with X

Get [UsedRange](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorksheet.html#Syncfusion_XlsIO_IWorksheet_UsedRange) globally. It is recommended to get the **UsedRange** in loops as follows

{% tabs %}
{% highlight c# tabtitle="C#" %}
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
int lastRow = sheet.UsedRange.LastRow;
for(int i=0;i<lastRow;i++)
{
Expand All @@ -28,7 +28,21 @@ for(int i = 0;i<sheet.UsedRange.LastRow;i++)
}
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET" %}
{% highlight c# tabtitle="C# [Windows-specific]" %}
int lastRow = sheet.UsedRange.LastRow;
for(int i=0;i<lastRow;i++)
{
//codes
}

//Do not use like below.
for(int i = 0;i<sheet.UsedRange.LastRow;i++)
{
//codes
}
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Dim lastRow As Integer = sheet.UsedRange.LastRow
For i As Integer = 0 To lastRow - 1
'codes
Expand All @@ -45,8 +59,31 @@ Next

The following code example demonstrates how to efficiently read cell values from the Excel document with high performance using GetCellValue method.

{% tabs %}
{% highlight c# tabtitle="C#" %}
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
using (ExcelEngine engine = new ExcelEngine())
{
IApplication application = engine.Excel;
application.DefaultVersion = ExcelVersion.Xlsx;
IWorkbook workbook = application.Workbooks.Open("Input.xlsx");
IWorksheet worksheet = workbook.Worksheets[0];
IRange range = worksheet.UsedRange;
int startRow = range.Row;
int endRow = range.LastRow;
int startColumn = range.Column;
int endColumn = range.LastColumn;

for (int rowIndex = startRow; rowIndex <= endRow; rowIndex++)
{
for (int columnIndex = startColumn; columnIndex <= endColumn; columnIndex++)
{
string value = worksheet.GetCellValue(rowIndex, columnIndex, false);
}
}
}
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
using (ExcelEngine engine = new ExcelEngine())
{
IApplication application = engine.Excel;
Expand All @@ -69,7 +106,7 @@ using (ExcelEngine engine = new ExcelEngine())
}
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET" %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Using engine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = engine.Excel
application.DefaultVersion = ExcelVersion.Xlsx
Expand Down Expand Up @@ -99,7 +136,27 @@ The **IMigrantRange** interface can be used to access and manipulate worksheet r
The following code example illustrates how the **IMigrantRange** is accessed.

{% tabs %}
{% highlight c# tabtitle="C#" %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
IMigrantRange migrantRange = workbook.Worksheets[0].MigrantRange;

int rowCount = 10;
int colCount = 10;

// Writing Data.
for (int row = 1; row <= rowCount; row++)
{
for (int column = 1; column <= colCount; column++)
{
// Writing values.
migrantRange.ResetRowColumn(row, column);

// Setting value of this migrant range which is similar to IRange object.
migrantRange.Value = "Syncfusion";
}
}
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
IMigrantRange migrantRange = workbook.Worksheets[0].MigrantRange;

int rowCount = 10;
Expand All @@ -119,7 +176,7 @@ for (int row = 1; row <= rowCount; row++)
}
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET" %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Dim rowCount As Integer = 10
Dim colCount As Integer = 10

Expand All @@ -142,7 +199,41 @@ Next
**IMigrantRange** provides us a [SetValue](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IMigrantRange.html#Syncfusion_XlsIO_IMigrantRange_SetValue_System_Int32_) method in which different value for the range can be assigned. Following code snippet illustrates regarding this.

{% tabs %}
{% highlight c# tabtitle="C#" %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
ExcelEngine excelEngine = new ExcelEngine();
excelEngine.Excel.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = excelEngine.Excel.Workbooks.Create();
IWorksheet sheet = workbook.Worksheets[0];
IMigrantRange migrantRange = workbook.Worksheets[0].MigrantRange;

// Writing values.
migrantRange.ResetRowColumn(1, 1);

//Setting boolean value
migrantRange.SetValue(true);
migrantRange.ResetRowColumn(1, 2);

//Setting DateTime value
migrantRange.SetValue(DateTime.Now);
migrantRange.ResetRowColumn(1, 3);

//Setting double value
migrantRange.SetValue(5.5);
migrantRange.ResetRowColumn(1, 4);

//Setting int value
migrantRange.SetValue(5);
migrantRange.ResetRowColumn(1, 5);

//Setting string value
migrantRange.SetValue("Syncfusion");
workbook.Version = ExcelVersion.Excel2013;
workbook.SaveAs("MigrantRange.xlsx");
workbook.Close();
excelEngine.Dispose();
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
ExcelEngine excelEngine = new ExcelEngine();
excelEngine.Excel.DefaultVersion = ExcelVersion.Excel2013;
IWorkbook workbook = excelEngine.Excel.Workbooks.Create();
Expand Down Expand Up @@ -176,7 +267,7 @@ workbook.Close();
excelEngine.Dispose();
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET" %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Dim excelEngine As New ExcelEngine()
excelEngine.Excel.DefaultVersion = ExcelVersion.Excel2013
Dim workbook As IWorkbook = excelEngine.Excel.Workbooks.Create()
Expand Down Expand Up @@ -218,7 +309,17 @@ Use global styles, rather than using different cell styles for each cell/range.
Use [BeginUpdate](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.Interfaces.IOptimizedUpdate.html#Syncfusion_XlsIO_Interfaces_IOptimizedUpdate_BeginUpdate) and [EndUpdate](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.Interfaces.IOptimizedUpdate.html#Syncfusion_XlsIO_Interfaces_IOptimizedUpdate_EndUpdate) call while using more than one global style for a worksheet.

{% tabs %}
{% highlight c# tabtitle="C#" %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
//Defining body style
IStyle bodyStyle = workbook.Styles.Add("BodyStyle");
bodyStyle.BeginUpdate();
bodyStyle.Color = Color.FromArgb(239, 243, 247);
bodyStyle.Borders[ExcelBordersIndex.EdgeLeft].LineStyle = ExcelLineStyle.Thin;
bodyStyle.Borders[ExcelBordersIndex.EdgeRight].LineStyle = ExcelLineStyle.Thin;
bodyStyle.EndUpdate();
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
//Defining body style
IStyle bodyStyle = workbook.Styles.Add("BodyStyle");
bodyStyle.BeginUpdate();
Expand All @@ -228,7 +329,7 @@ bodyStyle.Borders[ExcelBordersIndex.EdgeRight].LineStyle = ExcelLineStyle.Thin;
bodyStyle.EndUpdate();
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET" %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Defining body style
Dim bodyStyle As IStyle = workbook.Styles.Add("BodyStyle")
bodyStyle.BeginUpdate()
Expand All @@ -244,7 +345,36 @@ bodyStyle.EndUpdate()
Performance can be improved to a greater extent by setting default styles for rows and columns instead of setting cell styles for each cells in one or more rows and columns.

{% tabs %}
{% highlight c# tabtitle="C#" %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
//Set default styles for rows and columns
IStyle style = workbook.Styles.Add("Style");
style.Font.FontName = "Arial";
style.Font.Size = 10;

//Set default style for the entire row (3rd row)
worksheet.SetDefaultRowStyle(3, style);

//Set default style for entire rows from 4 to 8 (4th row to 8th row)
worksheet.SetDefaultRowStyle(4, 8, style);

//Set default style for the entire column A (1st column)
worksheet.SetDefaultColumnStyle(1, style);

//Set default style for entire columns from B to L (2nd column to 12th column)
worksheet.SetDefaultColumnStyle(2, 12, style);

//Do not use like below when an entire row/column or a number of rows/columns need to be formatted with common styles, as it will affect performance
//worksheet.Range["4:8"].CellStyle.Font.FontName = "Arial";
//worksheet.Range["4:8"].CellStyle.Font.Size = 10;
//worksheet.Range["A:L"].CellStyle.Font.FontName = "Arial";
//worksheet.Range["A:L"].CellStyle.Font.Size = 10;

//CellStyle property can be used only when one cell or a range of cells has to be formatted like below
//worksheet.Range["D2"].CellStyle.Font.FontName = "Arial";
//worksheet.Range["A1:L2"].CellStyle.Font.Size = 10;
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
//Set default styles for rows and columns
IStyle style = workbook.Styles.Add("Style");
style.Font.FontName = "Arial";
Expand Down Expand Up @@ -273,7 +403,7 @@ worksheet.SetDefaultColumnStyle(2, 12, style);
//worksheet.Range["A1:L2"].CellStyle.Font.Size = 10;
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET" %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Set default styles for rows and columns
Dim style As IStyle = workbook.Styles.Add("Style")
style.Font.FontName = "Arial"
Expand Down Expand Up @@ -309,16 +439,24 @@ Minimize AutoFit manipulations which reduces the time consumption.

For improved performance in Excel to PDF conversion, it is recommended to set the [SkipAutoFitRow](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_SkipAutoFitRow) property of [IApplication](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html) as TRUE.

{% tabs %}
{% highlight c# tabtitle="C#" %}
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;

//Skips AutoFitting of rows during conversion
application.SkipAutoFitRow = true;
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
ExcelEngine excelEngine = new ExcelEngine();
IApplication application = excelEngine.Excel;

//Skips AutoFitting of rows during conversion
application.SkipAutoFitRow = true;
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET" %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Dim excelEngine As ExcelEngine = New ExcelEngine()
Dim application As IApplication = excelEngine.Excel

Expand All @@ -332,7 +470,16 @@ application.SkipAutoFitRow = True
[ImportDataTable](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorksheet.html#Syncfusion_XlsIO_IWorksheet_ImportDataTable_System_Data_DataTable_System_Int32_System_Int32_System_Boolean_) overload method which has **ImportOnSave** argument allows you to import data with less memory consumption along with improved method performance by serializing the data directly on save method. This option is preferred for larger data that need to be imported in short time.

{% tabs %}
{% highlight c# tabtitle="C#" %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
DataTable table = Worksheet.ExportDataTable(1, 1, Worksheet.UsedRange.LastRow, Worksheet.UsedRange.LastColumn, ExcelExportDataTableOptions.DetectColumnTypes); 

//Enable ImportOnSave option along with column header.
workbook.Worksheets[0].ImportDataTable(table, 1, 1, true, true);
workbook.Version = ExcelVersion.Excel2013; 
workbook.SaveAs("Output.xlsx");
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
DataTable table = Worksheet.ExportDataTable(1, 1, Worksheet.UsedRange.LastRow, Worksheet.UsedRange.LastColumn, ExcelExportDataTableOptions.DetectColumnTypes); 

//Enable ImportOnSave option along with column header.
Expand All @@ -341,7 +488,7 @@ workbook.Version = ExcelVersion.Excel2013; 
workbook.SaveAs("Output.xlsx");
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET" %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Dim table As DataTable = Worksheet.ExportDataTable(1, 1, Worksheet.UsedRange.LastRow, Worksheet.UsedRange.LastColumn, ExcelExportDataTableOptions.DetectColumnTypes)

'Enable ImportOnSave option along with column header.
Expand All @@ -362,8 +509,18 @@ workbook.SaveAs("Output.xlsx")

Use of [BeginUpdate](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.Interfaces.IOptimizedUpdate.html#Syncfusion_XlsIO_Interfaces_IOptimizedUpdate_BeginUpdate) and [EndUpdate](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.Interfaces.IOptimizedUpdate.html#Syncfusion_XlsIO_Interfaces_IOptimizedUpdate_EndUpdate) methods for large blocks of Data Validation greatly improves the performance.

{% tabs %}
{% highlight c# tabtitle="C#" %}
{% tabs %}
{% highlight c# tabtitle="C# [Cross-platform]" %}
// List data validation for entire column
IDataValidation validation = sheet.Range["A3"].EntireColumn.DataValidation;
validation.BeginUpdate();
validation.DataRange = sheet.Range["D1:D56"];
validation.IsEmptyCellAllowed = true;
validation.IsListInFormula = false;
validation.EndUpdate();
{% endhighlight %}

{% highlight c# tabtitle="C# [Windows-specific]" %}
// List data validation for entire column
IDataValidation validation = sheet.Range["A3"].EntireColumn.DataValidation;
validation.BeginUpdate();
Expand All @@ -373,7 +530,7 @@ validation.IsListInFormula = false;
validation.EndUpdate();
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET" %}
{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
' List data validation for entire column
Dim validation As IDataValidation = sheet.Range("A3").EntireColumn.DataValidation
validation.BeginUpdate()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,14 @@ workbook.Close();
//Dispose the instance of ExcelEngine
excelEngine.Dispose();
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Close the instance of IWorkbook
workbook.Close();

'Dispose the instance of ExcelEngine
excelEngine.Dispose();
{% endhighlight %}
{% endtabs %}

T>You can use [ThrowNotSavedOnDestroy](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.ExcelEngine.html#Syncfusion_XlsIO_ExcelEngine_ThrowNotSavedOnDestroy) property of [ExcelEngine](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.ExcelEngine.html) object to prevent the data loss while unfortunately closing the workbook or disposing excel engine without saving contents. If it is set to true, then **ExcelWorkbookNotSavedException** will be thrown when you forgot to save the workbook before closing them. Following code illustrates how to set [ThrowNotSavedOnDestroy](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.ExcelEngine.html#Syncfusion_XlsIO_ExcelEngine_ThrowNotSavedOnDestroy) property of [ExcelEngine](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.ExcelEngine.html) object.
Expand All @@ -62,6 +70,13 @@ ExcelEngine excelEngine = new ExcelEngine();
//No exception will be thrown if there are unsaved workbooks
excelEngine.ThrowNotSavedOnDestroy = true;
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
Dim excelEngine As New ExcelEngine()

'No exception will be thrown if there are unsaved workbooks
excelEngine.ThrowNotSavedOnDestroy = True
{% endhighlight %}
{% endtabs %}

A complete working example for creating and editing an Excel workbook in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Read%20and%20Edit%20Excel/Read%20and%20Edit%20Excel).
Expand Down Expand Up @@ -115,4 +130,26 @@ workbook.Version = ExcelVersion.Xlsx;
//Save the workbook to disk in xlsx format
workbook.SaveAs("Output.xlsx", Response, ExcelDownloadType.Open, ExcelHttpContentType.Excel2016);
{% endhighlight %}

{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %}
'Creates a new instance for ExcelEngine
Dim excelEngine As New ExcelEngine()

'Initialize IApplication
Dim application As IApplication = excelEngine.Excel

'Loads or open an existing workbook through Open method of IWorkbooks
Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx")

'To-Do some manipulation
'To-Do some manipulation

'Set the version of the workbook
workbook.Version = ExcelVersion.Xlsx

'Save the workbook to stream
Dim outputStream As New MemoryStream()
workbook.SaveAs(outputStream)
outputStream.Position = 0
{% endhighlight %}
{% endtabs %}
Loading