From 134348b84d5c1b3c0371effc5539f1a2a1da5ea3 Mon Sep 17 00:00:00 2001 From: KarthikaSF4773 Date: Thu, 18 Dec 2025 18:33:52 +0530 Subject: [PATCH] XlsIOMissingContentsHF --- Document-Processing-toc.html | 3 + .../NET/Chart-to-Image-Conversion.md | 44 ++-- .../Working-with-Cell-or-Range-Formatting.md | 46 ++++ .../NET/Working-with-Data-Validation.md | 29 +++ .../NET/Worksheet/Page-Setup-Options.md | 116 +++++++++- ...ate-read-edit-excel-files-in-aws-lambda.md | 12 +- ...ivot-tables-share-calculate-field-names.md | 204 ++++++++++++++++++ ...ge-count-before-Excel-to-PDF-conversion.md | 11 + ...t-chart-axis-minimum-and-maximum-values.md | 13 ++ ...it-row-and-column-sizes-based-on-images.md | 11 + ...le-calculated-field-headers-with-sum-of.md | 11 + ...rnal-links-when-converting-Excel-to-PDF.md | 11 + ...ncy-for-cell-background-colors-in-Excel.md | 21 ++ ...ues-handled-by-xlsio-during-calculation.md | 11 + ...inks-can-a-single-cell-contain-in-Excel.md | 11 + ...tering-to-string-data-types-using-XlsIO.md | 80 +++++++ ...ange-from-one-Excel-workbook-to-another.md | 82 +++++++ ...-RGB-values-of-a-cells-background-color.md | 89 ++++++++ ...-of-a-NuGet-package-from-a-local-source.md | 39 ++++ ...-naming-rules-for-named-ranges-in-Excel.md | 23 ++ ...length-for-hyperlink-screentip-in-excel.md | 11 + ...of-row-height-and-column-width-in-Excel.md | 110 ++++++++++ 22 files changed, 959 insertions(+), 29 deletions(-) create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/can-pivot-tables-share-calculate-field-names.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/can-xlsio-determine-PDF-page-count-before-Excel-to-PDF-conversion.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-auto-adjust-chart-axis-minimum-and-maximum-values.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-autofit-row-and-column-sizes-based-on-images.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-prefix-pivot-table-calculated-field-headers-with-sum-of.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-internal-links-when-converting-Excel-to-PDF.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-opacity-or-transparency-for-cell-background-colors-in-Excel.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/how-are-spaces-in-cell-values-handled-by-xlsio-during-calculation.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/how-many-hyperlinks-can-a-single-cell-contain-in-Excel.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/how-to-apply-custom-filtering-to-string-data-types-using-XlsIO.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-the-used-range-from-one-Excel-workbook-to-another.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-RGB-values-of-a-cells-background-color.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/how-to-perform-a-clean-installation-of-a-NuGet-package-from-a-local-source.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/what-are-the-naming-rules-for-named-ranges-in-Excel.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/what-is-the-maximum-text-length-for-hyperlink-screentip-in-excel.md create mode 100644 Document-Processing/Excel/Excel-Library/NET/faqs/what-is-the-unit-of-row-height-and-column-width-in-Excel.md diff --git a/Document-Processing-toc.html b/Document-Processing-toc.html index 9e50c239e..6fd33efca 100644 --- a/Document-Processing-toc.html +++ b/Document-Processing-toc.html @@ -6088,6 +6088,9 @@
  • How to set the first item in a list as the default value in an Excel?
  • +
  • + How to perform a clean installation of a NuGet package from a local source? +
  • 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 81f265d51..68fe0d195 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 @@ -19,30 +19,38 @@ The following code snippet shows how to convert an Excel chart to an image using {% 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()) { - IApplication application = excelEngine.Excel; - application.DefaultVersion = ExcelVersion.Xlsx; + //Initialize application + IApplication application = excelEngine.Excel; + + //Set the default version as Xlsx + application.DefaultVersion = ExcelVersion.Xlsx; - // Initialize XlsIORenderer - application.XlsIORenderer = new XlsIORenderer(); + //Initialize XlsIORenderer + application.XlsIORenderer = new XlsIORenderer(); - //Set converter chart image format to PNG - application.XlsIORenderer.ChartRenderingOptions.ImageFormat = ExportImageFormat.Png; + //Set converter chart image format to PNG or JPEG + application.XlsIORenderer.ChartRenderingOptions.ImageFormat = ExportImageFormat.Png; - FileStream inputStream = new FileStream(Path.GetFullPath(@"Data/InputTemplate.xlsx"), FileMode.Open, FileAccess.Read); - IWorkbook workbook = application.Workbooks.Open(inputStream); - IWorksheet worksheet = workbook.Worksheets[0]; + //Set the chart image quality to best + application.XlsIORenderer.ChartRenderingOptions.ScalingMode = ScalingMode.Best; - IChart chart = worksheet.Charts[0]; + //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 - //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Image.png"), FileMode.Create, FileAccess.Write); - chart.SaveAsImage(outputStream); - #endregion + #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(); + //Dispose streams + outputStream.Dispose(); + inputStream.Dispose(); } {% endhighlight %} diff --git a/Document-Processing/Excel/Excel-Library/NET/Working-with-Cell-or-Range-Formatting.md b/Document-Processing/Excel/Excel-Library/NET/Working-with-Cell-or-Range-Formatting.md index 89a094af2..6318aa521 100644 --- a/Document-Processing/Excel/Excel-Library/NET/Working-with-Cell-or-Range-Formatting.md +++ b/Document-Processing/Excel/Excel-Library/NET/Working-with-Cell-or-Range-Formatting.md @@ -919,6 +919,52 @@ workbook.DetectDateTimeInValue = False {% endhighlight %} {% endtabs %} +N> To display the **$** symbol, apply a currency or accounting number format. Using a number format without any currency symbol does not show any currency symbol in the value. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" %} +//Plain number format +sheet.Range["A1"].Number = 100; +sheet.Range["A1"].NumberFormat = "0.00"; //shows 100.00 + +//Currency format +sheet.Range["A2"].Number = 1234.56; +sheet.Range["A2"].NumberFormat = "$#,##0.00"; //shows $1,234.56 + +//Accounting format +sheet.Range["A3"].Number = 234; +sheet.Range["A3"].NumberFormat = "_($* #,##0.00_)"; //shows $ 234.00 +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +//Plain number format +sheet.Range["A1"].Number = 100; +sheet.Range["A1"].NumberFormat = "0.00"; //shows 100.00 + +//Currency format +sheet.Range["A2"].Number = 1234.56; +sheet.Range["A2"].NumberFormat = "$#,##0.00"; //shows $1,234.56 + +//Accounting format +sheet.Range["A3"].Number = 234; +sheet.Range["A3"].NumberFormat = "_($* #,##0.00_)"; //shows $ 234.00 +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +'Plain Number format +sheet.Range("A1").Number = 100 +sheet.Range("A1").NumberFormat = "0.00" 'shows 100.00 + +'Currency format +sheet.Range("A2").Number = 1234.56 +sheet.Range("A2").NumberFormat = "$#,##0.00" 'shows $1,234.56 + +'Accounting format +sheet.Range("A3").Number = 234 +sheet.Range("A3").NumberFormat = "_($* #,##0.00_)" 'shows $ 234.00 +{% endhighlight %} +{% endtabs %} + ## Number Format Detection Behavior Based on System Culture In Microsoft Excel, when a value is inserted, the system's culture settings determine whether the value is interpreted as a [Text](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IRange.html#Syncfusion_XlsIO_IRange_Text) or [Number](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IRange.html#Syncfusion_XlsIO_IRange_Number). If it is a valid number according to the current culture, Excel automatically detects and applies a corresponding number format. diff --git a/Document-Processing/Excel/Excel-Library/NET/Working-with-Data-Validation.md b/Document-Processing/Excel/Excel-Library/NET/Working-with-Data-Validation.md index 9007eace2..646d6bf3b 100644 --- a/Document-Processing/Excel/Excel-Library/NET/Working-with-Data-Validation.md +++ b/Document-Processing/Excel/Excel-Library/NET/Working-with-Data-Validation.md @@ -129,6 +129,35 @@ A complete working example for list data validation in C# is present on [this Gi N> The [ListOfValues](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IDataValidation.html#Syncfusion_XlsIO_IDataValidation_ListOfValues) property should be used when the values in the Data Validation list are entered manually whose limit is only 255 characters including separators. +### List Validation with User-defined Range + +The following code snippet illustrates how to set list validation for a user-defined range. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Data%20Validation/UserDefinedValidation/.NET/UserDefinedValidation/UserDefinedValidation/Program.cs,180" %} +//Data validation for the user-defined range +IDataValidation validation = worksheet.Range["C3"].DataValidation; +validation.AllowType = ExcelDataType.User; +validation.FirstFormula = "=Sheet1!$B$1:$B$3"; +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +//Data validation for the user-defined range +IDataValidation validation = worksheet.Range["C3"].DataValidation; +validation.AllowType = ExcelDataType.User; +validation.FirstFormula = "=Sheet1!$B$1:$B$3"; +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +'Data validation for the user-defined range +Dim validation As IDataValidation = worksheet.Range("C3").DataValidation +validation.AllowType = ExcelDataType.User +validation.FirstFormula = "=Sheet1!$B$1:$B$3" +{% endhighlight %} +{% endtabs %} + +A complete working example of list validation for a user-defined range in C# is present on this GitHub page. + ## Number Validation The following code snippet illustrates how to set number validation. diff --git a/Document-Processing/Excel/Excel-Library/NET/Worksheet/Page-Setup-Options.md b/Document-Processing/Excel/Excel-Library/NET/Worksheet/Page-Setup-Options.md index 947905787..66a89a2ca 100644 --- a/Document-Processing/Excel/Excel-Library/NET/Worksheet/Page-Setup-Options.md +++ b/Document-Processing/Excel/Excel-Library/NET/Worksheet/Page-Setup-Options.md @@ -1024,4 +1024,118 @@ End Using {% endhighlight %} {% endtabs %} -A complete working example to add headers and footers in an Excel document using C# is present on [this GitHub page.](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Worksheet%20Features/Header%20and%20Footer/.NET/Header%20and%20Footer) \ No newline at end of file +A complete working example to add headers and footers in an Excel document using C# is present on [this GitHub page.](https://github.com/SyncfusionExamples/XlsIO-Examples/tree/master/Worksheet%20Features/Header%20and%20Footer/.NET/Header%20and%20Footer) + +## Paper Size + +The PaperSize functionality allows you to specify the paper size for worksheet. + +The following code snippet shows how to use PaperSize. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Worksheet%20Features/PaperSize/.NET/PaperSize/PaperSize/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]; + + //Set the paper size to A4 + worksheet.PageSetup.PaperSize = ExcelPaperSize.PaperA4; + + //Saving the workbook + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open("InputTemplate.xlsx"); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Set the paper size to A4 + worksheet.PageSetup.PaperSize = ExcelPaperSize.PaperA4; + + //Saving the workbook + workbook.SaveAs("Output.xlsx"); +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +Using excelEngine As ExcelEngine = New ExcelEngine() + Dim application As IApplication = excelEngine.Excel + application.DefaultVersion = ExcelVersion.Xlsx + Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xlsx") + Dim worksheet As IWorksheet = workbook.Worksheets(0) + + 'Set the paper size to A4 + worksheet.PageSetup.PaperSize = ExcelPaperSize.PaperA4 + + 'Saving the workbook + workbook.SaveAs("Output.xlsx") +End Using +{% endhighlight %} +{% endtabs %} + +A complete working example to set the paper size in C# is present on this GitHub page. + +## Orientation + +The Orientation functionality allows you to specify the orientation for worksheet. + +The following code snippet shows how to use Orientation. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/Worksheet%20Features/Orientation/.NET/Orientation/Orientation/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]; + + //Set the page orientation + worksheet.PageSetup.Orientation = ExcelPageOrientation.Landscape; + + //Saving the workbook + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open("InputTemplate.xlsx"); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Set the page orientation + worksheet.PageSetup.Orientation = ExcelPageOrientation.Landscape; + + //Saving the workbook + workbook.SaveAs("Output.xlsx"); +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +Using excelEngine As ExcelEngine = New ExcelEngine() + Dim application As IApplication = excelEngine.Excel + application.DefaultVersion = ExcelVersion.Xlsx + Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xlsx") + Dim worksheet As IWorksheet = workbook.Worksheets(0) + + 'Set the page orientation + worksheet.PageSetup.Orientation = ExcelPageOrientation.Landscape + + 'Saving the workbook + workbook.SaveAs("Output.xlsx") +End Using +{% endhighlight %} +{% endtabs %} + +A complete working example to set the page orientation in C# is present on this GitHub page. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-aws-lambda.md b/Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-aws-lambda.md index 26a5cafae..ebe6e825f 100644 --- a/Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-aws-lambda.md +++ b/Document-Processing/Excel/Excel-Library/NET/create-read-edit-excel-files-in-aws-lambda.md @@ -222,17 +222,9 @@ using (ExcelEngine excelEngine = new ExcelEngine()) worksheet.Range["A9:A14"].RowHeight = 15; worksheet.Range["A15:A23"].RowHeight = 18; - //Saving the Excel to the MemoryStream - MemoryStream stream = new MemoryStream(); + MemoryStream stream = new MemoryStream(); workbook.SaveAs(stream); - - //Set the position as '0'. - stream.Position = 0; - - //Download the Excel file in the browser - FileStreamResult fileStreamResult = new FileStreamResult(stream, "application/excel"); - fileStreamResult.FileDownloadName = "Output.xlsx"; - return fileStreamResult; + return Convert.ToBase64String(stream.ToArray()); } {% endhighlight %} diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/can-pivot-tables-share-calculate-field-names.md b/Document-Processing/Excel/Excel-Library/NET/faqs/can-pivot-tables-share-calculate-field-names.md new file mode 100644 index 000000000..7b98e3a68 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/can-pivot-tables-share-calculate-field-names.md @@ -0,0 +1,204 @@ +--- +title: Calculated field naming across PivotTables | Syncfusion +description: This page explains whether multiple PivotTables can use calculated fields with the same name in Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# Can PivotTables have the same name for multiple calculated fields? + +In **Microsoft Excel**, calculated fields are scoped to the pivot cache, not to individual PivotTables. + +This means: + +* **If multiple PivotTables share the same cache** + * Calculated fields with the same name cannot be defined. Excel reuses the existing field from the cache, and its formula cannot be redefined independently. + * Calculated fields with different names can be defined, and they will be available to all PivotTables that share that cache. + +* **If PivotTables use separate caches (even if the source data is identical)** + * Calculated fields with the same name or with different names can be defined. Each cache maintains its own calculated field collection, so there is no conflict. + +**Syncfusion XlsIO** follows the same cache scoped behavior: +* With a shared cache, calculated field names must be unique. +* With separate caches, calculated field names can be identical or different. + +The following examples illustrate calculated field naming across PivotTables in C# (cross-platform and Windows-specific) and VB.NET. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/FAQ/Pivot%20Tables%20Calculated%20Field%20Names/.NET/PivotTablesCalculatedFieldNames/PivotTablesCalculatedFieldNames/Program.cs,180" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Create(3); + IWorksheet dataSheet = workbook.Worksheets[0]; + IWorksheet pivotSheet1 = workbook.Worksheets[1]; + IWorksheet pivotSheet2 = workbook.Worksheets[2]; + + //Add sample data + dataSheet.Range["A1"].Text = "Product"; + dataSheet.Range["B1"].Text = "Sales"; + dataSheet.Range["C1"].Text = "Cost"; + + dataSheet.Range["A2"].Text = "Laptop"; + dataSheet.Range["B2"].Number = 5000; + dataSheet.Range["C2"].Number = 3000; + + dataSheet.Range["A3"].Text = "Tablet"; + dataSheet.Range["B3"].Number = 3000; + dataSheet.Range["C3"].Number = 2000; + + dataSheet.Range["A4"].Text = "Phone"; + dataSheet.Range["B4"].Number = 4000; + dataSheet.Range["C4"].Number = 2500; + + //CASE 1: Shared pivot cache - calculated field names must be unique + IPivotCache sharedCache = workbook.PivotCaches.Add(dataSheet["A1:C4"]); + + IPivotTable pivot1 = pivotSheet1.PivotTables.Add("Pivot1", pivotSheet1["A1"], sharedCache); + pivot1.Fields[0].Axis = PivotAxisTypes.Row; + pivot1.DataFields.Add(pivot1.Fields[1], "Total Sales", PivotSubtotalTypes.Sum); + pivot1.CalculatedFields.Add("Profit", "Sales - Cost"); + + IPivotTable pivot2 = pivotSheet1.PivotTables.Add("Pivot2", pivotSheet1["F1"], sharedCache); + pivot2.Fields[0].Axis = PivotAxisTypes.Row; + pivot2.DataFields.Add(pivot2.Fields[2], "Total Cost", PivotSubtotalTypes.Sum); + pivot2.CalculatedFields.Add("Margin", "Sales - Cost"); + + //CASE 2: Separate pivot caches - identical or different calculated field names are allowed + IPivotTable pivot3 = pivotSheet2.PivotTables.Add("Pivot3", pivotSheet2["A1"], + workbook.PivotCaches.Add(dataSheet["A1:C4"])); + pivot3.Fields[0].Axis = PivotAxisTypes.Row; + pivot3.DataFields.Add(pivot3.Fields[1], "Total Sales", PivotSubtotalTypes.Sum); + pivot3.CalculatedFields.Add("Profit", "Sales - Cost"); + + IPivotTable pivot4 = pivotSheet2.PivotTables.Add("Pivot4", pivotSheet2["F1"], + workbook.PivotCaches.Add(dataSheet["A1:C4"])); + pivot4.Fields[0].Axis = PivotAxisTypes.Row; + pivot4.DataFields.Add(pivot4.Fields[2], "Total Cost", PivotSubtotalTypes.Sum); + pivot4.CalculatedFields.Add("Profit", "Sales - Cost"); + + //Saving the workbook + workbook.SaveAs(Path.GetFullPath(@"Output/Output.xlsx")); +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Create(3); + IWorksheet dataSheet = workbook.Worksheets[0]; + IWorksheet pivotSheet1 = workbook.Worksheets[1]; + IWorksheet pivotSheet2 = workbook.Worksheets[2]; + + //Add sample data + dataSheet.Range["A1"].Text = "Product"; + dataSheet.Range["B1"].Text = "Sales"; + dataSheet.Range["C1"].Text = "Cost"; + + dataSheet.Range["A2"].Text = "Laptop"; + dataSheet.Range["B2"].Number = 5000; + dataSheet.Range["C2"].Number = 3000; + + dataSheet.Range["A3"].Text = "Tablet"; + dataSheet.Range["B3"].Number = 3000; + dataSheet.Range["C3"].Number = 2000; + + dataSheet.Range["A4"].Text = "Phone"; + dataSheet.Range["B4"].Number = 4000; + dataSheet.Range["C4"].Number = 2500; + + //CASE 1: Shared pivot cache - calculated field names must be unique + IPivotCache sharedCache = workbook.PivotCaches.Add(dataSheet["A1:C4"]); + + IPivotTable pivot1 = pivotSheet1.PivotTables.Add("Pivot1", pivotSheet1["A1"], sharedCache); + pivot1.Fields[0].Axis = PivotAxisTypes.Row; + pivot1.DataFields.Add(pivot1.Fields[1], "Total Sales", PivotSubtotalTypes.Sum); + pivot1.CalculatedFields.Add("Profit", "Sales - Cost"); + + IPivotTable pivot2 = pivotSheet1.PivotTables.Add("Pivot2", pivotSheet1["F1"], sharedCache); + pivot2.Fields[0].Axis = PivotAxisTypes.Row; + pivot2.DataFields.Add(pivot2.Fields[2], "Total Cost", PivotSubtotalTypes.Sum); + pivot2.CalculatedFields.Add("Margin", "Sales - Cost"); + + //CASE 2: Separate pivot caches - identical or different calculated field names are allowed + IPivotTable pivot3 = pivotSheet2.PivotTables.Add("Pivot3", pivotSheet2["A1"], + workbook.PivotCaches.Add(dataSheet["A1:C4"])); + pivot3.Fields[0].Axis = PivotAxisTypes.Row; + pivot3.DataFields.Add(pivot3.Fields[1], "Total Sales", PivotSubtotalTypes.Sum); + pivot3.CalculatedFields.Add("Profit", "Sales - Cost"); + + IPivotTable pivot4 = pivotSheet2.PivotTables.Add("Pivot4", pivotSheet2["F1"], + workbook.PivotCaches.Add(dataSheet["A1:C4"])); + pivot4.Fields[0].Axis = PivotAxisTypes.Row; + pivot4.DataFields.Add(pivot4.Fields[2], "Total Cost", PivotSubtotalTypes.Sum); + pivot4.CalculatedFields.Add("Profit", "Sales - Cost"); + + //Saving the workbook + workbook.SaveAs("Output.xlsx"); +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +Using excelEngine As New ExcelEngine() + Dim application As IApplication = excelEngine.Excel + application.DefaultVersion = ExcelVersion.Xlsx + + Dim workbook As IWorkbook = application.Workbooks.Create(3) + Dim dataSheet As IWorksheet = workbook.Worksheets(0) + Dim pivotSheet1 As IWorksheet = workbook.Worksheets(1) + Dim pivotSheet2 As IWorksheet = workbook.Worksheets(2) + + ' Add sample data + dataSheet.Range("A1").Text = "Product" + dataSheet.Range("B1").Text = "Sales" + dataSheet.Range("C1").Text = "Cost" + + dataSheet.Range("A2").Text = "Laptop" + dataSheet.Range("B2").Number = 5000 + dataSheet.Range("C2").Number = 3000 + + dataSheet.Range("A3").Text = "Tablet" + dataSheet.Range("B3").Number = 3000 + dataSheet.Range("C3").Number = 2000 + + dataSheet.Range("A4").Text = "Phone" + dataSheet.Range("B4").Number = 4000 + dataSheet.Range("C4").Number = 2500 + + 'CASE 1: Shared pivot cache - calculated field names must be unique + Dim sharedCache As IPivotCache = workbook.PivotCaches.Add(dataSheet.Range("A1:C4")) + + Dim pivot1 As IPivotTable = pivotSheet1.PivotTables.Add("Pivot1", pivotSheet1.Range("A1"), sharedCache) + pivot1.Fields(0).Axis = PivotAxisTypes.Row + pivot1.DataFields.Add(pivot1.Fields(1), "Total Sales", PivotSubtotalTypes.Sum) + pivot1.CalculatedFields.Add("Profit", "Sales - Cost") + + Dim pivot2 As IPivotTable = pivotSheet1.PivotTables.Add("Pivot2", pivotSheet1.Range("F1"), sharedCache) + pivot2.Fields(0).Axis = PivotAxisTypes.Row + pivot2.DataFields.Add(pivot2.Fields(2), "Total Cost", PivotSubtotalTypes.Sum) + pivot2.CalculatedFields.Add("Margin", "Sales - Cost") + + 'CASE 2: Separate pivot caches - identical or different calculated field names are allowed + Dim pivot3 As IPivotTable = pivotSheet2.PivotTables.Add("Pivot3", pivotSheet2.Range("A1"), + workbook.PivotCaches.Add(dataSheet.Range("A1:C4"))) + pivot3.Fields(0).Axis = PivotAxisTypes.Row + pivot3.DataFields.Add(pivot3.Fields(1), "Total Sales", PivotSubtotalTypes.Sum) + pivot3.CalculatedFields.Add("Profit", "Sales - Cost") + + Dim pivot4 As IPivotTable = pivotSheet2.PivotTables.Add("Pivot4", pivotSheet2.Range("F1"), + workbook.PivotCaches.Add(dataSheet.Range("A1:C4"))) + pivot4.Fields(0).Axis = PivotAxisTypes.Row + pivot4.DataFields.Add(pivot4.Fields(2), "Total Cost", PivotSubtotalTypes.Sum) + pivot4.CalculatedFields.Add("Profit", "Sales - Cost") + + 'Saving the workbook + workbook.SaveAs("Output.xlsx") +End Using +{% endhighlight %} +{% endtabs %} + +A complete working example to demonstrate calculated field naming across PivotTables using C# is present on this GitHub page. diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/can-xlsio-determine-PDF-page-count-before-Excel-to-PDF-conversion.md b/Document-Processing/Excel/Excel-Library/NET/faqs/can-xlsio-determine-PDF-page-count-before-Excel-to-PDF-conversion.md new file mode 100644 index 000000000..16da732ac --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/can-xlsio-determine-PDF-page-count-before-Excel-to-PDF-conversion.md @@ -0,0 +1,11 @@ +--- +title: XlsIO support for page count before PDF conversion | Syncfusion +description: This page explains whether Syncfusion XlsIO can determine the total number of pages of the PDF file before Excel to PDF conversion. +platform: document-processing +control: XlsIO +documentation: UG +--- + +# Can XlsIO determine PDF page count before Excel to PDF conversion? + +No. XlsIO does not support determining the page count of the PDF document before Excel to PDF conversion. The final page count depends on factors such as print settings, page layout, scaling options, and content distribution. These elements can only be assessed during the conversion process, so calculating the page count in advance is not possible. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-auto-adjust-chart-axis-minimum-and-maximum-values.md b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-auto-adjust-chart-axis-minimum-and-maximum-values.md new file mode 100644 index 000000000..50c10f753 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-auto-adjust-chart-axis-minimum-and-maximum-values.md @@ -0,0 +1,13 @@ +--- +title: Chart axis auto-adjust in XlsIO | Syncfusion +description: This page explains whether Syncfusion XlsIO supports auto adjustment of chart axis values using Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# Does XlsIO auto-adjust chart axis minimum and maximum values? + +No. In Microsoft Excel, if the axis maximum value is lower than the minimum value, Excel automatically adjusts the minimum value (for example, a minimum of 1.25 and maximum of 0 may yield a minimum like -10). XlsIO does not support this auto adjustment of chart axis values. When configuring chart axes, ensure that the maximum value is greater than the minimum value. + +For details on setting chart axis minimum and maximum values in XlsIO, see the Chart Axis Settings. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-autofit-row-and-column-sizes-based-on-images.md b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-autofit-row-and-column-sizes-based-on-images.md new file mode 100644 index 000000000..a90349a05 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-autofit-row-and-column-sizes-based-on-images.md @@ -0,0 +1,11 @@ +--- +title: Row and column autofit with images in XlsIO | Syncfusion +description: This page explains whether Syncfusion XlsIO supports autofitting row height and column width based on images using Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# Does XlsIO autofit row and column sizes based on images? + +No. In Microsoft Excel, the **Autofit** functionality adjusts row height and column width based on cell content only; it does not autofit sizes based on images. Syncfusion XlsIO follows the same behavior. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-prefix-pivot-table-calculated-field-headers-with-sum-of.md b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-prefix-pivot-table-calculated-field-headers-with-sum-of.md new file mode 100644 index 000000000..fe3244be3 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-prefix-pivot-table-calculated-field-headers-with-sum-of.md @@ -0,0 +1,11 @@ +--- +title: PivotTable calculated field header prefix in XlsIO | Syncfusion +description: This page explains whether Syncfusion XlsIO prefixes PivotTable calculated field headers with "Sum of" when adding a calculated field. +platform: document-processing +control: XlsIO +documentation: UG +--- + +# Does XlsIO prefix PivotTable calculated field headers with "Sum of"? + +Yes. When a calculated field is added to a PivotTable, Microsoft Excel automatically prefixes the column header with **Sum of** before the original name. For example, a field named **Profit** becomes **Sum of Profit**. XlsIO follows the same behavior to remain consistent with Excel. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-internal-links-when-converting-Excel-to-PDF.md b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-internal-links-when-converting-Excel-to-PDF.md new file mode 100644 index 000000000..fdd3c01a8 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-internal-links-when-converting-Excel-to-PDF.md @@ -0,0 +1,11 @@ +--- +title: Support for internal links when converting Excel to PDF | Syncfusion +description: This page explains whether Syncfusion XlsIO supports internal links when converting Excel to PDF using Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# Does XlsIO support internal links when converting Excel to PDF? + +No. As per Microsoft Excel behavior, internal links within a worksheet are not retained when exported to PDF. Similarly, XlsIO does not support adding internal links in the converted PDF document. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-opacity-or-transparency-for-cell-background-colors-in-Excel.md b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-opacity-or-transparency-for-cell-background-colors-in-Excel.md new file mode 100644 index 000000000..82ce72ea8 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-opacity-or-transparency-for-cell-background-colors-in-Excel.md @@ -0,0 +1,21 @@ +--- +title: Transparency support for cell background color | Syncfusion +description: Learn whether Syncfusion XlsIO supports setting Opacity or transparency for cell background colors in Excel. +platform: document-processing +control: XlsIO +documentation: UG +--- + +# XlsIO support for cell background color transparency in Excel + +XlsIO does not support opacity or transparency for cell background colors in Excel. + +While the XlsIO API allows setting alpha (transparency) values for cell background colors, Microsoft Excel does not support rendering transparent cell fills. Excel silently discards the alpha component during rendering and file saving. As a result, any transparency value set in XlsIO will be ignored, and Excel will apply only the RGB portion of the color. + +**For example:** +~~~ +worksheet.Range["A1"].CellStyle.Color = Color.FromArgb(128, 255, 0, 0) //(50% transparent red) +worksheet.Range["A2"].CellStyle.Color = Color.FromArgb(255, 255, 0, 0) //(solid red) +~~~ + +Both render identically in Excel as solid red. While XlsIO accepts ARGB inputs, the alpha component has no effect due to Excel's inherent limitations. Only the RGB portion of the color is applied. diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-are-spaces-in-cell-values-handled-by-xlsio-during-calculation.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-are-spaces-in-cell-values-handled-by-xlsio-during-calculation.md new file mode 100644 index 000000000..9735d0177 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-are-spaces-in-cell-values-handled-by-xlsio-during-calculation.md @@ -0,0 +1,11 @@ +--- +title: Handling spaces in Excel calculations | Syncfusion +description: This page explains how Microsoft Excel and Syncfusion XlsIO handle leading and trailing spaces in cell values during calculation and display. +platform: document-processing +control: XlsIO +documentation: UG +--- + +# How are spaces in cell values handled by XlsIO during calculation? + +In Microsoft Excel, leading and trailing spaces in cell values are preserved for display purposes. However, when performing calculations (for example, **=A1+5** where A1 contains **" 25 "** with spaces), Excel automatically ignores those spaces and treats the underlying numeric value. Spaces are always shown in the cell but ignored in calculations. Syncfusion XlsIO follows the same behavior. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-many-hyperlinks-can-a-single-cell-contain-in-Excel.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-many-hyperlinks-can-a-single-cell-contain-in-Excel.md new file mode 100644 index 000000000..b88b1a059 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-many-hyperlinks-can-a-single-cell-contain-in-Excel.md @@ -0,0 +1,11 @@ +--- +title: Hyperlinks in a single cell in Excel | Syncfusion +description: Learn about how many hyperlinks can a single cell contain in Excel using Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# How many hyperlinks can a single cell contain in Excel? + +In Microsoft Excel, a single cell can contain only **one hyperlink**. It is not possible to assign multiple hyperlinks to the same cell. This limitation applies when working with Excel manually or programmatically using the Syncfusion .NET Excel library (XlsIO). diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-apply-custom-filtering-to-string-data-types-using-XlsIO.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-apply-custom-filtering-to-string-data-types-using-XlsIO.md new file mode 100644 index 000000000..427c13e6f --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-apply-custom-filtering-to-string-data-types-using-XlsIO.md @@ -0,0 +1,80 @@ +--- +title: Apply custom filtering to string data types using XlsIO | Syncfusion +description: Code example to apply custom filtering to string data types using Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# How to apply custom filtering to string data types using XlsIO? + +The following code snippets illustrate how to apply custom filtering to string data types in C# (cross-platform and Windows-specific) and VB.NET. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/FAQ/Filtering/.NET/Custom%20Filter%20String%20Type/CustomFilterStringType/Program.cs,180" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Input.xlsx")); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Creating an AutoFilter + worksheet.AutoFilters.FilterRange = worksheet.Range["A1:A11"]; + IAutoFilter filter = worksheet.AutoFilters[0]; + + //Specifying first condition + IAutoFilterCondition firstCondition = filter.FirstCondition; + firstCondition.ConditionOperator = ExcelFilterCondition.DoesNotContain; + firstCondition.String = "1000.00"; + + //Saving the workbook + workbook.SaveAs(Path.GetFullPath(@"Output/Output.xlsx")); +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Open("Input.xlsx"); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Creating an AutoFilter + worksheet.AutoFilters.FilterRange = worksheet.Range["A1:A11"]; + IAutoFilter filter = worksheet.AutoFilters[0]; + + //Specifying first condition + IAutoFilterCondition firstCondition = filter.FirstCondition; + firstCondition.ConditionOperator = ExcelFilterCondition.DoesNotContain; + firstCondition.String = "1000.00"; + + //Saving the workbook + workbook.SaveAs("Output.xlsx"); +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +Using excelEngine As New ExcelEngine() + Dim application As IApplication = excelEngine.Excel + application.DefaultVersion = ExcelVersion.Xlsx + Dim workbook As IWorkbook = application.Workbooks.Open("Sample.xlsx") + Dim sheet As IWorksheet = workbook.Worksheets(0) + + 'Creating an AutoFilter + sheet.AutoFilters.FilterRange = sheet.Range("A1:A11") + Dim filter As IAutoFilter = sheet.AutoFilters(0) + + 'Specifying first condition + Dim firstCondition As IAutoFilterCondition = filter.FirstCondition + firstCondition.ConditionOperator = ExcelFilterCondition.DoesNotContain + firstCondition.String = 1000.0 + + 'Saving the workbook + workbook.SaveAs("Output.xlsx") +End Using +{% endhighlight %} +{% endtabs %} + +A complete working example to apply custom filtering to string data types using C# is present on this GitHub page. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-the-used-range-from-one-Excel-workbook-to-another.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-the-used-range-from-one-Excel-workbook-to-another.md new file mode 100644 index 000000000..c14fddbe3 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-copy-the-used-range-from-one-Excel-workbook-to-another.md @@ -0,0 +1,82 @@ +--- +title: Copy used range in Excel | Syncfusion +description: Learn how to copy the used range from one Excel workbook to another using the Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# How to copy the used range from one Excel workbook to another? + +The [UsedRange](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorksheet.html#Syncfusion_XlsIO_IWorksheet_UsedRange) of [IWorksheet](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorksheet.html) returns the contiguous range that contains data in a worksheet. By default, Excel also considers cells that have only formatting applied as part of the used range. + +The following code examples show how to copy the used range from a source workbook to a destination workbook in C# (cross-platform and Windows-specific) and VB.NET. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/FAQ/Copy%20Used%20Range/.NET/CopyUsedRange/CopyUsedRange/Program.cs,180" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook sourceWorkbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Source.xlsx")); + IWorkbook destinationWorkbook = application.Workbooks.Open(Path.GetFullPath(@"Data/Destination.xlsx")); + + IWorksheet sourceWorksheet = sourceWorkbook.Worksheets["Sheet1"]; + IWorksheet destinationWorksheet = destinationWorkbook.Worksheets["Sheet1"]; + + //Get the actual used range from source sheet + IRange sourceRange = sourceWorksheet.UsedRange; + + //Copy the entire used range from source sheet to destination sheet + sourceRange.CopyTo(destinationWorksheet.Range[sourceRange.Row, sourceRange.Column]); + + //Save the destination workbook + destinationWorkbook.SaveAs(Path.GetFullPath(@"Output/Output.xlsx")); +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook sourceWorkbook = application.Workbooks.Open("Source.xlsx"); + IWorkbook destinationWorkbook = application.Workbooks.Open("Destination.xlsx"); + + IWorksheet sourceWorksheet = sourceWorkbook.Worksheets["Sheet1"]; + IWorksheet destinationWorksheet = destinationWorkbook.Worksheets["Sheet1"]; + + //Get the actual used range from source sheet + IRange sourceRange = sourceWorksheet.UsedRange; + + //Copy the entire used range from source sheet to destination sheet + sourceRange.CopyTo(destinationWorksheet.Range[sourceRange.Row, sourceRange.Column]); + + //Save the destination workbook + destinationWorkbook.SaveAs("Output.xlsx"); +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +Using excelEngine As New ExcelEngine() + Dim application As IApplication = excelEngine.Excel + application.DefaultVersion = ExcelVersion.Xlsx + Dim sourceWorkbook As IWorkbook = application.Workbooks.Open("Source.xlsx") + Dim destinationWorkbook As IWorkbook = application.Workbooks.Open("Destination.xlsx") + + Dim sourceWorksheet As IWorksheet = sourceWorkbook.Worksheets("Sheet1") + Dim destinationWorksheet As IWorksheet = destinationWorkbook.Worksheets("Sheet1") + + 'Get the actual used range from source sheet + Dim sourceRange As IRange = sourceWorksheet.UsedRange + + 'Copy the entire used range from source sheet to destination sheet + sourceRange.CopyTo(destinationWorksheet.Range(sourceRange.Row, sourceRange.Column)) + + 'Save the destination workbook + destinationWorkbook.SaveAs("Output.xlsx") +End Using +{% endhighlight %} +{% endtabs %} + +A complete working example to copy the used range from a source workbook to a destination workbook using C# is present on this GitHub page. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-RGB-values-of-a-cells-background-color.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-RGB-values-of-a-cells-background-color.md new file mode 100644 index 000000000..53dbcb1d7 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-RGB-values-of-a-cells-background-color.md @@ -0,0 +1,89 @@ +--- +title: Get RGB values of a cell's background color | Syncfusion +description: Code example to get RGB values of a cell's background color using Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# How to get RGB values of a cell's background color? + +The following examples show how to get RGB values of a cell's background color in C# (cross-platform and Windows-specific) and VB.NET. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" playgroundButtonLink="https://raw.githubusercontent.com/SyncfusionExamples/XlsIO-Examples/master/FAQ/RGB%20Value%20for%20Cell%20Color/.NET/RGB%20Value%20for%20Cell%20Color/RGBValueCellColor/Program.cs,180" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Create(1); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Apply cell color + worksheet.Range["A1"].CellStyle.ColorIndex = ExcelKnownColors.Custom50; + + //Get the RGB values of the cell color + Color color = worksheet.Range["A1"].CellStyle.Color; + byte red = color.R; + byte green = color.G; + byte blue = color.B; + + //Print the RGB values + Console.WriteLine($"Red: {red}, Green: {green}, Blue: {blue}"); + + //Save the workbook + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); +} +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + IWorkbook workbook = application.Workbooks.Create(1); + IWorksheet worksheet = workbook.Worksheets[0]; + + //Apply cell color + worksheet.Range["A1"].CellStyle.ColorIndex = ExcelKnownColors.Custom50; + + //Get the RGB values of the cell color + Color color = worksheet.Range["A1"].CellStyle.Color; + byte red = color.R; + byte green = color.G; + byte blue = color.B; + + //Print the RGB values + Console.WriteLine($"Red: {red}, Green: {green}, Blue: {blue}"); + + //Save the workbook + workbook.SaveAs("Output.xlsx"); +} +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +Using excelEngine As New ExcelEngine() + Dim application As IApplication = excelEngine.Excel + application.DefaultVersion = ExcelVersion.Xlsx + Dim workbook As IWorkbook = application.Workbooks.Create(1) + Dim worksheet As IWorksheet = workbook.Worksheets(0) + + 'Apply cell color + worksheet.Range("A1").CellStyle.ColorIndex = ExcelKnownColors.Custom50 + + 'Get the RGB values of the cell color + Dim cellColor As Color = worksheet.Range("A1").CellStyle.Color + Dim red As Byte = cellColor.R + Dim green As Byte = cellColor.G + Dim blue As Byte = cellColor.B + + 'Print the RGB values + Console.WriteLine($"Red: {red}, Green: {green}, Blue: {blue}") + + 'Save the workbook + workbook.SaveAs("Output.xlsx") +End Using +{% endhighlight %} +{% endtabs %} + +A complete working example to get RGB values of a cell's background color is available on this GitHub page. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-perform-a-clean-installation-of-a-NuGet-package-from-a-local-source.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-perform-a-clean-installation-of-a-NuGet-package-from-a-local-source.md new file mode 100644 index 000000000..070d56212 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-perform-a-clean-installation-of-a-NuGet-package-from-a-local-source.md @@ -0,0 +1,39 @@ +--- +title: How to install a Syncfusion NuGet package from a local source +description: This page explains about how to perform a clean installation of a NuGet package from a local source. +platform: document-processing +control: XlsIO +documentation: UG +--- + +# Steps for a clean installation of a NuGet package from a local source + +To perform a clean installation of a NuGet package from a local source, follow these steps: + +1. Save the .nupkg file + +Save the NuGet package file (.nupkg) to a local directory, such as: C:\MyNuGetPackages + +2. Configure the local package source in Visual Studio + +* Open Visual Studio + +* Navigate to: Tools > Options > NuGet Package Manager > Package Sources + +* Add a new package source and point it to the folder from Step 1 + +3. Uninstall the existing package + +If the package is already installed in your project, uninstall it to avoid conflicts. + +4. Clear the NuGet cache + +Run the following command in a terminal or command prompt to clear cached packages: + +~~~ +dotnet nuget locals all --clear +~~~ + +5. Reinstall the package from the local source + +Use the NuGet Package Manager or CLI to install the package from the newly added local source. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/what-are-the-naming-rules-for-named-ranges-in-Excel.md b/Document-Processing/Excel/Excel-Library/NET/faqs/what-are-the-naming-rules-for-named-ranges-in-Excel.md new file mode 100644 index 000000000..c599c6a41 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/what-are-the-naming-rules-for-named-ranges-in-Excel.md @@ -0,0 +1,23 @@ +--- +title: Naming rules for named ranges in Excel | Syncfusion +description: Learn the naming conventions for Excel named ranges in XlsIO, including allowed characters, restrictions, and length limits. +platform: document-processing +control: XlsIO +documentation: UG +--- + +# What are the naming rules for named ranges in Excel? + +When defining a named range in Excel, the following rules apply: + +* **Start character:** Must begin with a letter (A-Z/a-z), underscore (_), or backslash (\). + +* **Allowed characters:** Can include letters, numbers, underscores (_), and periods (.). + +* **Characters not allowed:** Spaces and most special characters (e.g., ! @ # $ % ^ & *) are not permitted. + +* **No cell references:** Names cannot resemble a valid cell reference (e.g., A1, R1C1). + +* **Length limit:** Maximum of 255 characters. + +* **Case sensitivity:** Names are case-insensitive. diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/what-is-the-maximum-text-length-for-hyperlink-screentip-in-excel.md b/Document-Processing/Excel/Excel-Library/NET/faqs/what-is-the-maximum-text-length-for-hyperlink-screentip-in-excel.md new file mode 100644 index 000000000..27e9659ab --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/what-is-the-maximum-text-length-for-hyperlink-screentip-in-excel.md @@ -0,0 +1,11 @@ +--- +title: Hyperlink ScreenTip text limit in Excel | Syncfusion +description: This page explains the maximum supported text length for hyperlink ScreenTip text in Microsoft Excel and Syncfusion XlsIO. +platform: document-processing +control: XlsIO +documentation: UG +--- + +# What is the maximum text length for hyperlink ScreenTip in Excel? + +The maximum supported text length for hyperlink ScreenTip text in Excel is **255 characters**. Syncfusion XlsIO follows the same behavior when setting hyperlink ScreenTip text. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/what-is-the-unit-of-row-height-and-column-width-in-Excel.md b/Document-Processing/Excel/Excel-Library/NET/faqs/what-is-the-unit-of-row-height-and-column-width-in-Excel.md new file mode 100644 index 000000000..4d9be2e15 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/what-is-the-unit-of-row-height-and-column-width-in-Excel.md @@ -0,0 +1,110 @@ +--- +title: Unit of row height and column width in Excel | Syncfusion +description: This page explains about the default unit of measurement for row height and column width in Excel using Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# What is the unit of row height and column width in Excel? + +By default, XlsIO uses **points** as the unit of measurement for both row height and column width. + +Use SetColumnWidth + and SetRowHeight to set dimensions in points. + +Use GetColumnWidth and GetRowHeight to retrieve dimensions in points. + +If you need pixel values, XlsIO provides pixel based APIs: GetColumnWidthInPixels, GetRowHeightInPixels, SetColumnWidthInPixels, SetRowHeightInPixels. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" %} +//Set column width in points +sheet.SetColumnWidth(1, 20); + +//Get column width in points +var widthPoints = sheet.GetColumnWidth(1); +Console.WriteLine("Column width in points: " + widthPoints); + +//Set column width in pixels +sheet.SetColumnWidthInPixels(1, 160); + +//Get column width in pixels +var widthPixels = sheet.GetColumnWidthInPixels(1); +Console.WriteLine("Column width in pixels: " + widthPixels); + +//Set row height in points +sheet.SetRowHeight(1, 15); + +//Get row height in points +var heightPoints = sheet.GetRowHeight(1); +Console.WriteLine("Row height in points: " + heightPoints); + +//Set row height in pixels +sheet.SetRowHeightInPixels(1, 40); + +//Get row height in pixels +var heightPixels = sheet.GetRowHeightInPixels(1); +Console.WriteLine("Row height in pixels: " + heightPixels); +{% endhighlight %} + +{% highlight c# tabtitle="C# [Windows-specific]" %} +//Set column width in points +sheet.SetColumnWidth(1, 20); + +//Get column width in points +var widthPoints = sheet.GetColumnWidth(1); +Console.WriteLine("Column width in points: " + widthPoints); + +//Set column width in pixels +sheet.SetColumnWidthInPixels(1, 160); + +//Get column width in pixels +var widthPixels = sheet.GetColumnWidthInPixels(1); +Console.WriteLine("Column width in pixels: " + widthPixels); + +//Set row height in points +sheet.SetRowHeight(1, 15); + +//Get row height in points +var heightPoints = sheet.GetRowHeight(1); +Console.WriteLine("Row height in points: " + heightPoints); + +//Set row height in pixels +sheet.SetRowHeightInPixels(1, 40); + +//Get row height in pixels +var heightPixels = sheet.GetRowHeightInPixels(1); +Console.WriteLine("Row height in pixels: " + heightPixels); +{% endhighlight %} + +{% highlight vb.net tabtitle="VB.NET [Windows-specific]" %} +'Set column width in points +sheet.SetColumnWidth(1, 20) + +'Get column width in points +Dim widthPoints As Integer = sheet.GetColumnWidth(1) +Console.WriteLine("Column width in points: " & widthPoints) + +'Set column width in pixels +sheet.SetColumnWidthInPixels(1, 160) + +'Get column width in pixels +Dim widthPixels As Integer = sheet.GetColumnWidthInPixels(1) +Console.WriteLine("Column width in pixels: " & widthPixels) + +'Set row height in points +sheet.SetRowHeight(1, 15) + +'Get row height in points +Dim heightPoints As Integer = sheet.GetRowHeight(1) +Console.WriteLine("Row height in points: " & heightPoints) + +'Set row height in pixels +sheet.SetRowHeightInPixels(1, 40) + +'Get row height in pixels +Dim heightPixels As Integer = sheet.GetRowHeightInPixels(1) +Console.WriteLine("Row height in pixels: " & heightPixels) +{% endhighlight %} +{% endtabs %} \ No newline at end of file