diff --git a/Document-Processing/Excel/Conversions/CSV-to-Excel/NET/CSV-to-Excel-Conversion.md b/Document-Processing/Excel/Conversions/CSV-to-Excel/NET/CSV-to-Excel-Conversion.md index 4aaeb2acc9..0496cc16cc 100644 --- a/Document-Processing/Excel/Conversions/CSV-to-Excel/NET/CSV-to-Excel-Conversion.md +++ b/Document-Processing/Excel/Conversions/CSV-to-Excel/NET/CSV-to-Excel-Conversion.md @@ -1,6 +1,6 @@ --- title: Syncfusion CSV to Excel Conversion -description: In this section, you can learn how to convert CSV docuemnt to Excel document using Syncfusion Essential XlsIO. +description: Lists how to convert a CSV (or TSV) document to an Excel workbook using the Syncfusion .NET Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -8,16 +8,18 @@ documentation: UG # CSV to Excel Conversion -XlsIO supports converting CSV data to Excel files by saving the workbook using the [SaveAs](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAs_System_IO_Stream_) method. When opening a CSV file, users can specify various delimiters to structure the data appropriately. +XlsIO can read a CSV file with [`IWorkbooks.Open`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbooks.html#Syncfusion_XlsIO_IWorkbooks_Open_System_String_System_String_) and write the result to an Excel workbook with [`IWorkbook.SaveAs`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAs_System_String_). The default delimiter when opening a CSV is a comma (`,`). To read other delimited formats, pass the matching character to the `Open` overload. -**Delimiters Used in CSV files** +N> IMPORTANT: Before running the samples on this page, install the required NuGet package for your target platform and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). -* Comma (,) -* Tab (\t) -* Semicolon (;) -* Colon (:) -* Space ( ) -* Equals Sign (=) +The supported delimiters are: + +* **Comma** (`,`) — the default. +* **Tab** (`\t`) — used to open a TSV file. +* **Semicolon** (`;`) +* **Colon** (`:`) +* **Space** (` `) +* **Equals** (`=`) — used by some locales that export with leading `=` on every value; not a true separator. Use a different delimiter (for example `,` or `;`) and add a quote/unescape step in your own code. The following code example illustrates how to convert a CSV to an Excel file. @@ -52,7 +54,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx @@ -63,12 +65,14 @@ Using excelEngine As ExcelEngine = New ExcelEngine() workbook.SaveAs("Output.xlsx") End Using {% endhighlight %} -{% endtabs %} +{% endtabs %} A complete working example to convert CSV to an Excel file in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/CSV%20to%20Excel/CSV%20to%20Excel/.NET/CSV%20to%20Excel). ## TSV to Excel Conversion +**TSV (Tab-Separated Values)** files are loaded by passing the tab character (`\t` in C#, `vbTab` in VB.NET) as the delimiter to `Workbooks.Open`. The workbook is then written to `.xlsx` with `SaveAs`. + The following code example illustrates how to convert a TSV to an Excel file. {% tabs %} @@ -108,10 +112,18 @@ Using excelEngine As New ExcelEngine() ' Open the TSV file Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.tsv", vbTab) - ' Save in workbook + ' Saving the workbook workbook.SaveAs("Output.xlsx") End Using {% endhighlight %} -{% endtabs %} +{% endtabs %} -A complete working example to convert TSV to an Excel file in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/TSV%20to%20Excel/TSV%20to%20Excel/.NET/TSV%20to%20Excel). \ No newline at end of file +A complete working example to convert TSV to an Excel file in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/TSV%20to%20Excel/TSV%20to%20Excel/.NET/TSV%20to%20Excel). + +## See also + +* [Convert Excel to CSV (or TSV)](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-csv/overview) +* [Convert Excel to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/overview) +* [Convert Excel to image](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-image/overview) +* [NuGet packages for Excel (XlsIO)](https://help.syncfusion.com/document-processing/excel/getting-started/nuget-packages-required) +* [Syncfusion .NET Excel (XlsIO) — Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) \ No newline at end of file diff --git a/Document-Processing/Excel/Conversions/CSV-to-Excel/overview.md b/Document-Processing/Excel/Conversions/CSV-to-Excel/overview.md index 4aaeb2acc9..0496cc16cc 100644 --- a/Document-Processing/Excel/Conversions/CSV-to-Excel/overview.md +++ b/Document-Processing/Excel/Conversions/CSV-to-Excel/overview.md @@ -1,6 +1,6 @@ --- title: Syncfusion CSV to Excel Conversion -description: In this section, you can learn how to convert CSV docuemnt to Excel document using Syncfusion Essential XlsIO. +description: Lists how to convert a CSV (or TSV) document to an Excel workbook using the Syncfusion .NET Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -8,16 +8,18 @@ documentation: UG # CSV to Excel Conversion -XlsIO supports converting CSV data to Excel files by saving the workbook using the [SaveAs](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAs_System_IO_Stream_) method. When opening a CSV file, users can specify various delimiters to structure the data appropriately. +XlsIO can read a CSV file with [`IWorkbooks.Open`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbooks.html#Syncfusion_XlsIO_IWorkbooks_Open_System_String_System_String_) and write the result to an Excel workbook with [`IWorkbook.SaveAs`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAs_System_String_). The default delimiter when opening a CSV is a comma (`,`). To read other delimited formats, pass the matching character to the `Open` overload. -**Delimiters Used in CSV files** +N> IMPORTANT: Before running the samples on this page, install the required NuGet package for your target platform and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). -* Comma (,) -* Tab (\t) -* Semicolon (;) -* Colon (:) -* Space ( ) -* Equals Sign (=) +The supported delimiters are: + +* **Comma** (`,`) — the default. +* **Tab** (`\t`) — used to open a TSV file. +* **Semicolon** (`;`) +* **Colon** (`:`) +* **Space** (` `) +* **Equals** (`=`) — used by some locales that export with leading `=` on every value; not a true separator. Use a different delimiter (for example `,` or `;`) and add a quote/unescape step in your own code. The following code example illustrates how to convert a CSV to an Excel file. @@ -52,7 +54,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx @@ -63,12 +65,14 @@ Using excelEngine As ExcelEngine = New ExcelEngine() workbook.SaveAs("Output.xlsx") End Using {% endhighlight %} -{% endtabs %} +{% endtabs %} A complete working example to convert CSV to an Excel file in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/CSV%20to%20Excel/CSV%20to%20Excel/.NET/CSV%20to%20Excel). ## TSV to Excel Conversion +**TSV (Tab-Separated Values)** files are loaded by passing the tab character (`\t` in C#, `vbTab` in VB.NET) as the delimiter to `Workbooks.Open`. The workbook is then written to `.xlsx` with `SaveAs`. + The following code example illustrates how to convert a TSV to an Excel file. {% tabs %} @@ -108,10 +112,18 @@ Using excelEngine As New ExcelEngine() ' Open the TSV file Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.tsv", vbTab) - ' Save in workbook + ' Saving the workbook workbook.SaveAs("Output.xlsx") End Using {% endhighlight %} -{% endtabs %} +{% endtabs %} -A complete working example to convert TSV to an Excel file in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/TSV%20to%20Excel/TSV%20to%20Excel/.NET/TSV%20to%20Excel). \ No newline at end of file +A complete working example to convert TSV to an Excel file in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/TSV%20to%20Excel/TSV%20to%20Excel/.NET/TSV%20to%20Excel). + +## See also + +* [Convert Excel to CSV (or TSV)](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-csv/overview) +* [Convert Excel to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/overview) +* [Convert Excel to image](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-image/overview) +* [NuGet packages for Excel (XlsIO)](https://help.syncfusion.com/document-processing/excel/getting-started/nuget-packages-required) +* [Syncfusion .NET Excel (XlsIO) — Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) \ No newline at end of file diff --git a/Document-Processing/Excel/Conversions/Chart-to-Image/NET/Chart-to-Image-Conversion.md b/Document-Processing/Excel/Conversions/Chart-to-Image/NET/Chart-to-Image-Conversion.md index 68fe0d1951..28e5737904 100644 --- a/Document-Processing/Excel/Conversions/Chart-to-Image/NET/Chart-to-Image-Conversion.md +++ b/Document-Processing/Excel/Conversions/Chart-to-Image/NET/Chart-to-Image-Conversion.md @@ -1,25 +1,32 @@ --- title: Chart to Image Conversion | Syncfusion -description: This section explains about Chart to Image conversion supported in XlsIO. Use XlsIORenderer class ChartRenderingOptions for specify Image format & quality. +description: This section explains how to convert an Excel chart to an image in XlsIO. Use XlsIORenderer.ChartRenderingOptions to set the image format and quality. platform: document-processing control: XlsIO documentation: UG --- -# Chart to image conversion +# Chart to Image Conversion -Refer to the following links for assemblies/nuget packages required based on platforms to convert the chart to image. +XlsIO exposes two API surfaces for converting an Excel chart to an image: -* [Assemblies Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/assemblies-required#converting-excel-chart-to-image) +* **`XlsIORenderer`** — the cross-platform / .NET Standard API. Use this for ASP.NET Core, Blazor, WinUI, and .NET MAUI apps. +* **`ChartToImageConverter`** — the Windows-specific / .NET Framework API. Provides additional chart-quality settings through `ScalingMode`. + +Refer to the following links for the assemblies and NuGet packages required to convert a chart to an image, per platform: + +* [Assemblies Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/assemblies-required#converting-excel-chart-to-image) * [NuGet Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/nuget-packages-required#converting-charts-in-xlsio) -The following code snippet shows how to convert an Excel chart to an image using the [ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelChartToImageConverter.ChartToImageConverter.html) class. +N> IMPORTANT: Before running the samples on this page, install the required NuGet package for your target platform and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). + +The following code snippets show how to convert an Excel chart to an image using `XlsIORenderer` (cross-platform) or [`ChartToImageConverter`](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelChartToImageConverter.ChartToImageConverter.html) (Windows-specific). {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Chart%20to%20Image/Chart%20to%20Image/.NET/Chart%20to%20Image/Chart%20to%20Image/Program.cs,180" %} using (ExcelEngine excelEngine = new ExcelEngine()) { - //Initialize application + //Initialize application IApplication application = excelEngine.Excel; //Set the default version as Xlsx @@ -35,22 +42,22 @@ using (ExcelEngine excelEngine = new ExcelEngine()) application.XlsIORenderer.ChartRenderingOptions.ScalingMode = ScalingMode.Best; //Open existing workbook with chart - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); - IWorksheet worksheet = workbook.Worksheets[0]; - - //Access the chart from the worksheet - IChart chart = worksheet.Charts[0]; - - #region Save - //Exporting the chart as image - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Image.png"), FileMode.Create, FileAccess.Write); - chart.SaveAsImage(outputStream); - #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); + using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read)) + { + IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Access the chart from the worksheet + IChart chart = worksheet.Charts[0]; + + #region Save + //Exporting the chart as image + using (FileStream outputStream = new FileStream(Path.GetFullPath("Output/Image.png"), FileMode.Create, FileAccess.Write)) + { + chart.SaveAsImage(outputStream); + } + #endregion + } } {% endhighlight %} @@ -67,15 +74,19 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IWorksheet worksheet = workbook.Worksheets[0]; IChart chart = worksheet.Charts[0]; - //Creating the memory stream for chart image - MemoryStream stream = new MemoryStream(); - - //Saving the chart as image - chart.SaveAsImage(stream); - Image image = Image.FromStream(stream); - - //Saving image stream to file - image.Save("Output.png"); + // Create the memory stream for the chart image. + using (MemoryStream stream = new MemoryStream()) + { + chart.SaveAsImage(stream); + using (Image image = Image.FromStream(stream)) + { + // Persist the rendered chart to disk. + image.Save("Output.png"); + } + } + + // Alternatively, write directly to disk: + // chart.SaveAsImage("Output.png"); } {% endhighlight %} @@ -84,28 +95,30 @@ Using excelEngine As ExcelEngine = New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx - Dim ChartToImageConverter As chartToImageConverter = New ChartToImageConverter() - application.ChartToImageConverter = ChartToImageConverter + Dim chartConverter As New ChartToImageConverter() + application.ChartToImageConverter = chartConverter application.ChartToImageConverter.ScalingMode = ScalingMode.Best Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx") Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim chart As IChart = worksheet.Charts(0) - 'Creating the memory stream for chart image - Dim stream As New MemoryStream() - - 'Saving the chart as image - chart.SaveAsImage(stream) - Dim image As Image = Image.FromStream(stream) - - 'Saving image stream to file - image.Save("Output.png") + ' Create the memory stream for the chart image. + Using stream As New MemoryStream() + chart.SaveAsImage(stream) + Using image As Image = Image.FromStream(stream) + ' Persist the rendered chart to disk. + image.Save("Output.png") + End Using + End Using + + ' Alternatively, write directly to disk: + ' chart.SaveAsImage("Output.png") End Using {% endhighlight %} -{% endtabs %} +{% endtabs %} -A complete working example to convert Excel chart to image in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Chart%20to%20Image/Chart%20to%20Image/.NET/Chart%20to%20Image). +A complete working example to convert an Excel chart to an image in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Chart%20to%20Image/Chart%20to%20Image/.NET/Chart%20to%20Image). N> 1. Instance of [XlsIORenderer](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.XlsIORenderer.XlsIORenderer.html) class is mandatory to convert the chart to image using .NET Standard 2.0 assemblies. N> 2. In .NET Standard, the Image format and quality can be specified using the [ChartRenderingOptions](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.XlsIORenderer.XlsIORenderer.html#Syncfusion_XlsIORenderer_XlsIORenderer_ChartRenderingOptions) property of XlsIORenderer class. By default the [ImageFormat](https://help.syncfusion.com/cr/document-processing/Syncfusion.Drawing.ImageFormat.html) for chart is set to JPEG and [ScalingMode](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.ScalingMode.html) is set to Best. @@ -270,4 +283,10 @@ XlsIO supports the following chart elements in image conversion: 6. Legend 7. Trend line -N> Rendering of charts from Excel document to PDF is performed using our own chart library. As a result, there might be some preservation differences, and the output chart in PDF may not exactly match the chart in Microsoft Excel. +N> NOTE: Rendering of charts from Excel documents to images (and to PDF) uses Syncfusion's own chart rendering engine. As a result, the output may not exactly match the chart in Microsoft Excel; minor differences in spacing, colors, and font metrics may occur. + +## See also + +* [Excel to PDF conversion guide](../..//Excel-to-PDF/NET/excel-to-pdf-conversion) — chart-to-PDF rendering uses the same `ChartToImageConverter` internally. +* [Worksheet to Image conversion](../..//Excel-to-Image/NET/worksheet-to-image-conversion) — full worksheet rendering as PNG and other formats. +* [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) — register your license key. diff --git a/Document-Processing/Excel/Conversions/Chart-to-Image/overview.md b/Document-Processing/Excel/Conversions/Chart-to-Image/overview.md index 6e5312497e..e797a482dc 100644 --- a/Document-Processing/Excel/Conversions/Chart-to-Image/overview.md +++ b/Document-Processing/Excel/Conversions/Chart-to-Image/overview.md @@ -1,6 +1,6 @@ --- title: Syncfusion Chart to Image Conversion using XlsIO | Syncfusion -description: This page explains about how to convert charts from Excel documents to images using XlsIO. It allows to specify the image quality and format. +description: This page explains how to convert Excel charts to images using XlsIO. You can set the image quality and format. platform: document-processing control: XlsIO documentation: UG @@ -8,12 +8,19 @@ documentation: UG # Chart to Image Conversion in XlsIO -Refer to the following links for assemblies/nuget packages required based on platforms to convert the chart to image. +XlsIO exposes two API surfaces for converting an Excel chart to an image: -* [Assemblies Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/assemblies-required#converting-excel-chart-to-image) +* **`XlsIORenderer`** — the cross-platform / .NET Standard API. Use this for ASP.NET Core, Blazor, WinUI, and .NET MAUI apps. +* **`ChartToImageConverter`** — the Windows-specific / .NET Framework API. Provides additional chart-quality settings through `ScalingMode`. + +Refer to the following links for the assemblies and NuGet packages required to convert a chart to an image, per platform: + +* [Assemblies Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/assemblies-required#converting-excel-chart-to-image) * [NuGet Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/nuget-packages-required#converting-charts-in-xlsio) -The following code snippet shows how to convert an Excel chart to an image using the [ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelChartToImageConverter.ChartToImageConverter.html) class. +N> IMPORTANT: Before running the samples on this page, install the required NuGet package for your target platform and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). + +The following code snippets show how to convert an Excel chart to an image using `XlsIORenderer` (cross-platform) or [`ChartToImageConverter`](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelChartToImageConverter.ChartToImageConverter.html) (Windows-specific). {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Chart%20to%20Image/Chart%20to%20Image/.NET/Chart%20to%20Image/Chart%20to%20Image/Program.cs,180" %} @@ -22,25 +29,19 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - // Initialize XlsIORenderer + // Initialize XlsIORenderer and set the chart image format to PNG. application.XlsIORenderer = new XlsIORenderer(); - - //Set converter chart image format to PNG application.XlsIORenderer.ChartRenderingOptions.ImageFormat = ExportImageFormat.Png; IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); IWorksheet worksheet = workbook.Worksheets[0]; - IChart chart = worksheet.Charts[0]; - #region Save - //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Image.png"), FileMode.Create, FileAccess.Write); - chart.SaveAsImage(outputStream); - #endregion - - //Dispose streams - outputStream.Dispose(); + // Save the chart as a PNG image. + using (FileStream outputStream = new FileStream(Path.GetFullPath("Output/Image.png"), FileMode.Create, FileAccess.Write)) + { + chart.SaveAsImage(outputStream); + } } {% endhighlight %} @@ -57,15 +58,19 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IWorksheet worksheet = workbook.Worksheets[0]; IChart chart = worksheet.Charts[0]; - //Creating the memory stream for chart image - MemoryStream stream = new MemoryStream(); + // Create the memory stream for the chart image. + using (MemoryStream stream = new MemoryStream()) + { + chart.SaveAsImage(stream); + using (Image image = Image.FromStream(stream)) + { + // Persist the rendered chart to disk. + image.Save("Output.png"); + } + } - //Saving the chart as image - chart.SaveAsImage(stream); - Image image = Image.FromStream(stream); - - //Saving image stream to file - image.Save("Output.png"); + // Alternatively, write directly to disk: + // chart.SaveAsImage("Output.png"); } {% endhighlight %} @@ -74,28 +79,30 @@ Using excelEngine As ExcelEngine = New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx - Dim ChartToImageConverter As chartToImageConverter = New ChartToImageConverter() - application.ChartToImageConverter = ChartToImageConverter + Dim chartConverter As New ChartToImageConverter() + application.ChartToImageConverter = chartConverter application.ChartToImageConverter.ScalingMode = ScalingMode.Best Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx") Dim worksheet As IWorksheet = workbook.Worksheets(0) Dim chart As IChart = worksheet.Charts(0) - 'Creating the memory stream for chart image - Dim stream As New MemoryStream() - - 'Saving the chart as image - chart.SaveAsImage(stream) - Dim image As Image = Image.FromStream(stream) + ' Create the memory stream for the chart image. + Using stream As New MemoryStream() + chart.SaveAsImage(stream) + Using image As Image = Image.FromStream(stream) + ' Persist the rendered chart to disk. + image.Save("Output.png") + End Using + End Using - 'Saving image stream to file - image.Save("Output.png") + ' Alternatively, write directly to disk: + ' chart.SaveAsImage("Output.png") End Using {% endhighlight %} -{% endtabs %} +{% endtabs %} -A complete working example to convert Excel chart to image in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Chart%20to%20Image/Chart%20to%20Image/.NET/Chart%20to%20Image). +A complete working example to convert an Excel chart to an image in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Chart%20to%20Image/Chart%20to%20Image/.NET/Chart%20to%20Image). N> 1. Instance of [XlsIORenderer](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.XlsIORenderer.XlsIORenderer.html) class is mandatory to convert the chart to image using .NET Standard 2.0 assemblies. N> 2. In .NET Standard, the Image format and quality can be specified using the [ChartRenderingOptions](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.XlsIORenderer.XlsIORenderer.html#Syncfusion_XlsIORenderer_XlsIORenderer_ChartRenderingOptions) property of XlsIORenderer class. By default the [ImageFormat](https://help.syncfusion.com/cr/document-processing/Syncfusion.Drawing.ImageFormat.html) for chart is set to JPEG and [ScalingMode](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.ScalingMode.html) is set to Best. diff --git a/Document-Processing/Excel/Conversions/Excel-to-CSV/NET/Excel-to-CSV-Conversion.md b/Document-Processing/Excel/Conversions/Excel-to-CSV/NET/Excel-to-CSV-Conversion.md index 4355e1e599..36e0266ea3 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-CSV/NET/Excel-to-CSV-Conversion.md +++ b/Document-Processing/Excel/Conversions/Excel-to-CSV/NET/Excel-to-CSV-Conversion.md @@ -1,6 +1,6 @@ --- title: Syncfusion Excel to CSV Conversion -description: In this section, you can learn how to convert Excel docuemnt to CSV document using Syncfusion Essential XlsIO. +description: Lists how to convert an Excel workbook to a CSV (or TSV) document using the Syncfusion .NET Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -8,16 +8,18 @@ documentation: UG # Excel to CSV Conversion -XlsIO supports converting Excel file to CSV file by saving the workbook using the [SaveAs](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorksheet.html#Syncfusion_XlsIO_IWorksheet_SaveAs_System_IO_Stream_System_String_) method. When saving as CSV, users can specify various delimiters to structure the data appropriately. By default, Syncfusion® XlsIO uses a comma (,) as the delimiter. +XlsIO can convert an Excel workbook to a CSV file by saving the workbook with the [`SaveAs`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAs_System_String_System_String_) overload that accepts a delimiter string. The default delimiter is a comma (`,`). -**Delimiters Used in CSV files** +N> IMPORTANT: Before running the samples on this page, install the required NuGet package for your target platform and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). -* Comma (,) -* Tab (\t) -* Semicolon (;) -* Colon (:) -* Space ( ) -* Equals Sign (=) +The supported delimiters are: + +* **Comma** (`,`) — the default. +* **Tab** (`\t`) — produces a TSV file. +* **Semicolon** (`;`) +* **Colon** (`:`) +* **Space** (` `) +* **Equals** (`=`) — prefixes cells that begin with `=`, `+`, `-`, or `@` with a single quote so they are not interpreted as formulas when opened in a spreadsheet program. This is the recommended setting when exporting to a CSV that may be re-imported. The following code example illustrates how to convert an Excel file to CSV. @@ -53,19 +55,19 @@ Using excelEngine As New ExcelEngine() Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xlsx") ' Saving the workbook - worksheet.SaveAs("Output.csv", ",") + workbook.SaveAs("Output.csv", ",") End Using {% endhighlight %} -{% endtabs %} +{% endtabs %} A complete working example to convert an Excel file to CSV in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20CSV/Excel%20to%20CSV/.NET/Excel%20to%20CSV). -**Maximum Rows and Columns for CSV** +## Maximum Rows and Columns for CSV -By default, XlsIO allows only 1048576 rows and 16256 columns while loading or saving a CSV document. This limit can be increased by modifying the [MaximumRowsForCsv](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_MaximumRowsForCsv) and [MaximumColumnsForCsv](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_MaximumColumnsForCsv) properties. +By default, XlsIO allows up to **1,048,576 rows and 16,256 columns** when loading or saving a CSV document. Exceeding these limits throws `ArgumentOutOfRangeException`. Increase them by setting [`MaximumRowsForCsv`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_MaximumRowsForCsv) and [`MaximumColumnsForCsv`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_MaximumColumnsForCsv) on `IApplication`. The properties affect loading as well as saving, so they apply whether the input is an `.xlsx` file or another `.csv`. -The following code example illustrates how to set the maximum rows and columns for saving as CSV files. +The following code example illustrates how to override the load/ save limits and convert a workbook to CSV. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} @@ -83,8 +85,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) sheet.Range[2000000, 1].Text = "Syncfusion"; sheet.Range[20, 18000].Text = "Syncfusion"; - //Saving the workbook - workbook.SaveAs("Output.csv",","); + // Saving the workbook + workbook.SaveAs("Output.csv", ","); } {% endhighlight %} @@ -103,13 +105,13 @@ using (ExcelEngine excelEngine = new ExcelEngine()) sheet.Range[2000000, 1].Text = "Syncfusion"; sheet.Range[20, 18000].Text = "Syncfusion"; - //Saving the workbook + // Saving the workbook workbook.SaveAs("Output.csv", ","); } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx @@ -122,7 +124,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() sheet.Range(2000000, 1).Text = "Syncfusion" sheet.Range(20, 18000).Text = "Syncfusion" - //Saving the workbook + ' Saving the workbook workbook.SaveAs("Output.csv", ",") End Using {% endhighlight %} @@ -130,7 +132,7 @@ End Using ## Excel to TSV Conversion -TSV (Tab-Separated Values) files can be created by saving a workbook with the tab separator (\t). +**TSV (Tab-Separated Values)** files can be created by saving a workbook with the tab character (`\t` in C#, `vbTab` in VB.NET) as the delimiter. The following code example illustrates how to convert an Excel file to TSV. @@ -173,3 +175,11 @@ End Using {% endtabs %} A complete working example to convert an Excel file to TSV in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20TSV/Excel%20to%20TSV/.NET/Excel%20to%20TSV). + +## See also + +* [Save a workbook in CSV, TSV, or other delimited formats](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-csv/overview) +* [Convert Excel to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/overview) +* [Convert Excel to image](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-image/overview) +* [NuGet packages for Excel (XlsIO)](https://help.syncfusion.com/document-processing/excel/getting-started/nuget-packages-required) +* [Syncfusion .NET Excel (XlsIO) — Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) diff --git a/Document-Processing/Excel/Conversions/Excel-to-CSV/overview.md b/Document-Processing/Excel/Conversions/Excel-to-CSV/overview.md index 4355e1e599..36e0266ea3 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-CSV/overview.md +++ b/Document-Processing/Excel/Conversions/Excel-to-CSV/overview.md @@ -1,6 +1,6 @@ --- title: Syncfusion Excel to CSV Conversion -description: In this section, you can learn how to convert Excel docuemnt to CSV document using Syncfusion Essential XlsIO. +description: Lists how to convert an Excel workbook to a CSV (or TSV) document using the Syncfusion .NET Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -8,16 +8,18 @@ documentation: UG # Excel to CSV Conversion -XlsIO supports converting Excel file to CSV file by saving the workbook using the [SaveAs](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorksheet.html#Syncfusion_XlsIO_IWorksheet_SaveAs_System_IO_Stream_System_String_) method. When saving as CSV, users can specify various delimiters to structure the data appropriately. By default, Syncfusion® XlsIO uses a comma (,) as the delimiter. +XlsIO can convert an Excel workbook to a CSV file by saving the workbook with the [`SaveAs`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAs_System_String_System_String_) overload that accepts a delimiter string. The default delimiter is a comma (`,`). -**Delimiters Used in CSV files** +N> IMPORTANT: Before running the samples on this page, install the required NuGet package for your target platform and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). -* Comma (,) -* Tab (\t) -* Semicolon (;) -* Colon (:) -* Space ( ) -* Equals Sign (=) +The supported delimiters are: + +* **Comma** (`,`) — the default. +* **Tab** (`\t`) — produces a TSV file. +* **Semicolon** (`;`) +* **Colon** (`:`) +* **Space** (` `) +* **Equals** (`=`) — prefixes cells that begin with `=`, `+`, `-`, or `@` with a single quote so they are not interpreted as formulas when opened in a spreadsheet program. This is the recommended setting when exporting to a CSV that may be re-imported. The following code example illustrates how to convert an Excel file to CSV. @@ -53,19 +55,19 @@ Using excelEngine As New ExcelEngine() Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xlsx") ' Saving the workbook - worksheet.SaveAs("Output.csv", ",") + workbook.SaveAs("Output.csv", ",") End Using {% endhighlight %} -{% endtabs %} +{% endtabs %} A complete working example to convert an Excel file to CSV in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20CSV/Excel%20to%20CSV/.NET/Excel%20to%20CSV). -**Maximum Rows and Columns for CSV** +## Maximum Rows and Columns for CSV -By default, XlsIO allows only 1048576 rows and 16256 columns while loading or saving a CSV document. This limit can be increased by modifying the [MaximumRowsForCsv](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_MaximumRowsForCsv) and [MaximumColumnsForCsv](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_MaximumColumnsForCsv) properties. +By default, XlsIO allows up to **1,048,576 rows and 16,256 columns** when loading or saving a CSV document. Exceeding these limits throws `ArgumentOutOfRangeException`. Increase them by setting [`MaximumRowsForCsv`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_MaximumRowsForCsv) and [`MaximumColumnsForCsv`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_MaximumColumnsForCsv) on `IApplication`. The properties affect loading as well as saving, so they apply whether the input is an `.xlsx` file or another `.csv`. -The following code example illustrates how to set the maximum rows and columns for saving as CSV files. +The following code example illustrates how to override the load/ save limits and convert a workbook to CSV. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} @@ -83,8 +85,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) sheet.Range[2000000, 1].Text = "Syncfusion"; sheet.Range[20, 18000].Text = "Syncfusion"; - //Saving the workbook - workbook.SaveAs("Output.csv",","); + // Saving the workbook + workbook.SaveAs("Output.csv", ","); } {% endhighlight %} @@ -103,13 +105,13 @@ using (ExcelEngine excelEngine = new ExcelEngine()) sheet.Range[2000000, 1].Text = "Syncfusion"; sheet.Range[20, 18000].Text = "Syncfusion"; - //Saving the workbook + // Saving the workbook workbook.SaveAs("Output.csv", ","); } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx @@ -122,7 +124,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() sheet.Range(2000000, 1).Text = "Syncfusion" sheet.Range(20, 18000).Text = "Syncfusion" - //Saving the workbook + ' Saving the workbook workbook.SaveAs("Output.csv", ",") End Using {% endhighlight %} @@ -130,7 +132,7 @@ End Using ## Excel to TSV Conversion -TSV (Tab-Separated Values) files can be created by saving a workbook with the tab separator (\t). +**TSV (Tab-Separated Values)** files can be created by saving a workbook with the tab character (`\t` in C#, `vbTab` in VB.NET) as the delimiter. The following code example illustrates how to convert an Excel file to TSV. @@ -173,3 +175,11 @@ End Using {% endtabs %} A complete working example to convert an Excel file to TSV in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20TSV/Excel%20to%20TSV/.NET/Excel%20to%20TSV). + +## See also + +* [Save a workbook in CSV, TSV, or other delimited formats](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-csv/overview) +* [Convert Excel to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/overview) +* [Convert Excel to image](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-image/overview) +* [NuGet packages for Excel (XlsIO)](https://help.syncfusion.com/document-processing/excel/getting-started/nuget-packages-required) +* [Syncfusion .NET Excel (XlsIO) — Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) diff --git a/Document-Processing/Excel/Conversions/Excel-to-HTML/NET/Excel-to-HTML-Conversion.md b/Document-Processing/Excel/Conversions/Excel-to-HTML/NET/Excel-to-HTML-Conversion.md index 4d65e08c3f..ad3938f06d 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-HTML/NET/Excel-to-HTML-Conversion.md +++ b/Document-Processing/Excel/Conversions/Excel-to-HTML/NET/Excel-to-HTML-Conversion.md @@ -1,6 +1,6 @@ --- title: Syncfusion Excel to HTML Conversion -description: In this section, you can learn how to convert Excel docuemnt to HTML document using Syncfusion Essential XlsIO. +description: Lists how to convert an Excel workbook or worksheet to HTML using the Syncfusion .NET Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -8,7 +8,7 @@ documentation: UG # Excel to HTML Conversion -XlsIO provides support to convert a worksheet or entire workbook to HTML with basic formatting preserved. The supporting formats in this conversion are: +XlsIO converts a worksheet or an entire workbook to HTML while preserving basic formatting. The features preserved during conversion are: * Styles * Hyperlinks @@ -21,22 +21,16 @@ The following code example illustrates how to convert an Excel file to HTML. {% highlight c# tabtitle="C# [Cross-platform]" %} using (ExcelEngine excelEngine = new ExcelEngine()) { - //Initialize excel engine and open workbook + // Initialize Excel engine and create a new workbook IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; IWorkbook workbook = application.Workbooks.Create(1); IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["A1:M20"].Text = "Html Document"; - //Create stream to store HTML file. - Stream stream = new MemoryStream(); - - //Save an Excel sheet as HTML file - worksheet.SaveAsHtml(stream); - - //Save a workbook as HTML file + // Save a workbook as HTML file workbook.SaveAsHtml("Sample.html", Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default); - stream.Dispose(); + workbook.Close(); } {% endhighlight %} @@ -50,32 +44,26 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IWorksheet sheet = workbook.Worksheets[0]; sheet.Range["A1:M20"].Text = "Html Document"; - //Save an Excel sheet as HTML file - sheet.SaveAsHtml("Sample.html"); - - //Save the workbook as HTML file + // Save a workbook as HTML file workbook.SaveAsHtml("Sample.html", Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default); } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx Dim workbook As IWorkbook = application.Workbooks.Create(1) Dim sheet As IWorksheet = workbook.Worksheets(0) sheet.Range("A1:M20").Text = "Html Document" - 'Save an Excel sheet as HTML file - sheet.SaveAsHtml("Sample.html") - - 'Save a workbook as HTML file + ' Save a workbook as HTML file workbook.SaveAsHtml("Sample.html", Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default) End Using {% endhighlight %} {% endtabs %} -## Save Options +## HtmlSaveOptions XlsIO also provides options to save a worksheet with the displayed text or value in the cell to HTML file. The following code example illustrates this. @@ -83,22 +71,20 @@ XlsIO also provides options to save a worksheet with the displayed text or value {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20HTML/Excel%20to%20HTML/.NET/Excel%20to%20HTML/Excel%20to%20HTML/Program.cs,180" %} using (ExcelEngine excelEngine = new ExcelEngine()) { - //Initialize excel engine and open workbook + // Initialize Excel engine and create a new workbook IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; IWorkbook workbook = application.Workbooks.Create(1); IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["A1:M20"].Text = "Html Document"; + worksheet.UsedRange.AutofitColumns(); - //Create the instant for SaveOptions + // Create the instance of SaveOptions HtmlSaveOptions saveOptions = new HtmlSaveOptions(); saveOptions.TextMode = HtmlSaveOptions.GetText.DisplayText; - worksheet.UsedRange.AutofitColumns(); - #region Save as HTML - //Saving the workbook + // Save the workbook as HTML workbook.SaveAsHtml(Path.GetFullPath("Output/Output.html"), saveOptions); - #endregion } {% endhighlight %} @@ -110,37 +96,42 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IWorkbook workbook = application.Workbooks.Create(1); IWorksheet sheet = workbook.Worksheets[0]; - //Create the instant for SaveOptions + // Create the instance of SaveOptions HtmlSaveOptions options = new HtmlSaveOptions(); options.TextMode = HtmlSaveOptions.GetText.DisplayText; options.ImagePath = "../../Images/"; - //Save the sheet as HTML + // Save the sheet as HTML sheet.SaveAsHtml("Sample.html", options); - - workbook.SaveAs("Output.xlsx"); } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx Dim workbook As IWorkbook = application.Workbooks.Create(1) Dim sheet As IWorksheet = workbook.Worksheets(0) - 'Create the instant for SaveOptions + ' Create the instance of SaveOptions Dim options As New HtmlSaveOptions() options.TextMode = HtmlSaveOptions.GetText.DisplayText options.ImagePath = "../../Images/" - 'Save the sheet as HTML + ' Save the sheet as HTML sheet.SaveAsHtml("Sample.html", options) - - workbook.SaveAs("Output.xlsx") End Using {% endhighlight %} {% endtabs %} A complete working example to save an Excel worksheet as HTML file using [HtmlSaveOptions](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.Implementation.HtmlSaveOptions.html) in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20HTML/Excel%20to%20HTML/.NET/Excel%20to%20HTML). +## See also + +* [Convert Excel to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/overview) +* [Convert Excel to image](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-image/overview) +* [Convert Excel to CSV (or TSV)](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-csv/overview) +* [Convert a chart to an image](https://help.syncfusion.com/document-processing/excel/conversions/chart-to-image/overview) +* [NuGet packages for Excel (XlsIO)](https://help.syncfusion.com/document-processing/excel/getting-started/nuget-packages-required) +* [Syncfusion .NET Excel (XlsIO) — Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) + diff --git a/Document-Processing/Excel/Conversions/Excel-to-HTML/overview.md b/Document-Processing/Excel/Conversions/Excel-to-HTML/overview.md index 4d65e08c3f..ad3938f06d 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-HTML/overview.md +++ b/Document-Processing/Excel/Conversions/Excel-to-HTML/overview.md @@ -1,6 +1,6 @@ --- title: Syncfusion Excel to HTML Conversion -description: In this section, you can learn how to convert Excel docuemnt to HTML document using Syncfusion Essential XlsIO. +description: Lists how to convert an Excel workbook or worksheet to HTML using the Syncfusion .NET Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -8,7 +8,7 @@ documentation: UG # Excel to HTML Conversion -XlsIO provides support to convert a worksheet or entire workbook to HTML with basic formatting preserved. The supporting formats in this conversion are: +XlsIO converts a worksheet or an entire workbook to HTML while preserving basic formatting. The features preserved during conversion are: * Styles * Hyperlinks @@ -21,22 +21,16 @@ The following code example illustrates how to convert an Excel file to HTML. {% highlight c# tabtitle="C# [Cross-platform]" %} using (ExcelEngine excelEngine = new ExcelEngine()) { - //Initialize excel engine and open workbook + // Initialize Excel engine and create a new workbook IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; IWorkbook workbook = application.Workbooks.Create(1); IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["A1:M20"].Text = "Html Document"; - //Create stream to store HTML file. - Stream stream = new MemoryStream(); - - //Save an Excel sheet as HTML file - worksheet.SaveAsHtml(stream); - - //Save a workbook as HTML file + // Save a workbook as HTML file workbook.SaveAsHtml("Sample.html", Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default); - stream.Dispose(); + workbook.Close(); } {% endhighlight %} @@ -50,32 +44,26 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IWorksheet sheet = workbook.Worksheets[0]; sheet.Range["A1:M20"].Text = "Html Document"; - //Save an Excel sheet as HTML file - sheet.SaveAsHtml("Sample.html"); - - //Save the workbook as HTML file + // Save a workbook as HTML file workbook.SaveAsHtml("Sample.html", Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default); } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx Dim workbook As IWorkbook = application.Workbooks.Create(1) Dim sheet As IWorksheet = workbook.Worksheets(0) sheet.Range("A1:M20").Text = "Html Document" - 'Save an Excel sheet as HTML file - sheet.SaveAsHtml("Sample.html") - - 'Save a workbook as HTML file + ' Save a workbook as HTML file workbook.SaveAsHtml("Sample.html", Syncfusion.XlsIO.Implementation.HtmlSaveOptions.Default) End Using {% endhighlight %} {% endtabs %} -## Save Options +## HtmlSaveOptions XlsIO also provides options to save a worksheet with the displayed text or value in the cell to HTML file. The following code example illustrates this. @@ -83,22 +71,20 @@ XlsIO also provides options to save a worksheet with the displayed text or value {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20HTML/Excel%20to%20HTML/.NET/Excel%20to%20HTML/Excel%20to%20HTML/Program.cs,180" %} using (ExcelEngine excelEngine = new ExcelEngine()) { - //Initialize excel engine and open workbook + // Initialize Excel engine and create a new workbook IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; IWorkbook workbook = application.Workbooks.Create(1); IWorksheet worksheet = workbook.Worksheets[0]; worksheet.Range["A1:M20"].Text = "Html Document"; + worksheet.UsedRange.AutofitColumns(); - //Create the instant for SaveOptions + // Create the instance of SaveOptions HtmlSaveOptions saveOptions = new HtmlSaveOptions(); saveOptions.TextMode = HtmlSaveOptions.GetText.DisplayText; - worksheet.UsedRange.AutofitColumns(); - #region Save as HTML - //Saving the workbook + // Save the workbook as HTML workbook.SaveAsHtml(Path.GetFullPath("Output/Output.html"), saveOptions); - #endregion } {% endhighlight %} @@ -110,37 +96,42 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IWorkbook workbook = application.Workbooks.Create(1); IWorksheet sheet = workbook.Worksheets[0]; - //Create the instant for SaveOptions + // Create the instance of SaveOptions HtmlSaveOptions options = new HtmlSaveOptions(); options.TextMode = HtmlSaveOptions.GetText.DisplayText; options.ImagePath = "../../Images/"; - //Save the sheet as HTML + // Save the sheet as HTML sheet.SaveAsHtml("Sample.html", options); - - workbook.SaveAs("Output.xlsx"); } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx Dim workbook As IWorkbook = application.Workbooks.Create(1) Dim sheet As IWorksheet = workbook.Worksheets(0) - 'Create the instant for SaveOptions + ' Create the instance of SaveOptions Dim options As New HtmlSaveOptions() options.TextMode = HtmlSaveOptions.GetText.DisplayText options.ImagePath = "../../Images/" - 'Save the sheet as HTML + ' Save the sheet as HTML sheet.SaveAsHtml("Sample.html", options) - - workbook.SaveAs("Output.xlsx") End Using {% endhighlight %} {% endtabs %} A complete working example to save an Excel worksheet as HTML file using [HtmlSaveOptions](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.Implementation.HtmlSaveOptions.html) in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20HTML/Excel%20to%20HTML/.NET/Excel%20to%20HTML). +## See also + +* [Convert Excel to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/overview) +* [Convert Excel to image](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-image/overview) +* [Convert Excel to CSV (or TSV)](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-csv/overview) +* [Convert a chart to an image](https://help.syncfusion.com/document-processing/excel/conversions/chart-to-image/overview) +* [NuGet packages for Excel (XlsIO)](https://help.syncfusion.com/document-processing/excel/getting-started/nuget-packages-required) +* [Syncfusion .NET Excel (XlsIO) — Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) + diff --git a/Document-Processing/Excel/Conversions/Excel-to-Image/NET/Worksheet-to-Image-Conversion.md b/Document-Processing/Excel/Conversions/Excel-to-Image/NET/Worksheet-to-Image-Conversion.md index 2dd85cdd46..b9332bf8e9 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-Image/NET/Worksheet-to-Image-Conversion.md +++ b/Document-Processing/Excel/Conversions/Excel-to-Image/NET/Worksheet-to-Image-Conversion.md @@ -1,44 +1,51 @@ --- -title: Worksheet to Image conversion in Excel Library | Syncfusion -description: Learn here all about worksheet to image conversion feature of Syncfusion Excel (XlsIO) Library and more. +title: Worksheet to Image Conversion in Excel Library | Syncfusion +description: Learn how to convert an Excel worksheet to an image using the Syncfusion Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG --- -# Worksheet to Image conversion in Excel Library +# Worksheet to Image Conversion in Excel Library ## Assemblies Required -Refer to the following links for assemblies/nuget packages required based on platforms to convert the worksheet to image. +Refer to the following links for the assemblies and NuGet packages required to convert a worksheet to an image, per platform: * [NuGet Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/nuget-packages-required#converting-excel-worksheet-to-image) -N> Worksheet To Image conversion can be performed by referring [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) NuGet package in UWP platform. +N> Worksheet-to-image conversion can be performed by referring to the [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) NuGet package in UWP platform. ## Convert as bitmap -The following code shows how to convert the specified range of rows and columns in the worksheet to bitmap. +The following code shows how to convert a specified range of rows and columns in the worksheet to a bitmap image. The four integer parameters are `firstRow`, `firstColumn`, `lastRow`, and `lastColumn` (1-based). {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} +// The following snippet assumes `application` and `worksheet` are already initialized +// (see the "Complete code" tab below for the full setup). // Initialize XlsIORenderer application.XlsIORenderer = new XlsIORenderer(); -//Create a new memory stream to save the image -Stream stream = new MemoryStream(); - -//Convert worksheet to image and save it to stream. -worksheet.ConvertToImage(1, 1, 10, 20, stream); +// Create a new memory stream to save the image +using (Stream stream = new MemoryStream()) +{ + // Convert worksheet to image and save it to the stream. + worksheet.ConvertToImage(1, 1, 10, 20, stream); +} {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} +// The following snippet assumes `sheet` is already initialized (see the +// "Complete code" tab below for the full setup). // Convert as bitmap Image image = sheet.ConvertToImage(1, 1, 10, 20); image.Save("Sample.png", ImageFormat.Png); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +'The following snippet assumes `sheet` is already initialized (see the +'"Complete code" tab below for the full setup). 'Convert as bitmap Dim image As Image = sheet.ConvertToImage(1, 1, 10, 20) image.Save("Sample.png", ImageFormat.Png) @@ -47,28 +54,35 @@ image.Save("Sample.png", ImageFormat.Png) ## Save as stream -The following code snippet shows how to save a sheet as stream. +The following code snippet shows how to save a sheet as a stream. On Windows, you can choose the output [ImageType](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.ImageType.html) (such as `Bitmap`, `Metafile`, or `EMF`); on .NET Standard the format is controlled by `ExportImageOptions` (see the [Customizing the output image](#customizing-the-output-image-exportimageoptions) section below). After `ConvertToImage(...)` writes to a stream, the stream's position is at the end; set `stream.Position = 0` if you need to read from it afterwards. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Worksheet%20to%20Image/Worksheet%20to%20Image/.NET/Worksheet%20to%20Image/Worksheet%20to%20Image/Program.cs,180" %} +// The following snippet assumes `application` and `sheet` are already initialized +// (see the "Complete code" tab below for the full setup). // Initialize XlsIORenderer application.XlsIORenderer = new XlsIORenderer(); -// Converts and save as stream -MemoryStream stream = new MemoryStream(); -sheet.ConvertToImage(1, 1, 10, 20, stream); +// Convert and save as a stream (default image format on cross-platform is PNG). +using (MemoryStream stream = new MemoryStream()) +{ + sheet.ConvertToImage(1, 1, 10, 20, stream); +} {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -// Converts and save as stream -MemoryStream stream = new MemoryStream(); -sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream); +// Convert and save as a stream with a specific ImageType +using (MemoryStream stream = new MemoryStream()) +{ + sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream); +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Converts and save as stream -Dim stream As MemoryStream = New MemoryStream() -sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream) +'Convert and save as a stream with a specific ImageType +Using stream As MemoryStream = New MemoryStream() + sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream) +End Using {% endhighlight %} {% endtabs %} @@ -80,22 +94,24 @@ using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); - IWorksheet sheet = workbook.Worksheets[0]; - - //Initialize XlsIORenderer - application.XlsIORenderer = new XlsIORenderer(); - - #region Save - //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Image.png"), FileMode.Create, FileAccess.Write); - sheet.ConvertToImage(sheet.UsedRange, outputStream); - #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); + + // Open the input workbook. + using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read)) + { + IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorksheet sheet = workbook.Worksheets[0]; + + //Initialize XlsIORenderer + application.XlsIORenderer = new XlsIORenderer(); + + #region Save + // Save the used range of the worksheet as a PNG image. + using (FileStream outputStream = new FileStream(Path.GetFullPath("Output/Image.png"), FileMode.Create, FileAccess.Write)) + { + sheet.ConvertToImage(sheet.UsedRange, outputStream); + } + #endregion + } } {% endhighlight %} @@ -107,20 +123,15 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); IWorksheet sheet = workbook.Worksheets[0]; - //Convert as bitmap + // Convert the worksheet range to a bitmap image and save it as PNG. Image image = sheet.ConvertToImage(1, 1, 10, 20); - image.Save("Sample.png", ImageFormat.Png); - //Converts and save as stream - MemoryStream stream = new MemoryStream(); - sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream); - - //Save the workbook to disk - workbook.SaveAs("Sample.xlsx"); - - //No exception will be thrown if there are unsaved workbooks - excelEngine.ThrowNotSavedOnDestroy = false; + // Convert the worksheet range to a Metafile image and save it to a stream. + using (MemoryStream stream = new MemoryStream()) + { + sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream); + } } {% endhighlight %} @@ -128,28 +139,22 @@ using (ExcelEngine excelEngine = new ExcelEngine()) Using excelEngine As ExcelEngine = New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx - Dim workbook As IWorkbook = application.Workbooks.Open("sample.xlsx", ExcelOpenType.Automatic) - Dim worksheet As IWorksheet = workbook.Worksheets(0) - - 'Convert as bitmap - Dim image As Image = worksheet.ConvertToImage(1, 1, 10, 20) + Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic) + Dim sheet As IWorksheet = workbook.Worksheets(0) + ' Convert the worksheet range to a bitmap image and save it as PNG. + Dim image As Image = sheet.ConvertToImage(1, 1, 10, 20) image.Save("Sample.png", ImageFormat.Png) - 'Converts and save as stream - Dim stream As MemoryStream = New MemoryStream() - worksheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream) - - 'Save the workbook to disk - workbook.SaveAs("Sample.xlsx") - - 'No exception will be thrown if there are unsaved workbooks. - excelEngine.ThrowNotSavedOnDestroy = False + ' Convert the worksheet range to a Metafile image and save it to a stream. + Using stream As MemoryStream = New MemoryStream() + sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream) + End Using End Using {% endhighlight %} -{% endtabs %} +{% endtabs %} -A complete working example to convert Excel worksheet to image in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Worksheet%20to%20Image/Worksheet%20to%20Image). +A complete working example to convert an Excel worksheet to an image in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Worksheet%20to%20Image/Worksheet%20to%20Image). N> 1. Instance of [XlsIORenderer](https://help.syncfusion.com/cr/aspnetcore-js2/Syncfusion.XlsIORenderer.XlsIORenderer.html) class is mandatory to convert the worksheet to image using .NET Standard assemblies. N> 2. In .NET Standard, the Image format and quality can be specified using the **ExportImageOptions** class. By default the [ImageFormat](https://help.syncfusion.com/cr/document-processing/Syncfusion.Drawing.ImageFormat.html) is set to PNG and [ScalingMode](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.ScalingMode.html) is set to Best. @@ -160,3 +165,9 @@ N> 3. Worksheet to image conversion is supported from .NET Framework 2.0 and .NE * Subscript/Superscript * Shrink to fit * Complex conditional formatting + +## See also + +* [Assemblies Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/assemblies-required#converting-excel-worksheet-to-image) — manual assembly references. +* [NuGet Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/nuget-packages-required#converting-excel-worksheet-to-image) — install the right package for your target platform. +* [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) — register your license key. diff --git a/Document-Processing/Excel/Conversions/Excel-to-Image/overview.md b/Document-Processing/Excel/Conversions/Excel-to-Image/overview.md index 5017693f16..b2dcd216e2 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-Image/overview.md +++ b/Document-Processing/Excel/Conversions/Excel-to-Image/overview.md @@ -6,43 +6,50 @@ control: XlsIO documentation: UG --- -# Worksheet to Image conversion in Excel Library +# Worksheet to Image Conversion in Excel Library -To quickly start converting an Excel document to a Image, please check out this video: -{% youtube "https://www.youtube.com/watch?v=WgugutAaxBk&t=3s" %} +To quickly start converting an Excel document to an image, see this short video: [Convert an Excel worksheet to an image with XlsIO](https://www.youtube.com/watch?v=WgugutAaxBk&t=3s). + +N> IMPORTANT: Before running the samples on this page, install the required NuGet package for your target platform and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). ## Assemblies Required -Refer to the following links for assemblies/nuget packages required based on platforms to convert the worksheet to image. +The following links list the assemblies and NuGet packages required to convert a worksheet to an image, per platform: -* [Assemblies Information](https://help.syncfusion.com/file-formats/xlsio/assemblies-required#converting-excel-worksheet-to-image) +* [Assemblies Information](https://help.syncfusion.com/file-formats/xlsio/assemblies-required#converting-excel-worksheet-to-image) * [NuGet Information](https://help.syncfusion.com/file-formats/xlsio/nuget-packages-required#converting-excel-worksheet-to-image) -N> Worksheet To Image conversion can be performed by referring [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) NuGet package in UWP platform. +N> Worksheet-to-image conversion can be performed by referring to the [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) NuGet package in UWP platform. ## Convert as bitmap -The following code shows how to convert the specified range of rows and columns in the worksheet to bitmap. +The following code shows how to convert a specified range of rows and columns in the worksheet to a bitmap image. The four integer parameters are `firstRow`, `firstColumn`, `lastRow`, and `lastColumn` (1-based). {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} +// The following snippet assumes `application` and `worksheet` are already initialized +// (see the "Complete code" tab below for the full setup). // Initialize XlsIORenderer application.XlsIORenderer = new XlsIORenderer(); -//Create a new memory stream to save the image +// Create a new memory stream to save the image Stream stream = new MemoryStream(); -//Convert worksheet to image and save it to stream. +// Convert worksheet to image and save it to the stream. worksheet.ConvertToImage(1, 1, 10, 20, stream); {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} +// The following snippet assumes `sheet` is already initialized (see the +// "Complete code" tab below for the full setup). // Convert as bitmap Image image = sheet.ConvertToImage(1, 1, 10, 20); image.Save("Sample.png", ImageFormat.Png); {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +'The following snippet assumes `sheet` is already initialized (see the +'"Complete code" tab below for the full setup). 'Convert as bitmap Dim image As Image = sheet.ConvertToImage(1, 1, 10, 20) image.Save("Sample.png", ImageFormat.Png) @@ -51,28 +58,36 @@ image.Save("Sample.png", ImageFormat.Png) ## Save as stream -The following code snippet shows how to save a sheet as stream. +The following code snippet shows how to save a sheet as a stream. On Windows, you can choose the output [ImageType](https://help.syncfusion.com/cr/file-formats/Syncfusion.XlsIO.ImageType.html) (such as `Bitmap`, `Metafile`, or `EMF`); on .NET Standard the format is controlled by `ExportImageOptions`. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} +// The following snippet assumes `application` and `sheet` are already initialized +// (see the "Complete code" tab below for the full setup). // Initialize XlsIORenderer application.XlsIORenderer = new XlsIORenderer(); -// Converts and save as stream -MemoryStream stream = new MemoryStream(); -sheet.ConvertToImage(1, 1, 10, 20, stream); +// Convert and save as a stream +using (MemoryStream stream = new MemoryStream()) +{ + sheet.ConvertToImage(1, 1, 10, 20, stream); + // stream.Position = 0; // reset before reading, if needed +} {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -// Converts and save as stream -MemoryStream stream = new MemoryStream(); -sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream); +// Convert and save as a stream with a specific ImageType +using (MemoryStream stream = new MemoryStream()) +{ + sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream); +} {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -'Converts and save as stream -Dim stream As MemoryStream = New MemoryStream() -sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream) +'Convert and save as a stream with a specific ImageType +Using stream As MemoryStream = New MemoryStream() + sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream) +End Using {% endhighlight %} {% endtabs %} @@ -84,22 +99,24 @@ using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); - IWorksheet sheet = workbook.Worksheets[0]; - - //Initialize XlsIORenderer - application.XlsIORenderer = new XlsIORenderer(); - - #region Save - //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Image.png"), FileMode.Create, FileAccess.Write); - sheet.ConvertToImage(sheet.UsedRange, outputStream); - #endregion - - //Dispose streams - outputStream.Dispose(); - inputStream.Dispose(); + + // Open the input workbook. + using (FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read)) + { + IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorksheet sheet = workbook.Worksheets[0]; + + //Initialize XlsIORenderer + application.XlsIORenderer = new XlsIORenderer(); + + #region Save + // Save the worksheet as a PNG image. + using (FileStream outputStream = new FileStream(Path.GetFullPath("Output/Image.png"), FileMode.Create, FileAccess.Write)) + { + sheet.ConvertToImage(sheet.UsedRange, outputStream); + } + #endregion + } } {% endhighlight %} @@ -111,20 +128,15 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); IWorksheet sheet = workbook.Worksheets[0]; - //Convert as bitmap + // Convert the worksheet range to a bitmap image and save it as PNG. Image image = sheet.ConvertToImage(1, 1, 10, 20); - image.Save("Sample.png", ImageFormat.Png); - //Converts and save as stream - MemoryStream stream = new MemoryStream(); - sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream); - - //Save the workbook to disk - workbook.SaveAs("Sample.xlsx"); - - //No exception will be thrown if there are unsaved workbooks - excelEngine.ThrowNotSavedOnDestroy = false; + // Convert the worksheet range to a Metafile image and save it to a stream. + using (MemoryStream stream = new MemoryStream()) + { + sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream); + } } {% endhighlight %} @@ -132,23 +144,17 @@ using (ExcelEngine excelEngine = new ExcelEngine()) Using excelEngine As ExcelEngine = New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx - Dim workbook As IWorkbook = application.Workbooks.Open("sample.xlsx", ExcelOpenType.Automatic) - Dim worksheet As IWorksheet = workbook.Worksheets(0) - - 'Convert as bitmap - Dim image As Image = worksheet.ConvertToImage(1, 1, 10, 20) + Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic) + Dim sheet As IWorksheet = workbook.Worksheets(0) + ' Convert the worksheet range to a bitmap image and save it as PNG. + Dim image As Image = sheet.ConvertToImage(1, 1, 10, 20) image.Save("Sample.png", ImageFormat.Png) - 'Converts and save as stream - Dim stream As MemoryStream = New MemoryStream() - worksheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream) - - 'Save the workbook to disk - workbook.SaveAs("Sample.xlsx") - - 'No exception will be thrown if there are unsaved workbooks. - excelEngine.ThrowNotSavedOnDestroy = False + ' Convert the worksheet range to a Metafile image and save it to a stream. + Using stream As MemoryStream = New MemoryStream() + sheet.ConvertToImage(1, 1, 10, 20, ImageType.Metafile, stream) + End Using End Using {% endhighlight %} {% endtabs %} @@ -164,3 +170,10 @@ N> 3. Worksheet to image conversion is supported from .NET Framework 2.0 and .NE * Subscript/Superscript * Shrink to fit * Complex conditional formatting + +## See also + +* [Worksheet to Image conversion in .NET](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-image/net/worksheet-to-image-conversion) — runnable code samples for each platform. +* [Assemblies Required for Excel to PDF conversion](../Excel-to-PDF/NET/assemblies-required-for-excel-to-pdf) — manual assembly references. +* [NuGet Packages Required for Excel to PDF conversion](../Excel-to-PDF/NET/nuget-packages-required-for-excel-to-pdf) — install the right package for your target platform. +* [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) — register your license key. diff --git a/Document-Processing/Excel/Conversions/Excel-to-JSON/NET/Excel-to-JSON-Conversion.md b/Document-Processing/Excel/Conversions/Excel-to-JSON/NET/Excel-to-JSON-Conversion.md index 1d37f083df..80fffdd6c5 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-JSON/NET/Excel-to-JSON-Conversion.md +++ b/Document-Processing/Excel/Conversions/Excel-to-JSON/NET/Excel-to-JSON-Conversion.md @@ -1,6 +1,6 @@ --- -title: Syncfusion Excel to JSON File 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 +description: Lists how to convert an Excel workbook, worksheet, or range to JSON using the Syncfusion .NET Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -8,7 +8,7 @@ documentation: UG # Excel to JSON Conversion -Essential® XlsIO supports to convert Excel data as JSON files by simply saving the workbook using the [SaveAsJson](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAsJson_System_String_) method. This support includes the features: +XlsIO can convert an Excel workbook, worksheet, or range to JSON by calling [`IWorkbook.SaveAsJson`](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorkbook.html#Syncfusion_XlsIO_IWorkbook_SaveAsJson_System_String_). The output can be written to a file or a `Stream`, with or without a JSON schema. * Save as a simple JSON file or a JSON file as schema * Save a workbook to JSON @@ -121,7 +121,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; @@ -184,13 +184,11 @@ using (ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); - - //Active worksheet IWorksheet worksheet = workbook.Worksheets[0]; //Saves the worksheet to a JSON file, as schema by default @@ -210,12 +208,10 @@ using(ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic) - - 'Active worksheet Dim worksheet As IWorksheet = workbook.Worksheets(0) 'Saves the worksheet to a JSON file, as schema by default @@ -339,8 +335,6 @@ using(ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); - - //Active worksheet IWorksheet worksheet = workbook.Worksheets[0]; //Custom range @@ -363,12 +357,10 @@ using(ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic) - - 'Active worksheet Dim worksheet As IWorksheet = workbook.Worksheets(0) 'Custom range diff --git a/Document-Processing/Excel/Conversions/Excel-to-JSON/overview.md b/Document-Processing/Excel/Conversions/Excel-to-JSON/overview.md index 741826265d..f354f46eab 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-JSON/overview.md +++ b/Document-Processing/Excel/Conversions/Excel-to-JSON/overview.md @@ -1,6 +1,6 @@ --- -title: Syncfusion Excel to JSON File Conversion | Syncfusion -description: This page explains how to export Excel workbook, worksheet, or custom range data into JSON format efficiently. +title: Syncfusion Excel to JSON Conversion +description: Lists how to convert an Excel workbook, worksheet, or range to JSON using the Syncfusion .NET Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -104,68 +104,82 @@ The following code illustrates how to convert an Excel workbook to the JSON file {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Convert%20Excel%20to%20JSON/Workbook%20to%20JSON%20without%20Schema/.NET/Workbook%20to%20JSON%20without%20Schema/Workbook%20to%20JSON%20without%20Schema/Program.cs,180" %} using (ExcelEngine excelEngine = new ExcelEngine()) { - IApplication application = excelEngine.Excel; - application.DefaultVersion = ExcelVersion.Xlsx; - IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); - IWorksheet worksheet = workbook.Worksheets[0]; + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"), ExcelOpenType.Automatic); - #region save as JSON - //Saves the workbook to JSON file without schema - workbook.SaveAsJson(Path.GetFullPath(@"Output/Workbook-To-JSON-without-schema.json"),false); - #endregion + // Save the workbook to JSON, as schema by default + workbook.SaveAsJson(Path.GetFullPath("Output/Workbook-To-JSON-with-schema.json")); - #region Open JSON - //Open default JSON - #endregion + // Save the workbook to JSON without schema + workbook.SaveAsJson(Path.GetFullPath("Output/Workbook-To-JSON-without-schema.json"), false); } {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); - //Saves the workbook to a JSON file without schema + // Save the workbook to a JSON file, as schema by default + workbook.SaveAsJson("Excel-Workbook-To-JSON-with-schema.json"); + + // Save the workbook to a JSON file without schema workbook.SaveAsJson("Excel-Workbook-To-JSON-without-schema.json", false); - //Saves the workbook to a JSON filestream without schema - FileStream stream = new FileStream("Excel-Workbook-To-JSON-filestream-without-schema.json", FileMode.Create); - workbook.SaveAsJson(stream, false); + // Save the workbook to a JSON filestream, as schema by default + using (FileStream stream = new FileStream("Excel-Workbook-To-JSON-filestream-with-schema.json", FileMode.Create)) + { + workbook.SaveAsJson(stream); + } + + // Save the workbook to a JSON filestream without schema + using (FileStream stream = new FileStream("Excel-Workbook-To-JSON-filestream-without-schema.json", FileMode.Create)) + { + workbook.SaveAsJson(stream, false); + } } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic) - 'Saves the workbook to a JSON file without schema - workbook.SaveAsJson("Excel-Workbook-To-JSON-without-schema.json", false) + ' Save the workbook to a JSON file, as schema by default + workbook.SaveAsJson("Excel-Workbook-To-JSON-with-schema.json") + + ' Save the workbook to a JSON file without schema + workbook.SaveAsJson("Excel-Workbook-To-JSON-without-schema.json", False) + + ' Save the workbook to a JSON filestream, as schema by default + Using stream As New FileStream("Excel-Workbook-To-JSON-filestream-with-schema.json", FileMode.Create) + workbook.SaveAsJson(stream) + End Using - 'Saves the workbook to a JSON filestream without schema - Dim stream As FileStream = new FileStream("Excel-Workbook-To-JSON-filestream-without-schema.json", FileMode.Create) - workbook.SaveAsJson(stream, false) + ' Save the workbook to a JSON filestream without schema + Using stream1 As New FileStream("Excel-Workbook-To-JSON-filestream-without-schema.json", FileMode.Create) + workbook.SaveAsJson(stream1, False) + End Using End Using {% endhighlight %} {% endtabs %} -A complete working example to convert Excel to JSON without schema in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Convert%20Excel%20to%20JSON/Workbook%20to%20JSON%20without%20Schema/.NET/Workbook%20to%20JSON%20without%20Schema). +## Worksheet to JSON -## Worksheet to JSON as schema - -The following code illustrates how to convert an Excel worksheet to the JSON file or JSON file stream with schema. +The following code converts the active worksheet to a JSON file or stream. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Convert%20Excel%20to%20JSON/Worksheet%20to%20JSON%20with%20Schema/.NET/Worksheet%20to%20JSON%20with%20Schema/Worksheet%20to%20JSON%20with%20Schema/Program.cs,180" %} using (ExcelEngine excelEngine = new ExcelEngine()) { - IApplication application = excelEngine.Excel; - application.DefaultVersion = ExcelVersion.Xlsx; - IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx")); - IWorksheet worksheet = workbook.Worksheets[0]; + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/InputTemplate.xlsx"), ExcelOpenType.Automatic); + IWorksheet worksheet = workbook.Worksheets[0]; #region save as JSON //Saves the workbook to JSON, as schema by default @@ -184,13 +198,11 @@ using (ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); - - //Active worksheet IWorksheet worksheet = workbook.Worksheets[0]; //Saves the worksheet to a JSON file, as schema by default @@ -199,23 +211,25 @@ using(ExcelEngine excelEngine = new ExcelEngine()) //Saves the worksheet to a JSON file as schema workbook.SaveAsJson("Excel-Worksheet-To-JSON-as-schema.json", worksheet, true); - //Saves the worksheet to a JSON filestream, as schema by default - FileStream stream = new FileStream("Excel-Worksheet-To-JSON-filestream-as-schema-default.json", FileMode.Create); - workbook.SaveAsJson("stream", worksheet); - - //Saves the worksheet to a JSON filestream as schema - FileStream stream1 = new FileStream("Excel-Worksheet-To-JSON-filestream-as-schema.json", FileMode.Create); - workbook.SaveAsJson(stream1, worksheet, true); + // Save the worksheet to a JSON filestream, as schema by default + using (FileStream stream = new FileStream("Excel-Worksheet-To-JSON-filestream-with-schema.json", FileMode.Create)) + { + workbook.SaveAsJson(stream, worksheet); + } + + // Save the worksheet to a JSON filestream without schema + using (FileStream stream = new FileStream("Excel-Worksheet-To-JSON-filestream-without-schema.json", FileMode.Create)) + { + workbook.SaveAsJson(stream, worksheet, false); + } } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic) - - 'Active worksheet Dim worksheet As IWorksheet = workbook.Worksheets(0) 'Saves the worksheet to a JSON file, as schema by default @@ -224,13 +238,15 @@ Using excelEngine As ExcelEngine = New ExcelEngine() 'Saves the worksheet to a JSON file as schema workbook.SaveAsJson("Excel-Worksheet-To-JSON-as-schema.json", worksheet, true) - 'Saves the worksheet to a JSON filestream as schema by default - Dim stream As FileStream = new FileStream("Excel-Worksheet-To-JSON-filestream-as-schema-default.json",FileMode.Create) - workbook.SaveAsJson(stream, worksheet) + ' Save the worksheet to a JSON filestream, as schema by default + Using stream As New FileStream("Excel-Worksheet-To-JSON-filestream-with-schema.json", FileMode.Create) + workbook.SaveAsJson(stream, worksheet) + End Using - 'Saves the worksheet to a JSON filestream as schema - Dim stream1 As FileStream = new FileStream("Excel-Worksheet-To-JSON-filestream-as-schema.json",FileMode.Create) - workbook.SaveAsJson(stream1, worksheet, true) + ' Save the worksheet to a JSON filestream without schema + Using stream1 As New FileStream("Excel-Worksheet-To-JSON-filestream-without-schema.json", FileMode.Create) + workbook.SaveAsJson(stream1, worksheet, False) + End Using End Using {% endhighlight %} {% endtabs %} @@ -363,7 +379,7 @@ using(ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic) diff --git a/Document-Processing/Excel/Conversions/Excel-to-Markdown/NET/Excel-to-Markdown-Conversion.md b/Document-Processing/Excel/Conversions/Excel-to-Markdown/NET/Excel-to-Markdown-Conversion.md index c8a1a47559..28340789a2 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-Markdown/NET/Excel-to-Markdown-Conversion.md +++ b/Document-Processing/Excel/Conversions/Excel-to-Markdown/NET/Excel-to-Markdown-Conversion.md @@ -1,6 +1,6 @@ --- title: Convert Excel to Markdown in C# | XlsIO | Syncfusion -description: Convert Excel to Markdown in C# using Syncfusion® .NET Excel (XlsIO) library without Microsoft Excel or interop dependencies +description: Lists how to convert an Excel workbook or worksheet to a Markdown file using the Syncfusion .NET Excel (XlsIO) library, with no Microsoft Office or interop dependencies. platform: document-processing control: XlsIO documentation: UG @@ -12,7 +12,7 @@ Markdown is a lightweight markup language that adds formatting elements to plain ## Assemblies and NuGet packages required -Refer to the following links for assemblies and NuGet packages required based on platforms to convert an Excel document to Markdown using the .NET Excel Library (XlsIO). +For the assemblies and NuGet packages required to convert Excel to Markdown, see the per-platform lists below. * [Excel to Markdown conversion assemblies](https://help.syncfusion.com/document-processing/excel/excel-library/net/assemblies-required) * [Excel to Markdown conversion NuGet packages](https://help.syncfusion.com/document-processing/excel/excel-library/net/nuget-packages-required) @@ -164,7 +164,7 @@ Private Sub MdExportSettings_ImageNodeVisited(sender As Object, args As SaveImag Using fileStreamOutput As FileStream = File.Create(imagePath) args.ImageStream.CopyTo(fileStreamOutput) End Using - ' Set the image URI to be used in the output markdown + ' Set the image URI to be used in the output Markdown. args.Uri = imagePath End Sub {% endhighlight %} diff --git a/Document-Processing/Excel/Conversions/Excel-to-Markdown/overview.md b/Document-Processing/Excel/Conversions/Excel-to-Markdown/overview.md index 71b6746c9e..334f64303b 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-Markdown/overview.md +++ b/Document-Processing/Excel/Conversions/Excel-to-Markdown/overview.md @@ -1,6 +1,6 @@ --- title: Convert Excel to Markdown in C# | XlsIO | Syncfusion -description: Convert Excel to Markdown in C# using Syncfusion® .NET Excel (XlsIO) library without Microsoft Excel or interop dependencies +description: Lists how to convert an Excel workbook or worksheet to a Markdown file using the Syncfusion .NET Excel (XlsIO) library, with no Microsoft Office or interop dependencies. platform: document-processing control: XlsIO documentation: UG @@ -12,12 +12,12 @@ Markdown is a lightweight markup language that adds formatting elements to plain ## Assemblies and NuGet packages required -Refer to the following links for assemblies and NuGet packages required based on platforms to convert an Excel document to Markdown using the .NET Excel Library (XlsIO). +For the assemblies and NuGet packages required to convert Excel to Markdown, see the per-platform lists below. * [Excel to Markdown conversion assemblies](https://help.syncfusion.com/document-processing/excel/excel-library/net/assemblies-required) * [Excel to Markdown conversion NuGet packages](https://help.syncfusion.com/document-processing/excel/excel-library/net/nuget-packages-required) -## Convert Excel to Markdown document +## Convert Excel to Markdown Convert an existing Excel file to Markdown using the .NET Excel (XlsIO) library. @@ -164,7 +164,7 @@ Private Sub MdExportSettings_ImageNodeVisited(sender As Object, args As SaveImag Using fileStreamOutput As FileStream = File.Create(imagePath) args.ImageStream.CopyTo(fileStreamOutput) End Using - ' Set the image URI to be used in the output markdown + ' Set the image URI to be used in the output Markdown. args.Uri = imagePath End Sub {% endhighlight %} diff --git a/Document-Processing/Excel/Conversions/Excel-to-ODS/NET/Excel-to-ODS-Conversion.md b/Document-Processing/Excel/Conversions/Excel-to-ODS/NET/Excel-to-ODS-Conversion.md index 458206ef72..f8330cff4a 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-ODS/NET/Excel-to-ODS-Conversion.md +++ b/Document-Processing/Excel/Conversions/Excel-to-ODS/NET/Excel-to-ODS-Conversion.md @@ -1,6 +1,6 @@ --- title: Excel to ODS Conversion in .NET Excel Library | Syncfusion -description: In this section, you can learn how to convert Excel docuemnts to ODS docuemnts using .NET Excel Library +description: Lists how to convert an Excel workbook to an ODS document using the Syncfusion .NET Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -8,11 +8,15 @@ documentation: UG # Excel to ODS Conversion -The Open Document Format for Office Applications (ODF) is also known as OpenDocument. It is an XML-based file format for spreadsheets, charts, presentations, and word processing documents. It was developed with the aim of providing an open and XML-based file format specification for office applications. OpenOffice uses ODF format as its default document format. The OpenDocument Spreadsheet (ODS) is the file format for Excel documents. XlsIO supports conversion of XLS/XLSX documents to ODS. +The OpenDocument Format (ODF) is an XML-based file format for spreadsheets, charts, presentations, and word-processing documents. The OpenDocument Spreadsheet (ODS) format is the spreadsheet counterpart used by OpenOffice and LibreOffice. XlsIO converts XLS and XLSX workbooks to ODS. -## Saving ODS in different platforms +To write an ODS file, set `application.DefaultVersion` to a value that maps to ODS (`ExcelVersion.Excel2013` is shown in the samples below; older values such as `Excel2010` are also accepted) and call `workbook.SaveAs("Output.ods")`. All sheets in the workbook are exported. -The following code snippet illustrates the creation of an Excel file and exporting it to ODS format. +N> IMPORTANT: Before running the samples on this page, install the required NuGet package for your target platform and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). + +## Export to ODS + +The following code snippet creates an Excel file and exports it to ODS format. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20ODS/Excel%20to%20ODS/.NET/Excel%20to%20ODS/Excel%20to%20ODS/Program.cs,180" %} @@ -35,7 +39,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) worksheet.Range["B3"].Number = 71550; worksheet.Range["B5"].Formula = "SUM(B2:B4)"; - //Comments + // Comments IComment comment = worksheet.Range["B5"].AddComment(); comment.RichText.Text = "This cell has formula."; @@ -49,7 +53,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) redFont.Color = ExcelKnownColors.Red; richText.SetFont(14, 20, redFont); - //Formatting + // Formatting IStyle style = workbook.Styles.Add("Style1"); style.Color = Syncfusion.Drawing.Color.DarkBlue; style.Font.Color = ExcelKnownColors.WhiteCustom; @@ -57,10 +61,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) worksheet.Range["A1:B1"].CellStyleName = "Style1"; worksheet.Range["A5:B5"].CellStyleName = "Style1"; - #region Save - //Saving the workbook + // Save the workbook as ODS workbook.SaveAs("Output.ods"); - #endregion } {% endhighlight %} @@ -84,7 +86,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) worksheet.Range["B3"].Number = 71550; worksheet.Range["B5"].Formula = "SUM(B2:B4)"; - //Comments + // Comments IComment comment = worksheet.Range["B5"].AddComment(); comment.RichText.Text = "This cell has formula."; @@ -98,7 +100,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) redFont.Color = ExcelKnownColors.Red; richText.SetFont(14, 20, redFont); - //Formatting + // Formatting IStyle style = workbook.Styles.Add("Style1"); style.Color = Color.DarkBlue; style.Font.Color = ExcelKnownColors.WhiteCustom; @@ -106,13 +108,13 @@ using (ExcelEngine excelEngine = new ExcelEngine()) worksheet.Range["A1:B1"].CellStyleName = "Style1"; worksheet.Range["A5:B5"].CellStyleName = "Style1"; - //Save in ODS format + // Save the workbook as ODS workbook.SaveAs("Output.ods"); } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Excel2013 Dim workbook As IWorkbook = application.Workbooks.Create(1) @@ -130,7 +132,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() worksheet.Range("B3").Number = 71550 worksheet.Range("B5").Formula = "SUM(B2:B4)" - 'Comments + ' Comments Dim comment As IComment = worksheet.Range("B5").AddComment() comment.RichText.Text = "This cell has formula." @@ -144,7 +146,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() redFont.Color = ExcelKnownColors.Red richText.SetFont(14, 20, redFont) - 'Formatting + ' Formatting Dim style As IStyle = workbook.Styles.Add("Style1") style.Color = Color.DarkBlue style.Font.Color = ExcelKnownColors.WhiteCustom @@ -152,396 +154,61 @@ Using excelEngine As ExcelEngine = New ExcelEngine() worksheet.Range("A1:B1").CellStyleName = "Style1" worksheet.Range("A5:B5").CellStyleName = "Style1" - 'Save in ODS format + ' Save the workbook as ODS workbook.SaveAs("Output.ods") End Using {% endhighlight %} {% endtabs %} -A complete working example to convert Excel to ODS in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20ODS/Excel%20to%20ODS/.NET/Excel%20to%20ODS). +A complete working example to convert Excel to ODS in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20ODS/Excel%20to%20ODS/.NET/Excel%20to%20ODS). ## Supported and unsupported elements in ODS conversion - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-{{'**Category**'| markdownify }} - -{{'**Subcategory**'| markdownify }} - -{{'**Supported**'| markdownify }} -
-Formatting - -Font settings

-Yes -
- - -Alignments - -Yes (Except indent) -
- - -Number formatting - -Yes (Partial) -
- - -Border settings

-Yes -
- - -Fill settings

-Yes -
- - -RGB colors  - -Yes -
- - -Cell gradient

-No -
- - -Cell styles

-Yes -
- - -Themes - -No -
- - -Conditional formatting

-Planned -
-Hyperlinks - -- - - Yes -
-Cell Comments - -- - -Yes -
-Print - -Page setup

-Yes -
- - -[Margin, Page size]

-Yes -
- - -Page breaks

-No -
- - -Background image

-No -
- - -Print settings [Print area, Print titles, Page order]

-No -
- - -Header/Footer

-Planned -
-Calculations - -Formulas - -Yes (Partial) -
- - -Table Formulas - -No -
- - -Names - -Yes (Partial) -
-Group & Outline - -- - -Yes -
-Settings - -Window Settings - -No -
- - -Sheet/Book settings - -No -
-Protection - -Sheet Protection - -No -
- - -Encryption - -N/A -
-Hide/Unhide rows/cols

-- - -Yes -
-Copy/Move worksheet

-- - -Yes -
-Image

-- - -No -
-Data Validation - -- - -No -
-Tables - -- - -Planned -
-PivotTable - -- - -No -
-Charts - -- - -Planned -
-Drawing - -- - -Planned -
-OLE Objects - -- - -No -
+The table below summarizes the workbook features XlsIO preserves when writing an `.ods` file. + +| Category | Subcategory | Supported | +| -------- | ----------- | --------- | +| Formatting | Font settings | Yes | +| Formatting | Alignments | Yes (except indent) | +| Formatting | Number formatting | Yes (partial) | +| Formatting | Border settings | Yes | +| Formatting | Fill settings | Yes | +| Formatting | RGB colors | Yes | +| Formatting | Cell gradient | No | +| Formatting | Cell styles | Yes | +| Formatting | Themes | No | +| Formatting | Conditional formatting | Planned | +| Hyperlinks | – | Yes | +| Cell Comments | – | Yes | +| Print | Page setup | Yes | +| Print | Margin, Page size | Yes | +| Print | Page breaks | No | +| Print | Background image | No | +| Print | Print settings (Print area, Print titles, Page order) | No | +| Print | Header/Footer | Planned | +| Calculations | Formulas | Yes (partial) | +| Calculations | Table formulas | No | +| Calculations | Names | Yes (partial) | +| Group & Outline | – | Yes | +| Settings | Window settings | No | +| Settings | Sheet/Book settings | No | +| Protection | Sheet protection | No | +| Protection | Encryption | N/A | +| Hide/Unhide rows/cols | – | Yes | +| Copy/Move worksheet | – | Yes | +| Image | – | No | +| Data Validation | – | No | +| Tables | – | Planned | +| PivotTable | – | No | +| Charts | – | Planned | +| Drawing | – | Planned | +| OLE Objects | – | No | + +## See also + +* [Convert Excel to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/overview) +* [Convert Excel to image](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-image/overview) +* [Convert Excel to HTML](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-html/overview) +* [Convert Excel to CSV (or TSV)](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-csv/overview) +* [NuGet packages for Excel (XlsIO)](https://help.syncfusion.com/document-processing/excel/getting-started/nuget-packages-required) +* [Syncfusion .NET Excel (XlsIO) — Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) diff --git a/Document-Processing/Excel/Conversions/Excel-to-ODS/overview.md b/Document-Processing/Excel/Conversions/Excel-to-ODS/overview.md index 458206ef72..f8330cff4a 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-ODS/overview.md +++ b/Document-Processing/Excel/Conversions/Excel-to-ODS/overview.md @@ -1,6 +1,6 @@ --- title: Excel to ODS Conversion in .NET Excel Library | Syncfusion -description: In this section, you can learn how to convert Excel docuemnts to ODS docuemnts using .NET Excel Library +description: Lists how to convert an Excel workbook to an ODS document using the Syncfusion .NET Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -8,11 +8,15 @@ documentation: UG # Excel to ODS Conversion -The Open Document Format for Office Applications (ODF) is also known as OpenDocument. It is an XML-based file format for spreadsheets, charts, presentations, and word processing documents. It was developed with the aim of providing an open and XML-based file format specification for office applications. OpenOffice uses ODF format as its default document format. The OpenDocument Spreadsheet (ODS) is the file format for Excel documents. XlsIO supports conversion of XLS/XLSX documents to ODS. +The OpenDocument Format (ODF) is an XML-based file format for spreadsheets, charts, presentations, and word-processing documents. The OpenDocument Spreadsheet (ODS) format is the spreadsheet counterpart used by OpenOffice and LibreOffice. XlsIO converts XLS and XLSX workbooks to ODS. -## Saving ODS in different platforms +To write an ODS file, set `application.DefaultVersion` to a value that maps to ODS (`ExcelVersion.Excel2013` is shown in the samples below; older values such as `Excel2010` are also accepted) and call `workbook.SaveAs("Output.ods")`. All sheets in the workbook are exported. -The following code snippet illustrates the creation of an Excel file and exporting it to ODS format. +N> IMPORTANT: Before running the samples on this page, install the required NuGet package for your target platform and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). + +## Export to ODS + +The following code snippet creates an Excel file and exports it to ODS format. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20ODS/Excel%20to%20ODS/.NET/Excel%20to%20ODS/Excel%20to%20ODS/Program.cs,180" %} @@ -35,7 +39,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) worksheet.Range["B3"].Number = 71550; worksheet.Range["B5"].Formula = "SUM(B2:B4)"; - //Comments + // Comments IComment comment = worksheet.Range["B5"].AddComment(); comment.RichText.Text = "This cell has formula."; @@ -49,7 +53,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) redFont.Color = ExcelKnownColors.Red; richText.SetFont(14, 20, redFont); - //Formatting + // Formatting IStyle style = workbook.Styles.Add("Style1"); style.Color = Syncfusion.Drawing.Color.DarkBlue; style.Font.Color = ExcelKnownColors.WhiteCustom; @@ -57,10 +61,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) worksheet.Range["A1:B1"].CellStyleName = "Style1"; worksheet.Range["A5:B5"].CellStyleName = "Style1"; - #region Save - //Saving the workbook + // Save the workbook as ODS workbook.SaveAs("Output.ods"); - #endregion } {% endhighlight %} @@ -84,7 +86,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) worksheet.Range["B3"].Number = 71550; worksheet.Range["B5"].Formula = "SUM(B2:B4)"; - //Comments + // Comments IComment comment = worksheet.Range["B5"].AddComment(); comment.RichText.Text = "This cell has formula."; @@ -98,7 +100,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) redFont.Color = ExcelKnownColors.Red; richText.SetFont(14, 20, redFont); - //Formatting + // Formatting IStyle style = workbook.Styles.Add("Style1"); style.Color = Color.DarkBlue; style.Font.Color = ExcelKnownColors.WhiteCustom; @@ -106,13 +108,13 @@ using (ExcelEngine excelEngine = new ExcelEngine()) worksheet.Range["A1:B1"].CellStyleName = "Style1"; worksheet.Range["A5:B5"].CellStyleName = "Style1"; - //Save in ODS format + // Save the workbook as ODS workbook.SaveAs("Output.ods"); } {% endhighlight %} {% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} -Using excelEngine As ExcelEngine = New ExcelEngine() +Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Excel2013 Dim workbook As IWorkbook = application.Workbooks.Create(1) @@ -130,7 +132,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() worksheet.Range("B3").Number = 71550 worksheet.Range("B5").Formula = "SUM(B2:B4)" - 'Comments + ' Comments Dim comment As IComment = worksheet.Range("B5").AddComment() comment.RichText.Text = "This cell has formula." @@ -144,7 +146,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() redFont.Color = ExcelKnownColors.Red richText.SetFont(14, 20, redFont) - 'Formatting + ' Formatting Dim style As IStyle = workbook.Styles.Add("Style1") style.Color = Color.DarkBlue style.Font.Color = ExcelKnownColors.WhiteCustom @@ -152,396 +154,61 @@ Using excelEngine As ExcelEngine = New ExcelEngine() worksheet.Range("A1:B1").CellStyleName = "Style1" worksheet.Range("A5:B5").CellStyleName = "Style1" - 'Save in ODS format + ' Save the workbook as ODS workbook.SaveAs("Output.ods") End Using {% endhighlight %} {% endtabs %} -A complete working example to convert Excel to ODS in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20ODS/Excel%20to%20ODS/.NET/Excel%20to%20ODS). +A complete working example to convert Excel to ODS in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20ODS/Excel%20to%20ODS/.NET/Excel%20to%20ODS). ## Supported and unsupported elements in ODS conversion - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-{{'**Category**'| markdownify }} - -{{'**Subcategory**'| markdownify }} - -{{'**Supported**'| markdownify }} -
-Formatting - -Font settings

-Yes -
- - -Alignments - -Yes (Except indent) -
- - -Number formatting - -Yes (Partial) -
- - -Border settings

-Yes -
- - -Fill settings

-Yes -
- - -RGB colors  - -Yes -
- - -Cell gradient

-No -
- - -Cell styles

-Yes -
- - -Themes - -No -
- - -Conditional formatting

-Planned -
-Hyperlinks - -- - - Yes -
-Cell Comments - -- - -Yes -
-Print - -Page setup

-Yes -
- - -[Margin, Page size]

-Yes -
- - -Page breaks

-No -
- - -Background image

-No -
- - -Print settings [Print area, Print titles, Page order]

-No -
- - -Header/Footer

-Planned -
-Calculations - -Formulas - -Yes (Partial) -
- - -Table Formulas - -No -
- - -Names - -Yes (Partial) -
-Group & Outline - -- - -Yes -
-Settings - -Window Settings - -No -
- - -Sheet/Book settings - -No -
-Protection - -Sheet Protection - -No -
- - -Encryption - -N/A -
-Hide/Unhide rows/cols

-- - -Yes -
-Copy/Move worksheet

-- - -Yes -
-Image

-- - -No -
-Data Validation - -- - -No -
-Tables - -- - -Planned -
-PivotTable - -- - -No -
-Charts - -- - -Planned -
-Drawing - -- - -Planned -
-OLE Objects - -- - -No -
+The table below summarizes the workbook features XlsIO preserves when writing an `.ods` file. + +| Category | Subcategory | Supported | +| -------- | ----------- | --------- | +| Formatting | Font settings | Yes | +| Formatting | Alignments | Yes (except indent) | +| Formatting | Number formatting | Yes (partial) | +| Formatting | Border settings | Yes | +| Formatting | Fill settings | Yes | +| Formatting | RGB colors | Yes | +| Formatting | Cell gradient | No | +| Formatting | Cell styles | Yes | +| Formatting | Themes | No | +| Formatting | Conditional formatting | Planned | +| Hyperlinks | – | Yes | +| Cell Comments | – | Yes | +| Print | Page setup | Yes | +| Print | Margin, Page size | Yes | +| Print | Page breaks | No | +| Print | Background image | No | +| Print | Print settings (Print area, Print titles, Page order) | No | +| Print | Header/Footer | Planned | +| Calculations | Formulas | Yes (partial) | +| Calculations | Table formulas | No | +| Calculations | Names | Yes (partial) | +| Group & Outline | – | Yes | +| Settings | Window settings | No | +| Settings | Sheet/Book settings | No | +| Protection | Sheet protection | No | +| Protection | Encryption | N/A | +| Hide/Unhide rows/cols | – | Yes | +| Copy/Move worksheet | – | Yes | +| Image | – | No | +| Data Validation | – | No | +| Tables | – | Planned | +| PivotTable | – | No | +| Charts | – | Planned | +| Drawing | – | Planned | +| OLE Objects | – | No | + +## See also + +* [Convert Excel to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/overview) +* [Convert Excel to image](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-image/overview) +* [Convert Excel to HTML](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-html/overview) +* [Convert Excel to CSV (or TSV)](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-csv/overview) +* [NuGet packages for Excel (XlsIO)](https://help.syncfusion.com/document-processing/excel/getting-started/nuget-packages-required) +* [Syncfusion .NET Excel (XlsIO) — Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Assemblies-Required-for-Excel-to-PDF.md b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Assemblies-Required-for-Excel-to-PDF.md index 7ca4f4246c..e1e42580d5 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Assemblies-Required-for-Excel-to-PDF.md +++ b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Assemblies-Required-for-Excel-to-PDF.md @@ -1,16 +1,17 @@ --- -title: Execl to PDF Assemblies Required | Syncfusion -description: Briefs the assemblies required to convert excel document to PDF for various platforms and frameworks. +title: Excel to PDF Assemblies Required | Syncfusion +description: Lists the assemblies required to convert an Excel workbook to PDF for various .NET platforms and frameworks. platform: document-processing control: XlsIO documentation: UG --- -# Assemblies Required for Excel to PDF conversion +# Assemblies Required for Excel to PDF Conversion For converting an Excel document to PDF, the following assemblies need to be referenced in your application. + + - @@ -76,6 +77,7 @@ Assembly + +
Platform(s) @@ -19,6 +20,7 @@ Platform(s) Assembly
@@ -32,7 +34,6 @@ Syncfusion.ExcelToPDFConverter.Base
{{'[ASP.NET Core](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/convert-excel-to-pdf-in-asp-net-core)' | markdownify}}, {{'[Xamarin](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/convert-excel-to-pdf-in-xamarin)' | markdownify}} and {{'[Blazor](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/convert-excel-to-pdf-in-blazor)' | markdownify}}
{{'[ASP.NET](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/convert-excel-to-pdf-in-asp-net)' | markdownify}}
@@ -84,14 +86,13 @@ Assembly Syncfusion.XlsIO.Base
Syncfusion.Compression.Base
Syncfusion.Pdf.Base
-Syncfusion.ExcelToPdfConverter.Base +Syncfusion.ExcelToPDFConverter.Base
N> 1. Excel to PDF conversion is supported from .NET Framework 2.0 and .NET Standard 1.4 onwards. N> 2. Starting with v16.2.0.x, if you reference Syncfusion® assemblies from trial setup or from the NuGet feed, you also have to add "Syncfusion.Licensing" assembly reference and include a license key in your projects. Please refer to this [link](https://help.syncfusion.com/common/essential-studio/licensing/overview) to know about registering Syncfusion® license key in your applications to use our components. N> 3. Syncfusion® components are available in nuget.org - - diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Excel-to-PDF-Conversion.md b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Excel-to-PDF-Conversion.md index fd7c9d6b2f..c98b66fdfd 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Excel-to-PDF-Conversion.md +++ b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Excel-to-PDF-Conversion.md @@ -1,6 +1,6 @@ ---- +--- title: Syncfusion Excel to PDF Conversion -description: In this section, you can learn how to convert Excel Workbook to PDF & Worksheet to PDF file; how to print Excel file and how to convert Excel chart to image +description: This section explains how to convert an Excel workbook to PDF, a single worksheet to PDF, an Excel chart to image or PDF, and how to print an Excel document. platform: document-processing control: XlsIO documentation: UG @@ -8,12 +8,14 @@ documentation: UG # Excel to PDF Conversion -[XlsIO](https://www.syncfusion.com/document-processing/excel-framework/net/excel-to-pdf-conversion) supports converting an entire workbook or a single worksheet into PDF document. Refer the following links for assemblies/nuget packages required based on platforms to convert Excel document into PDF. +[XlsIO](https://www.syncfusion.com/document-processing/excel-framework/net/excel-to-pdf-conversion) supports converting an entire workbook, a single worksheet, or a chart to a PDF document. The following links list the assemblies and NuGet packages required for each platform: + +* [Assemblies Required for Excel to PDF conversion](assemblies-required-for-excel-to-pdf) +* [NuGet Packages Required for Excel to PDF conversion](nuget-packages-required-for-excel-to-pdf) -* [Assemblies Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/assemblies-required#converting-excel-document-to-pdf) -* [NuGet Information](https://help.syncfusion.com/document-processing/excel/excel-library/net/nuget-packages-required#converting-excel-document-into-pdf) +N> IMPORTANT: Before running the samples on this page, install the required NuGet package for your target platform (see the links above) and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). -N> Worksheet To Image conversion can be performed by referring [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) NuGet package in UWP platform. +N> Worksheet To Image conversion can be performed by referring the [Syncfusion.XlsIORenderer.Net.Core](https://www.nuget.org/packages/Syncfusion.XlsIORenderer.Net.Core) NuGet package in UWP platform. ## Workbook to PDF @@ -41,7 +43,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; @@ -113,7 +115,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -Using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; @@ -124,9 +126,9 @@ Using(ExcelEngine excelEngine = new ExcelEngine()) //convert the sheet to PDF ExcelToPdfConverter converter = new ExcelToPdfConverter(sheet); - PdfDocument pdfDocument= new PdfDocument(); + PdfDocument pdfDocument = new PdfDocument(); pdfDocument = converter.Convert(); - pdfDocument.Save("ExcelToPDF.pdf"); + pdfDocument.Save("ExcelToPDF.pdf"); } {% endhighlight %} @@ -166,36 +168,35 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Initialize XlsIO renderer. XlsIORenderer renderer = new XlsIORenderer(); - PdfDocument pdfDocument = new PdfDocument(); foreach (IWorksheet sheet in workbook.Worksheets) { - pdfDocument = renderer.ConvertToPDF(sheet); - - #region Save - //Saving the workbook - pdfDocument.Save(sheet.Name + ".pdf"); - #endregion + using (PdfDocument pdfDocument = renderer.ConvertToPDF(sheet)) + { + #region Save + //Save each worksheet as a separate PDF. + pdfDocument.Save(sheet.Name + ".pdf"); + #endregion + } } } {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -Using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; IWorkbook workbook = application.Workbooks.Open("Sample.xlsx", ExcelOpenType.Automatic); - PdfDocument pdfDocument = new PdfDocument(); - foreach (IWorksheet sheet in workbook.Worksheets) { ExcelToPdfConverter converter = new ExcelToPdfConverter(sheet); - pdfDocument = converter.Convert(); - - //Save the PDF file - pdfDocument.Save(sheet.Name+".pdf"); + using (PdfDocument pdfDocument = converter.Convert()) + { + //Save the PDF file + pdfDocument.Save(sheet.Name + ".pdf"); + } converter.Dispose(); } } @@ -211,10 +212,10 @@ Using excelEngine As ExcelEngine = New ExcelEngine() For Each sheet As IWorksheet In workbook.Worksheets Dim converter As New ExcelToPdfConverter(sheet) - PdfDocument = converter.Convert() + Dim pdfDocument As PdfDocument = converter.Convert() 'Save the PDF file - PdfDocument.Save(sheet.Name + ".pdf") + pdfDocument.Save(sheet.Name + ".pdf") converter.Dispose() Next End Using @@ -225,9 +226,9 @@ A complete working example to convert each worksheet into individual PDF in C# i ## Excel with chart to PDF -XlsIO supports to convert a workbook/worksheet with charts or a single chart into PDF document. +XlsIO supports converting a workbook, a worksheet with charts, or a single chart to a PDF document. -To preserve the charts during Excel To PDF conversion in .NET Framework, initialize the [ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_ChartToImageConverter) of [IApplication](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html) interface. Otherwise the charts present in worksheet gets skipped. +To preserve the charts during Excel-to-PDF conversion in the .NET Framework, initialize the [ChartToImageConverter](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_ChartToImageConverter) property of the [IApplication](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html) interface. Otherwise, the charts in the worksheet are skipped. The following code illustrates how to convert an Excel with chart to PDF document. @@ -256,23 +257,24 @@ using (ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -Using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - //Instantiating the ChartToImageConverter and assigning the ChartToImageConverter instance of XlsIO application + //Instantiate the ChartToImageConverter and assign it to the XlsIO application. application.ChartToImageConverter = new ChartToImageConverter(); - //Tuning chart image quality + //Tune the chart image quality. application.ChartToImageConverter.ScalingMode = ScalingMode.Best; - IWorkbook workbook = application.Workbooks.Open("chart.xlsx"); - IWorksheet worksheet = workbook.Worksheets[0]; + IWorkbook workbook = application.Workbooks.Open("chart.xlsx", ExcelOpenType.Automatic); ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook); - PdfDocument pdfDocument = new PdfDocument(); - pdfDocument = converter.Convert(); - pdfDocument.Save("ExcelToPDF.pdf"); + + using (PdfDocument pdfDocument = converter.Convert()) + { + pdfDocument.Save("ExcelToPDF.pdf"); + } } {% endhighlight %} @@ -288,10 +290,8 @@ Using excelEngine As ExcelEngine = New ExcelEngine() application.ChartToImageConverter.ScalingMode = ScalingMode.Best Dim workbook As IWorkbook = application.Workbooks.Open("chart.xlsx") - Dim worksheet As IWorksheet = workbook.Worksheets(0) - Dim converter As New ExcelToPdfConverter(workbook) - Dim pdfDocument As New PdfDocument() - pdfDocument = converter.Convert() + Dim converter As New ExcelToPdfConverter(workbook) + Dim pdfDocument As PdfDocument = converter.Convert() pdfDocument.Save("ExcelToPDF.pdf") End Using {% endhighlight %} @@ -301,7 +301,7 @@ A complete working example to convert Excel chart to PDF in C# is present on [th ## Excel with comments (notes) to PDF -XlsIO supports to convert a workbook or a worksheet with comments (notes) to PDF documents. By default, comments (notes) will not get converted. To convert the comments in worksheets of an Excel workbook, it is a must to set the print options through [ExcelPrintLocation](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.ExcelPrintLocation.html) enumeration. This option helps to convert, +XlsIO supports converting a workbook or a worksheet that contains comments (notes) to a PDF document. By default, comments are not converted. To convert the comments in a worksheet, set the print options through the [ExcelPrintLocation](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.ExcelPrintLocation.html) enumeration. This option supports three modes: * comments as displayed in place, * comments at the end of the sheet, and @@ -370,7 +370,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() worksheet.PageSetup.PrintComments = ExcelPrintLocation.PrintInPlace 'Open the Excel document to convert - Dim converter As ExcelToPdfConverter = New ExcelToPdfConverter(workbook) + Dim converter As ExcelToPdfConverter = New ExcelToPdfConverter(worksheet) 'Initialize the PDF document Dim pdfDocument As PdfDocument = New PdfDocument() @@ -457,7 +457,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() worksheet.PageSetup.PrintComments = ExcelPrintLocation.PrintSheetEnd 'Open the Excel document to convert - Dim converter As ExcelToPdfConverter = New ExcelToPdfConverter(workbook) + Dim converter As ExcelToPdfConverter = New ExcelToPdfConverter(worksheet) 'Initialize the PDF document Dim pdfDocument As PdfDocument = New PdfDocument() @@ -545,7 +545,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() worksheet.PageSetup.PrintComments = ExcelPrintLocation.PrintNoComments 'Open the Excel document to convert - Dim converter As ExcelToPdfConverter = New ExcelToPdfConverter(workbook) + Dim converter As ExcelToPdfConverter = New ExcelToPdfConverter(worksheet) 'Initialize the PDF document Dim pdfDocument As PdfDocument = New PdfDocument() @@ -677,10 +677,13 @@ The following screenshot represents the output pdf document generated by the Xls ## Substitute Font in Excel-to-PDF Conversion -By default, XlsIO substitutes unsupported fonts to **Microsoft Sans Serif** in Excel-to-PDF conversion. However, there might be a requirement for substituting a different font or the same font for the unsupported font during the conversion. XlsIO supports substituting unsupported or missing fonts through the event [SubstituteFont](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_SubstituteFont). The event has the below arguments: +By default, XlsIO substitutes unsupported fonts with **Microsoft Sans Serif** during Excel-to-PDF conversion. If you need a different fallback, subscribe to the [SubstituteFont](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IApplication.html#Syncfusion_XlsIO_IApplication_SubstituteFont) event on `IApplication`. The event handler receives the following arguments: -**AlternateFontName** – Substitutes an available font in the machine for the [OriginalFontName](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.Implementation.SubstituteFontEventArgs.html#Syncfusion_XlsIO_Implementation_SubstituteFontEventArgs_OriginalFontName). -**AlternateFontStream** – Substitutes a font from stream that is added as embedded resource for the [OriginalFontName](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.Implementation.SubstituteFontEventArgs.html#Syncfusion_XlsIO_Implementation_SubstituteFontEventArgs_OriginalFontName). +| Argument | Type | Description | +| --- | --- | --- | +| [OriginalFontName](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.Implementation.SubstituteFontEventArgs.html#Syncfusion_XlsIO_Implementation_SubstituteFontEventArgs_OriginalFontName) | `string` | Name of the font in the workbook that is not installed on the machine. Read-only. | +| AlternateFontName | `string` | Name of an installed font to substitute. Use this when an equivalent system font is available. | +| AlternateFontStream | `Stream` | Font stream (for example, an embedded-resource `.ttf`) to substitute. Use this when no installed font is available. | The following code illustrates how to perform Excel-to-PDF conversion by substituting unsupported fonts in the machine. @@ -849,11 +852,11 @@ End Namespace In Linux OS, the Excel to PDF conversion can be performed using .NET Core (Targeting .NET core app) application. Please refer [Excel to PDF conversion NuGet packages](https://help.syncfusion.com/document-processing/excel/excel-library/net/nuget-packages-required#converting-excel-document-into-pdf) to know about the packages required to deploy .NET Core (Targeting .NET core app) application with Excel to PDF conversion capabilities. -In addition to the previous NuGet packages, SkiaSharp.Linux helper NuGet package is required, that can be generated by the following steps: +In addition to the previous NuGet packages, the SkiaSharp.Linux helper NuGet package is required. It can be generated with the following steps: -1. Download libSkiaSharp.so [here](https://github.com/mono/SkiaSharp/releases/tag/v3.119.1#). -2. Create a folder and name it as SkiaSharp.Linux and place the downloaded file in the folder structure "SkiaSharp.Linux\runtimes\linux-x64\native" -3. Create a nuspec file with name SkiaSharp.Linux.nuspec using the following metadata information and place it inside SkiaSharp.Linux folder. The nuspec file can be customized. +1. Download `libSkiaSharp.so` from the [SkiaSharp release page](https://github.com/mono/SkiaSharp/releases/tag/v3.119.1). The native binary should be placed in the folder structure `SkiaSharp.Linux/runtimes/linux-x64/native/libSkiaSharp.so` (the filename must be exactly `libSkiaSharp.so`). +2. Create a folder named `SkiaSharp.Linux` containing the `runtimes/linux-x64/native/libSkiaSharp.so` file from step 1. +3. Create a nuspec file named `SkiaSharp.Linux.nuspec` inside the `SkiaSharp.Linux` folder using the following metadata. The nuspec can be customized. {% tabs %} {% highlight XML %} @@ -892,9 +895,9 @@ Now, SkiaSharp.Linux NuGet will be generated in the mentioned output directory a ## Print Excel document -XlsIO supports Excel printing option by converting Excel To PDF and printing that PDF document. The Excel can be printed with specified page setup and printer settings in XlsIO. +XlsIO supports printing Excel documents by first converting them to PDF and then sending the PDF to the printer. An Excel document can be printed with the specified page setup and printer settings in XlsIO. -The following printer settings can be applied to print Excel in XlsIO. +The following printer settings can be applied when printing an Excel document. ![Printer settings](Excel-to-PDF-Conversion_images/Excel-to-PDF-Conversion_img1.jpg) @@ -908,7 +911,7 @@ The following code snippet illustrates how to print the Excel document in XlsIO. {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -Using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; @@ -948,7 +951,7 @@ The following code snippet illustrates how to print the Excel document with prin {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -Using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; @@ -960,6 +963,7 @@ Using(ExcelEngine excelEngine = new ExcelEngine()) //Initialize the printer settings PrinterSettings printerSettings = new PrinterSettings(); + //customizing the printer settings printerSettings.PrinterName = "HP LaserJet Pro MFP M127-M128 PCLmS"; printerSettings.Copies = 2; @@ -1009,7 +1013,7 @@ The following code snippet illustrates how to print the Excel document with Exce {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -Using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; @@ -1062,7 +1066,7 @@ The following code snippet illustrates how to print the Excel document with Exce {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -Using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; @@ -1173,11 +1177,11 @@ using (ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { - IApplication application = excelEngine.Excel; - application.DefaultVersion = ExcelVersion.Xlsx; - IWorkbook workbook = application.Workbooks.Open("Sample.xlsx"); + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open("Sample.xlsx"); //Convert Excel document into PDF document ExcelToPdfConverter converter = new ExcelToPdfConverter(workbook); @@ -1697,4 +1701,12 @@ The following list contains unsupported elements that presently not preserved in * OLE objects -N> Explore our [.NET Excel Library](https://www.syncfusion.com/document-processing/excel-framework/net) Feature Tour page and [.Net Excel Framework demo](https://www.syncfusion.com/demos/fileformats/excel-library) that shows how to create and modify Excel files from C# with 5 lines of code on different platforms. +N> Explore our [.NET Excel Library](https://www.syncfusion.com/document-processing/excel-framework/net) Feature Tour page and [.NET Excel Framework demo](https://www.syncfusion.com/demos/fileformats/excel-library) that shows how to create and modify Excel files from C# with 5 lines of code on different platforms. + +## Next Steps + +* [Excel to PDF Converter Settings](excel-to-pdf-converter-settings) \u2014 customize layout, embedding, and image quality. +* [Assemblies Required for Excel to PDF conversion](assemblies-required-for-excel-to-pdf) \u2014 manual assembly references for non-NuGet scenarios. +* [NuGet Packages Required for Excel to PDF conversion](nuget-packages-required-for-excel-to-pdf) \u2014 install the right package for your target platform. +* [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) \u2014 register your license key. + diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Excel-to-PDF-Converter-Settings.md b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Excel-to-PDF-Converter-Settings.md index 1233d37877..575b14b424 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Excel-to-PDF-Converter-Settings.md +++ b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Excel-to-PDF-Converter-Settings.md @@ -12,9 +12,9 @@ XlsIO allows you to convert an entire workbook or a single worksheet into PDF do ## Auto-detect Complex Script -This property enables the complex script validation for the text present in Excel document and renders it into PDF document. It's default value is FALSE. +This property enables complex-script validation for text in the Excel document so that scripts such as Arabic, Hebrew, and Thai are rendered correctly in the PDF. Its default value is **false**. -The following complete code snippet explains how to enable [AutoDetectComplexScript](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_AutoDetectComplexScript) property while converting an Excel document to PDF. +The following code snippet explains how to enable the [AutoDetectComplexScript](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_AutoDetectComplexScript) property while converting an Excel document to PDF. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20PDF/Complex%20Script%20to%20PDF/.NET/Complex%20Script%20to%20PDF/Complex%20Script%20to%20PDF/Program.cs,180" %} @@ -95,7 +95,7 @@ A complete working example to detect complex script in Excel to PDF conversion i ## Custom Paper Size -This property helps to set the required paper size in inches. The default value is empty(i.e.,{Width = 0.0 Height = 0.0}). +This property sets the required paper size, in inches. The default value is `SizeF.Empty` (that is, `Width = 0.0f`, `Height = 0.0f`). The following complete code snippet explains how to set [CustomPaperSize](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_CustomPaperSize) while converting Excel document to PDF. @@ -110,7 +110,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Initialize XlsIORendererSettings XlsIORendererSettings settings = new XlsIORendererSettings(); - //Set CustomerPaperSize + //Set CustomPaperSize settings.CustomPaperSize = new SizeF(10, 20); //Initialize XlsIORenderer @@ -136,7 +136,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Initialize ExcelToPdfConverterSettings ExcelToPdfConverterSettings settings = new ExcelToPdfConverterSettings(); - //Set CustomerPaperSize + //Set CustomPaperSize settings.CustomPaperSize = new SizeF(10, 20); //Load the Excel document into ExcelToPdfConverter @@ -159,7 +159,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() 'Initialize ExcelToPdfConverterSettings Dim settings As ExcelToPdfConverterSettings = New ExcelToPdfConverterSettings() - 'Set CustomerPaperSize + 'Set CustomPaperSize settings.CustomPaperSize = New SizeF(10, 20) 'Load the Excel document into ExcelToPdfConverter @@ -178,11 +178,11 @@ A complete working example to convert Excel to PDF with custom paper size in C# ## Display Gridlines -This property helps to set the gridlines display style in Excel to PDF converted document. Three display styles are **Auto**, **Invisible** and **Visible**. These are maintained under [GridLinesDisplayStyle](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.GridLinesDisplayStyle.html) enumeration. +This property sets the gridline display style in the output PDF document. Three display styles are available on the [GridLinesDisplayStyle](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.GridLinesDisplayStyle.html) enumeration: **Auto**, **Invisible**, and **Visible**. ### Auto -Gridlines will not be rendered in the output PDF document, when display style is selected as **Auto**. Its default value is Invisible. The following code snippet explains how to select **Auto** display style for gridlines. +When the display style is set to **Auto**, gridlines are not rendered in the output PDF. The default value of `DisplayGridLines` is **Auto**. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} @@ -258,7 +258,7 @@ End Using ### Invisible -Gridlines will not be rendered in the output PDF document, when display style is selected as **Invisible**. The following code snippet explains how to select **Invisible** display style for gridlines. +When the display style is set to **Invisible**, gridlines are not rendered in the output PDF. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} @@ -334,7 +334,7 @@ End Using ### Visible -Gridlines will be rendered in the output PDF document, when display style is selected as **Visible**. The following code snippet explains how to select **Visible** display style for gridlines. +When the display style is set to **Visible**, gridlines are rendered in the output PDF. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20PDF/Gridlines%20in%20PDF/.NET/Gridlines%20in%20PDF/Gridlines%20in%20PDF/Program.cs,180" %} @@ -347,7 +347,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Initialize XlsIORendererSettings XlsIORendererSettings settings = new XlsIORendererSettings(); - //Set the gridlines display style as Invisible. Available options are Auto, Visible, Invisible + //Set the gridlines display style as Visible. Available options are Auto, Visible, Invisible settings.DisplayGridLines = GridLinesDisplayStyle.Visible; //Initialize XlsIORenderer @@ -415,7 +415,7 @@ A complete working example to hide gridlines in Excel to PDF conversion in C# is ## Embed Fonts -The Excel content will be rendered improperly when Arial Unicode MS Font is missing in the machine. In this case, enabling the [EmbedFonts](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_EmbedFonts) property renders the content properly. +When the Arial Unicode MS font is missing from the machine, Excel content is rendered incorrectly. Set [EmbedFonts](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_EmbedFonts) to **true** to embed the referenced fonts into the output PDF (default is **false**). Note that embedding fonts increases the output PDF size. The following code snippet explains how to enable **EmbedFonts** property. @@ -498,7 +498,7 @@ A complete working example to embed fonts in Excel to PDF conversion in C# is pr ## Export Bookmarks -The default value of [ExportBookmarks](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_ExportBookmarks) property is TRUE and hence bookmarks are exported to PDF document by default, in Excel to PDF conversion. Disabling this property skips the bookmarks in conversion. +The default value of the [ExportBookmarks](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_ExportBookmarks) property is **true**, so workbook and worksheet bookmarks are exported to the PDF by default. Set it to **false** to skip the bookmarks during conversion. The following code snippet explains how to disable **ExportBookmarks** property. @@ -664,7 +664,7 @@ A complete working example to export document properties in Excel to PDF convers ## Export Quality Image -The default value of [ExportQualityImage](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_ExportQualityImage) if FALSE. Enabling this property exports quality image to PDF document. +The default value of [ExportQualityImage](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_ExportQualityImage) is **false**. Set it to **true** to render images at higher DPI in the output PDF (at the cost of larger file size). The following complete code snippet explains how to enable **ExportQualityImage** property. @@ -747,11 +747,11 @@ A complete working example to export quality image in Excel to PDF conversion in ## Header Footer Option -Two properties available under [HeaderFooterOption](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_HeaderFooterOption) are **ShowHeader** and **ShowFooter**. +The [HeaderFooterOption](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_HeaderFooterOption) class exposes two properties: **ShowHeader** and **ShowFooter**. ### Show Header -Document header will be rendered to PDF document by default. This can be skipped by disabling the [ShowHeader](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.HeaderFooterOption.html#Syncfusion_ExcelToPdfConverter_HeaderFooterOption_ShowHeader) property. +The worksheet header is rendered in the PDF by default. Set the [ShowHeader](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.HeaderFooterOption.html#Syncfusion_ExcelToPdfConverter_HeaderFooterOption_ShowHeader) property to **false** to hide it. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" %} @@ -827,7 +827,7 @@ End Using ### Show Footer -Document footer will be rendered to PDF document by default. This can be skipped by disabling the [ShowFooter](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.HeaderFooterOption.html#Syncfusion_ExcelToPdfConverter_HeaderFooterOption_ShowFooter) property. +The worksheet footer is rendered in the PDF by default. Set the [ShowFooter](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.HeaderFooterOption.html#Syncfusion_ExcelToPdfConverter_HeaderFooterOption_ShowFooter) property to **false** to hide it. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20PDF/Show%20Header%20Footer%20in%20PDF/.NET/Show%20Header%20Footer%20In%20PDF/Show%20Header%20Footer%20In%20PDF/Program.cs,180" %} @@ -911,7 +911,7 @@ A complete working example to show or hide header and footer in Excel to PDF con ## Convert Blank Page -Blank pages in Excel document are rendered to PDF document by default, in Excel to PDF conversion. This blank pages can be skipped by disabling the [IsConvertBlankPage](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_IsConvertBlankPage) property. +Blank pages in the Excel document are rendered in the PDF by default. Set [IsConvertBlankPage](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_IsConvertBlankPage) to **false** to skip them. The following code snippet explains this. @@ -994,7 +994,7 @@ A complete working example to convert blank page to PDF in C# is present on [thi ## Convert Blank Sheet -Blank worksheets in Excel document are rendered to PDF document by default, in Excel to PDF conversion. This blank worksheets can be skipped by disabling the [IsConvertBlankSheet](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_IsConvertBlankSheet) property. +Blank worksheets are rendered in the PDF by default. Set [IsConvertBlankSheet](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_IsConvertBlankSheet) to **false** to skip them. The following code snippet explains this. @@ -1077,11 +1077,20 @@ A complete working example to convert blank sheet to PDF in C# is present on [th ## Layout Options -This property helps to select the layout option for the Excel document in Excel to PDF conversion. Five layout options available and maintained under [LayoutOptions](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_LayoutOptions) enumeration are **Automatic**, **CustomScaling**, **FitAllColumnsOnOnePage**, **FitAllRowsOnOnePage**, **FitSheetOnOnePage** and **NoScaling**. +This property selects the page layout applied to the worksheet during Excel to PDF conversion. Six values are available on the [LayoutOptions](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_LayoutOptions) enumeration: **Automatic**, **CustomScaling**, **FitAllColumnsOnOnePage**, **FitAllRowsOnOnePage**, **FitSheetOnOnePage**, and **NoScaling**. + +| Value | Effect on the output PDF | +| --- | --- | +| `Automatic` | The converter picks the best fit. **This is the default.** | +| `CustomScaling` | Uses the zoom value configured in the worksheet's page setup. | +| `FitAllColumnsOnOnePage` | All columns are rendered on a single PDF page. | +| `FitAllRowsOnOnePage` | All rows are rendered on a single PDF page. | +| `FitSheetOnOnePage` | Each worksheet is rendered on a single PDF page. | +| `NoScaling` | Worksheets are printed at their actual size. | ### Automatic -Selecting **Automatic** under [LayoutOptions](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_LayoutOptions) prints the worksheets at their actual size. It's default value is **NoScaling**. The following code snippet explains how to select the layout option as **Automatic**. +Selecting **Automatic** under [LayoutOptions](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_LayoutOptions) lets the converter choose the best fit for the worksheet. Its default value is **Automatic**. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20PDF/Automatic%20Layout/.NET/Automatic%20Layout/Automatic%20Layout/Program.cs,180" %} @@ -1162,7 +1171,7 @@ A complete working example to convert Excel to PDF with automatic layout in C# i ### Custom Scaling -Selecting **CustomScaling** under [LayoutOptions](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_LayoutOptions) prints the worksheets at specified scaling, i.e., zoom value set in under page setup. The following code snippet explains how to use this. +Selecting **CustomScaling** under [LayoutOptions](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_LayoutOptions) uses the zoom value configured in the worksheet's page setup. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20PDF/Custom%20Scaling/.NET/Custom%20Scaling/Custom%20Scaling/Program.cs,180" %} @@ -1405,7 +1414,7 @@ A complete working example to convert Excel to PDF with fit all rows on one page ### Fit Sheet On One Page -Selecting **FitSheetOnOnePage** under [LayoutOptions](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_LayoutOptions) renders every single worksheet in Excel workbook into, single PDF page. The following code snippet explains how to select the layout option as **FitSheetOnOnePage**. +Selecting **FitSheetOnOnePage** under [LayoutOptions](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_LayoutOptions) renders each worksheet on a single PDF page. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20PDF/Fit%20Sheet%20On%20One%20Page/.NET/Fit%20Sheet%20On%20One%20Page/Fit%20Sheet%20On%20One%20Page/Program.cs,180" %} @@ -1567,14 +1576,14 @@ A complete working example to convert Excel to PDF with no scaling in C# is pres ## PDF Conformance Level -Excel to PDF converter settings allows you to set the PDF conformance level. Excel to PDF currently supports following PDF conformances. -* PDF/A-1b conformance -* PDF/X-1a conformance +Excel to PDF converter settings allow you to set the PDF conformance level. XlsIO currently supports the following conformances: + +* **PDF/A-1b** — for long-term archiving. +* **PDF/X-1a** — for print production workflows. -N> 1. For more details about PDF conformance, [click here.](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/working-with-pdf-conformance) -N> 2. Pdf_X1A2001 is not supported for NETStandard. +N> NOTE: For more information about PDF conformance, see [Working with PDF Conformance](https://help.syncfusion.com/document-processing/pdf/pdf-library/net/working-with-pdf-conformance). The `Pdf_X1A2001` value is not supported on .NET Standard (use the .NET Framework `ExcelToPdfConverter` or the cross-platform `XlsIORenderer` with the `*.NET` NuGet package instead). -The following code illustrates how to set the [PdfConformanceLevel](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_PdfConformanceLevel) while converting Excel workbook to PDF. +The following code illustrates how to set the [PdfConformanceLevel](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_PdfConformanceLevel) while converting an Excel workbook to PDF. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20PDF/PDF%20Conformance/.NET/PDF%20Conformance/PDF%20Conformance/Program.cs,180" %} @@ -1604,7 +1613,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) {% endhighlight %} {% highlight c# tabtitle="C# [Windows-specific]" %} -using(ExcelEngine excelEngine = new ExcelEngine()) +using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Excel2013; @@ -1748,7 +1757,7 @@ Using excelEngine As ExcelEngine = New ExcelEngine() newDocument = converter2.Convert(settings) 'Save the PDF document - document.Save("Output.pdf") + newDocument.Save("Output.pdf") End Using {% endhighlight %} {% endtabs %} @@ -1812,8 +1821,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Load the first worksheet into ExcelToPdfConverter ExcelToPdfConverter converter1 = new ExcelToPdfConverter(worksheet1); - //Initailize PdfDocument - PdfDocument document = new PdfDocument(); + //Convert the first worksheet; the result becomes the TemplateDocument for the next conversion. + PdfDocument document = converter1.Convert(); //Initailize ExcelToPdfConverterSettings ExcelToPdfConverterSettings settings = new ExcelToPdfConverterSettings(); @@ -1821,9 +1830,6 @@ using (ExcelEngine excelEngine = new ExcelEngine()) //Set the PdfDocument to TemplateDocument in ExcelToPdfConverterSettings settings.TemplateDocument = document; - //Convert the worksheet with settings - document = converter1.Convert(settings); - //Get the third worksheet IWorksheet worksheet3 = workbook.Worksheets[2]; @@ -1852,8 +1858,8 @@ Using excelEngine As ExcelEngine = New ExcelEngine() 'Load the first worksheet into ExcelToPdfConverter Dim converter1 As ExcelToPdfConverter = New ExcelToPdfConverter(worksheet1) - 'Initailize PdfDocument - Dim document As PdfDocument = New PdfDocument() + 'Convert the first worksheet; the result becomes the TemplateDocument for the next conversion. + Dim document As PdfDocument = converter1.Convert() 'Initailize ExcelToPdfConverterSettings Dim settings As ExcelToPdfConverterSettings = New ExcelToPdfConverterSettings() @@ -1861,9 +1867,6 @@ Using excelEngine As ExcelEngine = New ExcelEngine() 'Set the PdfDocument to TemplateDocument in ExcelToPdfConverterSettings settings.TemplateDocument = document - 'Convert the worksheet with settings - document = converter1.Convert(settings) - 'Get the third worksheet Dim worksheet3 As IWorksheet = workbook.Worksheets(2) @@ -1883,7 +1886,7 @@ A complete working example to convert selected worksheets to PDF in C# is presen ## Tagged PDF -An accessible tagged PDF includes structured tags for elements like text, tables, and images, enhancing accessibility and navigation. These tags ensure that users who rely on assistive technologies can effectively read and interact with the PDF content, meeting the accessibility requirements outlined by Section 508 and PDF/UA. +An accessible tagged PDF includes structured tags for elements like text, tables, and images, enhancing accessibility and navigation. These tags ensure that users who rely on assistive technologies can effectively read and interact with the PDF content, meeting the accessibility requirements outlined by Section 508 and PDF/UA. By default, the output PDF is **not** tagged; set the `AutoTag` property to **true** to enable tagging. The following complete code snippet explains how to preserve PDF document tags using **AutoTag** property while converting an Excel document to PDF. @@ -1964,7 +1967,7 @@ End Using ## Throw When Excel File Is Empty -The default value of [ThrowWhenExcelFileIsEmpty](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_ThrowWhenExcelFileIsEmpty) property is FALSE, and hence the empty Excel document will be converted to PDF without any exception. Enabling this property throws **ExcelToPdfConverterException**, saying that the Excel document is Empty. +The default value of [ThrowWhenExcelFileIsEmpty](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_ThrowWhenExcelFileIsEmpty) is **false**; with the default value, an empty workbook is converted to a PDF without any exception. When set to **true**, the converter throws an `ExcelToPdfConverterException` if the workbook has no worksheets. Catch this exception at the call site to handle the empty-workbook case. The following code snippet explains this. @@ -2046,13 +2049,15 @@ A complete working example to through exception when file is empty in Excel to P ## Capture Warnings in Excel-to-PDF Conversion -XlsIO intentionally skips unsupported elements and substitutes unsupported fonts. The elements that were not converted and the fonts that were intentionally substituted can be raised as warnings, to decide whether to proceed the conversion with the warnings or to stop the conversion. +XlsIO intentionally skips unsupported elements and substitutes unsupported fonts. The unsupported elements and substituted fonts are surfaced as warnings, so you can choose whether to continue or stop the conversion. -It is recommended to implement [IWarning](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWarning.html) interface in a supporting class. The interface holds the properties, -* **Type** – the element that failed to convert -* **Description** – the description of the failed element +It is recommended to implement the [IWarning](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWarning.html) interface in a supporting class. The interface exposes the following members: -In addition, a decision to continue the conversion process can be done here by setting boolean value to the property [Cancel](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWarning.html#Syncfusion_XlsIO_IWarning_Cancel). If **Cancel** is set to TRUE the conversion cancels, else the conversion continues. +| Member | Type | Description | +| --- | --- | --- | +| [Type](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.WarningInfo.html#Syncfusion_XlsIO_WarningInfo_Type) | `WarningType` | The element that failed to convert. | +| [Description](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.WarningInfo.html#Syncfusion_XlsIO_WarningInfo_Description) | `string` | A human-readable description of the failed element. | +| [Cancel](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWarning.html#Syncfusion_XlsIO_IWarning_Cancel) | `bool` | Set to **true** to stop the conversion when the warning is raised; **false** (default) to continue. | N> Currently, warnings are captured only for elements that are supported during Excel document creation but not during Excel to PDF conversion. Features that are unsupported during Excel document creation itself are not captured by XlsIO. @@ -2129,7 +2134,7 @@ namespace CaptureWarnings { static void Main(string[] args) { - using(ExcelEngine excelEngine = new ExcelEngine()) + using (ExcelEngine excelEngine = new ExcelEngine()) { IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Excel2013; @@ -2151,10 +2156,11 @@ namespace CaptureWarnings PdfDocument pdfDocument = converter.Convert(settings); //If conversion process canceled null returned. - if(pdfDocument != null) - - //Save the PDF file. - pdfDocument.Save("ExcelToPDF.pdf"); + if (pdfDocument != null) + { + //Save the PDF file. + pdfDocument.Save("ExcelToPDF.pdf"); + } } } } @@ -2208,9 +2214,9 @@ Namespace CaptureWarnings 'If conversion process canceled null returned. If pdfDocument IsNot Nothing Then - - 'Save the PDF file. - pdfDocument.Save("ExcelToPDF.pdf") + 'Save the PDF file. + pdfDocument.Save("ExcelToPDF.pdf") + End If End Using End Sub End Class @@ -2238,9 +2244,9 @@ A complete working example to skip warning in Excel to PDF in C# is present on [ ## Show File Name -This property allows you to display the file name along with its extension in the header and/or footer when converting an Excel document to PDF. It's default value is FALSE. +This property allows you to display the file name along with its extension in the header and/or footer when converting an Excel document to PDF. Its default value is **false**. -The following code snippet explains how to enable the ShowFileNameWithExtension property during Excel to PDF conversion. +The following code snippet explains how to enable the [ShowFileNameWithExtension](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_ShowFileNameWithExtension) property during Excel to PDF conversion. {% tabs %} {% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Excel%20to%20PDF/Show%20file%20name%20with%20extension%20in%20PDF/.NET/ShowFileNameWithExtension/ShowFileNameWithExtension/Program.cs,180" %} @@ -2317,7 +2323,14 @@ End Using {% endhighlight %} {% endtabs%} -A complete working example demonstrating how to enable the ShowFileNameWithExtension property during Excel to PDF conversion in C# is present on this GitHub page. +A complete working example demonstrating how to enable the [ShowFileNameWithExtension](https://help.syncfusion.com/cr/document-processing/Syncfusion.ExcelToPdfConverter.ExcelToPdfConverterSettings.html#Syncfusion_ExcelToPdfConverter_ExcelToPdfConverterSettings_ShowFileNameWithExtension) property during Excel to PDF conversion in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Excel%20to%20PDF/Show%20file%20name%20with%20extension%20in%20PDF/.NET/ShowFileNameWithExtension). + +## See also + +* [Excel to PDF conversion guide](excel-to-pdf-conversion) — workbook/worksheet/chart conversion basics. +* [Assemblies Required for Excel to PDF conversion](assemblies-required-for-excel-to-pdf) — manual assembly references for non-NuGet scenarios. +* [NuGet Packages Required for Excel to PDF conversion](nuget-packages-required-for-excel-to-pdf) — install the right package for your target platform. +* [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) — register your license key. ## Enable Form Fields @@ -2400,4 +2413,4 @@ End Using {% endhighlight %} {% endtabs %} -A complete working sample to enable form fields in Excel to PDF conversion in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/EnableFormFields/Excel%20to%20PDF/EnableFormFields/.NET/EnableFormFields). +A complete working sample to enable form fields in Excel to PDF conversion in C# is present on [this GitHub page](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/EnableFormFields/Excel%20to%20PDF/EnableFormFields/.NET/EnableFormFields). \ No newline at end of file diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/NuGet-Packages-Required-for-Excel-to-PDF.md b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/NuGet-Packages-Required-for-Excel-to-PDF.md index 6e4d8c01fa..83f367635b 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/NuGet-Packages-Required-for-Excel-to-PDF.md +++ b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/NuGet-Packages-Required-for-Excel-to-PDF.md @@ -1,16 +1,17 @@ --- title: NuGet Packages for Excel to PDF | Syncfusion -description: This section illustrates the NuGet packages required to perform Excel to PDF conversion in various platforms and frameworks. +description: Lists the NuGet packages required to perform Excel to PDF conversion on various .NET platforms and frameworks. platform: document-processing control: XlsIO documentation: UG --- -# NuGet Packages Required for Excel to PDF conversion +# NuGet Packages Required for Excel to PDF Conversion -## Converting Excel document to PDF +## Converting an Excel Workbook to PDF + +To convert an Excel workbook to PDF, install the NuGet package that matches your target platform and framework. -For converting Excel document into PDF, the following NuGet packages need to be installed in your application. diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Overview-of-Excel-to-PDF.md b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Overview-of-Excel-to-PDF.md index 5e6c989313..3c1ab3a08e 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Overview-of-Excel-to-PDF.md +++ b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Overview-of-Excel-to-PDF.md @@ -1,21 +1,48 @@ --- -title: Overview of Syncfusion Excel to PDF(XlsIO) library | Syncfusion -description: Essential XlsIO is a .NET Excel Library to create, read, edit & convert Excel file without Microsoft Office dependencies. +title: Convert Excel to PDF using the .NET Excel (XlsIO) Library | Syncfusion +description: The Syncfusion .NET Excel (XlsIO) library is a non-UI Excel library used to create, read, edit, and convert Excel files to PDF in Windows Forms, WPF, UWP, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Core, Xamarin, Blazor, WinUI, and .NET MAUI applications without Microsoft Office dependencies. platform: document-processing control: XlsIO documentation: UG --- -# Convert Excel to PDF using .NET Excel Library -The [Syncfusion .NET Excel (XlsIO) library](https://www.syncfusion.com/document-processing/excel-framework/net) provides the easiest way for converting Excel documents to PDF in C#/VB.NET with the PDF conformance level PDF/A1B using just a few lines of code. This process is fast, reliable, and supported in hosting environments such as AWS, Google Cloud App, and Microsoft Azure web services. +# Convert Excel to PDF using .NET Excel (XlsIO) Library -The library can be used in Windows Forms, WPF, UWP, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Core, Xamarin, Blazor, WinUI and .NET MAUI applications. +The [Syncfusion .NET Excel (XlsIO) library](https://www.syncfusion.com/document-processing/excel-framework/net) is a non-UI, native .NET class library that provides an easy way to convert Excel workbooks to PDF in C# and VB.NET with the PDF conformance level PDF/A1B using just a few lines of code. The conversion is fast and reliable, requires no Microsoft Office dependency, and is supported in hosting environments such as AWS, Google Cloud, and Microsoft Azure. -**Key Features** +The library can be used in Windows Forms, WPF, UWP, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Core, Xamarin, Blazor, WinUI, and .NET MAUI applications. -* Ability to convert Excel [workbook to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#workbook-to-pdf). -* Ability to convert Excel workbook with [chart to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#excel-with-chart-to-pdf). -* [Font substitution](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#substitute-font-in-excel-to-pdf-conversion) during Excel to PDF. -* Ability to convert Excel to PDF with different [conversion options](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-converter-settings). +## Prerequisites -N> You can also explore our [.Net Excel Framework demo](https://www.syncfusion.com/demos/fileformats/excel-library) that shows how to create, modify and convert Excel files from C# with 5 lines of code on different platforms. +Before converting an Excel workbook to PDF, make sure the following are in place: + +1. Install the required NuGet packages for your target platform. + - For .NET 8+ / .NET Core: `Syncfusion.XlsIO.Net.Core` and `Syncfusion.Pdf.Net.Core` + - For Windows Forms: `Syncfusion.XlsIO.WinForms` and `Syncfusion.Pdf.WinForms` + - For WPF: `Syncfusion.XlsIO.Wpf` and `Syncfusion.Pdf.Wpf` + - For ASP.NET Core: `Syncfusion.XlsIO.AspNet.Core` and `Syncfusion.Pdf.AspNet.Core` +2. Register your Syncfusion license in the application. For more information, see [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). +3. Add the required namespaces to your code file: + +```csharp +using Syncfusion.XlsIO; +using Syncfusion.Pdf; +``` + +## Supported Platforms + +* Windows Forms, WPF, UWP, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Core, Xamarin, Blazor, WinUI, and .NET MAUI +* Hosting environments: AWS, Google Cloud, and Microsoft Azure +* .NET versions: .NET Framework 4.6.1+, .NET Core 8, and later + +> IMPORTANT: On Linux and macOS, the conversion relies on **System.Drawing.Common** for rendering charts and shapes. Install the [libgdiplus](https://learn.microsoft.com/dotnet/core/install/linux-scripted-manual#libgdiplus) native library and add `` to your project. Without this, chart-to-PDF conversion will fail at runtime. + +## Key Features + +* Convert an Excel [workbook to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#workbook-to-pdf). +* Convert an Excel workbook with a [chart to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#excel-with-chart-to-pdf). +* Support for [font substitution](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#substitute-font-in-excel-to-pdf-conversion) during Excel to PDF conversion. +* Generate PDF documents with **PDF/A1B** conformance for long-term archiving. +* Configure conversion behavior with [converter settings](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-converter-settings) such as `EmbedFonts`, `ImageQuality`, `TemplateDocument`, and `PageScalingOptions`. + +N> You can also explore our [.NET Excel Framework demo](https://www.syncfusion.com/demos/fileformats/excel-library) that shows how to create, modify, and convert Excel files from C# with 5 lines of code on different platforms. diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Performance-Metrics.md b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Performance-Metrics.md index 668b159d9e..dd07150c4e 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Performance-Metrics.md +++ b/Document-Processing/Excel/Conversions/Excel-to-PDF/NET/Performance-Metrics.md @@ -1,6 +1,6 @@ --- -title: Performance Metrics for the Syncfusion Excel to PDF conversion -description: This section provides benchmark results and performance metrics for converting Excel files to PDF using the Syncfusion Excel (XlsIO) library. +title: Performance Metrics for Syncfusion Excel to PDF Conversion +description: This section lists benchmark results for converting Excel workbooks to PDF using the Syncfusion Excel (XlsIO) library. platform: document-processing control: XlsIO documentation: UG @@ -8,39 +8,73 @@ documentation: UG # Performance Metrics for Excel to PDF Conversion -The following benchmark demonstrates the performance of the Syncfusion Excel (XlsIO) library when converting a large Excel workbook—containing 100,000 rows and 50 columns with distinct data types such as text, date and time, numbers, booleans, and formulas—into a PDF. +The following benchmark measures the time required by the Syncfusion Excel (XlsIO) library to convert a workbook of 100,000 rows × 50 columns to PDF. Each row uses one data type: text, DateTime, number, boolean, or formula. + +> IMPORTANT: Before running the samples on this page, install the [required NuGet package](nuget-packages-required-for-excel-to-pdf) and register your Syncfusion license key. For more information, see the [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview).
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Data typeTime Taken (sec)Sample Link
Text91GitHub page
DateTime105GitHub page
Number96GitHub page
Boolean81GitHub page
Formula104GitHub page
- -You can find the sample used for Excel to PDF conversion performance evaluation on this GitHub page. + + + Data type + Time (seconds) + Sample + + + + + Text + 91 + GitHub sample + + + DateTime + 105 + GitHub sample + + + Number + 96 + GitHub sample + + + Boolean + 81 + GitHub sample + + + Formula + 104 + GitHub sample + + + + +The samples above are also available in the [Performance Metrics parent folder](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Performance%20Metrics/Excel%20to%20PDF) on GitHub. + +## Test environment + +The benchmark was run on the following configuration: + +* **Operating system:** Windows 10 64-bit +* **.NET runtime:** .NET Framework 4.8 (Windows-specific `ExcelToPdfConverter`) +* **CPU:** Intel Core i7 (or equivalent x64) +* **Memory:** 16 GB RAM +* **Syncfusion version:** Essential Studio® v23.2.x +* **Build configuration:** Release with optimizations enabled + +> NOTE: Numbers are based on a single run, not a statistically averaged benchmark. Use them as a rough reference, not as a service-level agreement. + +## How to reproduce + +1. Install the [Syncfusion.ExcelToPdfConverter.Wpf](https://www.nuget.org/packages/Syncfusion.ExcelToPdfConverter.Wpf) NuGet package (or the platform-specific package for your target). +2. Register your license key by calling `Syncfusion.Licensing.SyncfusionLicenseProvider.RegisterLicense("YOUR_LICENSE_KEY")` at application startup. +3. Open the sample project that matches the data type you want to benchmark (see the **Sample** column above). +4. Build in **Release** configuration and run. The sample uses `System.Diagnostics.Stopwatch` to measure conversion time. + +## See also + +* [Excel to PDF conversion guide](excel-to-pdf-conversion) — workbook/worksheet/chart conversion basics. +* [Excel to PDF Converter Settings](excel-to-pdf-converter-settings) — customize layout, formatting, conformance, and accessibility. +* [Assemblies Required for Excel to PDF conversion](assemblies-required-for-excel-to-pdf) — manual assembly references. +* [NuGet Packages Required for Excel to PDF conversion](nuget-packages-required-for-excel-to-pdf) — install the right package for your target platform. +* [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview) — register your license key. diff --git a/Document-Processing/Excel/Conversions/Excel-to-PDF/overview.md b/Document-Processing/Excel/Conversions/Excel-to-PDF/overview.md index 54c03f7d77..3e85c691a1 100644 --- a/Document-Processing/Excel/Conversions/Excel-to-PDF/overview.md +++ b/Document-Processing/Excel/Conversions/Excel-to-PDF/overview.md @@ -1,24 +1,46 @@ --- -title: Overview of Syncfusion Excel to PDF(XlsIO) library | Syncfusion -description: XlsIO is a .NET Excel Library to create, read, edit & convert Excel file in WinForms, WPF, UWP, ASP.NET Core, ASP.NET MVC, Xamarin, Blazor, WinUI and .NET MAUI. +title: Convert Excel to PDF using the .NET Excel (XlsIO) Library | Syncfusion +description: The Syncfusion .NET Excel (XlsIO) library is a non-UI Excel library used to create, read, edit, and convert Excel files to PDF in Windows Forms, WPF, UWP, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Core, Xamarin, Blazor, WinUI, and .NET MAUI applications. platform: document-processing control: XlsIO documentation: UG --- -# Convert Excel to PDF using .NET Excel Library -The [Syncfusion .NET Excel (XlsIO) library](https://www.syncfusion.com/document-processing/excel-framework/net) provides the easiest way for converting Excel documents to PDF in C#/VB.NET with the PDF conformance level PDF/A1B using just a few lines of code. This process is fast, reliable, and supported in hosting environments such as AWS, Google Cloud App, and Microsoft Azure web services. +# Convert Excel to PDF using .NET Excel (XlsIO) Library -The library can be used in Windows Forms, WPF, UWP, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Core, Xamarin, Blazor, WinUI and .NET MAUI applications. +The [Syncfusion .NET Excel (XlsIO) library](https://www.syncfusion.com/document-processing/excel-framework/net) is a non-UI, native .NET class library that provides an easy way to convert Excel workbooks to PDF in C# and VB.NET with the PDF conformance level PDF/A1B using just a few lines of code. The conversion is fast and reliable, and is supported in hosting environments such as AWS, Google Cloud, and Microsoft Azure. -To quickly start converting an Excel document to a PDF, please check out this video: -{% youtube "https://www.youtube.com/watch?v=mMrGjypcSLw" %} +The library can be used in Windows Forms, WPF, UWP, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Core, Xamarin, Blazor, WinUI, and .NET MAUI applications. -**Key Features** +## Prerequisites -* Ability to convert Excel [workbook to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#workbook-to-pdf). -* Ability to convert Excel workbook with [chart to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#excel-with-chart-to-pdf). -* [Font substitution](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#substitute-font-in-excel-to-pdf-conversion) during Excel to PDF. -* Ability to convert Excel to PDF with different [conversion options](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-converter-settings). +Before converting an Excel workbook to PDF, make sure the following are in place: -N> You can also explore our [.Net Excel Framework demo](https://www.syncfusion.com/demos/fileformats/excel-library) that shows how to create, modify and convert Excel files from C# with 5 lines of code on different platforms. +1. Install the required NuGet packages for your target platform. + - For .NET Framework / .NET Core / .NET 5+: `Syncfusion.XlsIO.Net.Core` and `Syncfusion.Pdf.Net.Core` + - For Windows Forms: `Syncfusion.XlsIO.WinForms` and `Syncfusion.Pdf.WinForms` + - For WPF: `Syncfusion.XlsIO.Wpf` and `Syncfusion.Pdf.Wpf` + - For ASP.NET Core: `Syncfusion.XlsIO.AspNet.Core` and `Syncfusion.Pdf.AspNet.Core` +2. Register your Syncfusion license in the application. For more information, see [Licensing overview](https://help.syncfusion.com/document-processing/licensing/overview). +3. Add the required namespaces to your code file: + +```csharp +using Syncfusion.XlsIO; +using Syncfusion.Pdf; +``` + +## Supported Platforms + +* Windows Forms, WPF, UWP, ASP.NET Web Forms, ASP.NET MVC, ASP.NET Core, Xamarin, Blazor, WinUI, and .NET MAUI +* Hosting environments: AWS, Google Cloud, and Microsoft Azure +* .NET versions: .NET Framework 4.6.1+, .NET Core 8, and later + +## Key Features + +* Convert an Excel [workbook to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#workbook-to-pdf). +* Convert an Excel workbook with a [chart to PDF](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#excel-with-chart-to-pdf). +* Support for [font substitution](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-conversion#substitute-font-in-excel-to-pdf-conversion) during Excel to PDF conversion. +* Generate PDF documents with **PDF/A1B** conformance for long-term archiving. +* Configure conversion behavior with [converter settings](https://help.syncfusion.com/document-processing/excel/conversions/excel-to-pdf/net/excel-to-pdf-converter-settings) such as `EmbedFonts`, `ImageQuality`, `TemplateDocument`, and `PageScalingOptions`. + +N> You can also explore our [.NET Excel Framework demo](https://www.syncfusion.com/demos/fileformats/excel-library) that shows how to create, modify, and convert Excel files from C# with 5 lines of code on different platforms. diff --git a/Document-Processing/Excel/Conversions/Markdown-to-Excel/NET/Markdown-to-Excel-Conversion.md b/Document-Processing/Excel/Conversions/Markdown-to-Excel/NET/Markdown-to-Excel-Conversion.md index 22bc1b2a7c..d6495a10ac 100644 --- a/Document-Processing/Excel/Conversions/Markdown-to-Excel/NET/Markdown-to-Excel-Conversion.md +++ b/Document-Processing/Excel/Conversions/Markdown-to-Excel/NET/Markdown-to-Excel-Conversion.md @@ -1,6 +1,6 @@ --- title: Convert Markdown to Excel in C# | XlsIO | Syncfusion -description: Convert Markdown to Excel in C# using Syncfusion® .NET Excel (XlsIO) library without Microsoft Excel or interop dependencies +description: Lists how to convert a Markdown file to an Excel workbook using the Syncfusion .NET Excel (XlsIO) library, with no Microsoft Office or interop dependencies. platform: document-processing control: XlsIO documentation: UG @@ -8,11 +8,11 @@ documentation: UG # Markdown to Excel Conversion -Markdown is a lightweight markup language that adds formatting elements to plain text documents. The .NET Excel (XlsIO) library supports the conversion of Markdown to an Excel document and vice versa, which mostly follows the CommonMark specification and GitHub-flavored syntax. +Markdown is a lightweight markup language that adds formatting elements to plain text. XlsIO converts Markdown files to Excel workbooks and vice versa, with support for [CommonMark](https://commonmark.org/) and GitHub-flavored Markdown (tables, task lists, fenced code blocks, and inline images). ## Assemblies and NuGet packages required -Refer to the following links for assemblies and NuGet packages required based on platforms to convert a Markdown file to an Excel document using the .NET Excel Library (XlsIO). +For the assemblies and NuGet packages required to convert Markdown to Excel, see the per-platform lists below. * [Markdown to Excel conversion assemblies](https://help.syncfusion.com/document-processing/excel/excel-library/net/assemblies-required) * [Markdown to Excel conversion NuGet packages](https://help.syncfusion.com/document-processing/excel/excel-library/net/nuget-packages-required) @@ -31,7 +31,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - IWorkbook workbook = application.Workbooks.Open(@"Data/Sample.md", ExcelOpenType.Markdown); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Sample.md"), ExcelOpenType.Markdown); workbook.SaveAs(Path.GetFullPath("Output/MarkdownToExcel.xlsx")); } @@ -43,7 +43,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - IWorkbook workbook = application.Workbooks.Open(@"Data/Sample.md", ExcelOpenType.Markdown); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Sample.md"), ExcelOpenType.Markdown); workbook.SaveAs(Path.GetFullPath("Output/MarkdownToExcel.xlsx")); } @@ -54,7 +54,7 @@ Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx - Dim workbook As IWorkbook = application.Workbooks.Open("Sample.md", ExcelOpenType.Markdown) + Dim workbook As IWorkbook = application.Workbooks.Open(Path.GetFullPath("Sample.md"), ExcelOpenType.Markdown) workbook.SaveAs("MarkdownToExcel.xlsx") End Using @@ -79,10 +79,9 @@ using (ExcelEngine excelEngine = new ExcelEngine()) application.DefaultVersion = ExcelVersion.Xlsx; MdImportSettings settings = new MdImportSettings(); - settings.ImageNodeVisited += MdImportSettings_ImageNodeVisited; - IWorkbook workbook = application.Workbooks.Open(@"Data/Sample1.md", settings); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Sample1.md"), settings); workbook.SaveAs(Path.GetFullPath("Output/MarkdownToExcel.xlsx")); } @@ -95,10 +94,9 @@ using (ExcelEngine excelEngine = new ExcelEngine()) application.DefaultVersion = ExcelVersion.Xlsx; MdImportSettings settings = new MdImportSettings(); - settings.ImageNodeVisited += MdImportSettings_ImageNodeVisited; - IWorkbook workbook = application.Workbooks.Open(@"Data/Sample1.md", settings); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Sample1.md"), settings); workbook.SaveAs(Path.GetFullPath("Output/MarkdownToExcel.xlsx")); } @@ -112,7 +110,7 @@ Using excelEngine As New ExcelEngine() Dim settings As New MdImportSettings() AddHandler settings.ImageNodeVisited, AddressOf MdImportSettings_ImageNodeVisited - Dim workbook As IWorkbook = application.Workbooks.Open("Sample1.md", settings) + Dim workbook As IWorkbook = application.Workbooks.Open(Path.GetFullPath("Sample1.md"), settings) workbook.SaveAs("MarkdownToExcel.xlsx") End Using @@ -178,7 +176,7 @@ Private Sub MdImportSettings_ImageNodeVisited(sender As Object, args As MdImageN End Sub {% endhighlight %} -{% endtabs %} +{% endtabs %} You can download a complete working sample from this GitHub page. diff --git a/Document-Processing/Excel/Conversions/Markdown-to-Excel/overview.md b/Document-Processing/Excel/Conversions/Markdown-to-Excel/overview.md index 22bc1b2a7c..3ae702dacb 100644 --- a/Document-Processing/Excel/Conversions/Markdown-to-Excel/overview.md +++ b/Document-Processing/Excel/Conversions/Markdown-to-Excel/overview.md @@ -1,6 +1,6 @@ --- title: Convert Markdown to Excel in C# | XlsIO | Syncfusion -description: Convert Markdown to Excel in C# using Syncfusion® .NET Excel (XlsIO) library without Microsoft Excel or interop dependencies +description: Lists how to convert a Markdown file to an Excel workbook using the Syncfusion .NET Excel (XlsIO) library, with no Microsoft Office or interop dependencies. platform: document-processing control: XlsIO documentation: UG @@ -12,7 +12,7 @@ Markdown is a lightweight markup language that adds formatting elements to plain ## Assemblies and NuGet packages required -Refer to the following links for assemblies and NuGet packages required based on platforms to convert a Markdown file to an Excel document using the .NET Excel Library (XlsIO). +For the assemblies and NuGet packages required to convert Markdown to Excel, see the per-platform lists below. * [Markdown to Excel conversion assemblies](https://help.syncfusion.com/document-processing/excel/excel-library/net/assemblies-required) * [Markdown to Excel conversion NuGet packages](https://help.syncfusion.com/document-processing/excel/excel-library/net/nuget-packages-required) @@ -31,7 +31,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - IWorkbook workbook = application.Workbooks.Open(@"Data/Sample.md", ExcelOpenType.Markdown); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Sample.md"), ExcelOpenType.Markdown); workbook.SaveAs(Path.GetFullPath("Output/MarkdownToExcel.xlsx")); } @@ -43,7 +43,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) IApplication application = excelEngine.Excel; application.DefaultVersion = ExcelVersion.Xlsx; - IWorkbook workbook = application.Workbooks.Open(@"Data/Sample.md", ExcelOpenType.Markdown); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Sample.md"), ExcelOpenType.Markdown); workbook.SaveAs(Path.GetFullPath("Output/MarkdownToExcel.xlsx")); } @@ -54,7 +54,7 @@ Using excelEngine As New ExcelEngine() Dim application As IApplication = excelEngine.Excel application.DefaultVersion = ExcelVersion.Xlsx - Dim workbook As IWorkbook = application.Workbooks.Open("Sample.md", ExcelOpenType.Markdown) + Dim workbook As IWorkbook = application.Workbooks.Open(Path.GetFullPath("Sample.md"), ExcelOpenType.Markdown) workbook.SaveAs("MarkdownToExcel.xlsx") End Using @@ -79,10 +79,9 @@ using (ExcelEngine excelEngine = new ExcelEngine()) application.DefaultVersion = ExcelVersion.Xlsx; MdImportSettings settings = new MdImportSettings(); - settings.ImageNodeVisited += MdImportSettings_ImageNodeVisited; - IWorkbook workbook = application.Workbooks.Open(@"Data/Sample1.md", settings); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Sample1.md"), settings); workbook.SaveAs(Path.GetFullPath("Output/MarkdownToExcel.xlsx")); } @@ -95,10 +94,9 @@ using (ExcelEngine excelEngine = new ExcelEngine()) application.DefaultVersion = ExcelVersion.Xlsx; MdImportSettings settings = new MdImportSettings(); - settings.ImageNodeVisited += MdImportSettings_ImageNodeVisited; - IWorkbook workbook = application.Workbooks.Open(@"Data/Sample1.md", settings); + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Sample1.md"), settings); workbook.SaveAs(Path.GetFullPath("Output/MarkdownToExcel.xlsx")); } @@ -112,7 +110,7 @@ Using excelEngine As New ExcelEngine() Dim settings As New MdImportSettings() AddHandler settings.ImageNodeVisited, AddressOf MdImportSettings_ImageNodeVisited - Dim workbook As IWorkbook = application.Workbooks.Open("Sample1.md", settings) + Dim workbook As IWorkbook = application.Workbooks.Open(Path.GetFullPath("Sample1.md"), settings) workbook.SaveAs("MarkdownToExcel.xlsx") End Using @@ -178,7 +176,7 @@ Private Sub MdImportSettings_ImageNodeVisited(sender As Object, args As MdImageN End Sub {% endhighlight %} -{% endtabs %} +{% endtabs %} You can download a complete working sample from this GitHub page.