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 6dff372a8..89a094af2 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 @@ -33,12 +33,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/CreateStyle.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/CreateStyle.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -110,12 +106,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/RowColumnStyle.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/RowColumnStyle.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -257,12 +249,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/GlobalStyle.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/GlobalStyle.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -687,12 +675,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/NumberFormat.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/NumberFormat.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -873,9 +857,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) string text = worksheet.Range["B4"].DisplayText; //Saving the workbook as stream - FileStream stream = new FileStream("Output.xlsx", FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(stream); - stream.Dispose(); + workbook.SaveAs(Path.GetFullPath("Output/Output.xlsx")); } {% endhighlight %} @@ -970,12 +952,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/HideCellContent.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/HideCellContent.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1189,12 +1167,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/Alignment.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/Alignment.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1374,12 +1348,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/MergeandUnMerge.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/MergeandUnMerge.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1445,12 +1415,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/WrapText.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/WrapText.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1542,12 +1508,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/AutoFit.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/AutoFit.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1643,12 +1605,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/FontSettings.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/FontSettings.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1860,12 +1818,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/BorderSettings.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/BorderSettings.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -1996,12 +1950,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/HTMLString.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/HTMLString.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} @@ -2105,12 +2055,8 @@ using (ExcelEngine excelEngine = new ExcelEngine()) #region Save //Saving the workbook - FileStream outputStream = new FileStream(Path.GetFullPath("Output/RichText.xlsx"), FileMode.Create, FileAccess.Write); - workbook.SaveAs(outputStream); + workbook.SaveAs(Path.GetFullPath("Output/RichText.xlsx")); #endregion - - //Dispose streams - outputStream.Dispose(); } {% endhighlight %} 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 053e8a4f0..e6232f953 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 @@ -337,9 +337,7 @@ using (ExcelEngine excelEngine = new ExcelEngine()) validation.PromptBoxText = "Custom DataValidation"; validation.ShowPromptBox = true; - FileStream file = new FileStream("DataValidation.xlsx", FileMode.Create, FileAccess.ReadWrite); - workbook.SaveAs(file); - file.Dispose(); + workbook.SaveAs("DataValidation.xlsx"); } {% endhighlight %} diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-multiple-markers-in-a-single-Excel-cell.md b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-multiple-markers-in-a-single-Excel-cell.md new file mode 100644 index 000000000..75583ab19 --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/does-xlsio-support-multiple-markers-in-a-single-Excel-cell.md @@ -0,0 +1,11 @@ +--- +title: XlsIO support for multiple markers in a single cell | Syncfusion +description: Learn whether Syncfusion XlsIO supports multiple markers in a single Excel cell using the Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# Does XlsIO support multiple markers in a single Excel cell? + +No, XlsIO does not support multiple markers in a single Excel cell. Only one marker is allowed per cell when using template markers. \ No newline at end of file diff --git a/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-width-and-row-height-in-pixels.md b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-width-and-row-height-in-pixels.md new file mode 100644 index 000000000..36ab7fabc --- /dev/null +++ b/Document-Processing/Excel/Excel-Library/NET/faqs/how-to-get-the-column-width-and-row-height-in-pixels.md @@ -0,0 +1,87 @@ +--- +title: How to get the column width and row height in pixels | Syncfusion +description: Code example showing how to retrieve column width and row height in pixels using the Syncfusion .NET Excel library (XlsIO). +platform: document-processing +control: XlsIO +documentation: UG +--- + +# How to get the column width and row height in pixels? + +In Essential® XlsIO, you can obtain column widths and row heights in pixels by using the [GetColumnWidthInPixels](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorksheet.html#Syncfusion_XlsIO_IWorksheet_GetColumnWidthInPixels_System_Int32_) and [GetRowHeightInPixels](https://help.syncfusion.com/cr/document-processing/Syncfusion.XlsIO.IWorksheet.html#Syncfusion_XlsIO_IWorksheet_GetRowHeightInPixels_System_Int32_) methods. The below code snippet demonstrates this. + +{% tabs %} +{% highlight c# tabtitle="C# [Cross-platform]" %} +using (ExcelEngine excelEngine = new ExcelEngine()) +{ + IApplication application = excelEngine.Excel; + application.DefaultVersion = ExcelVersion.Xlsx; + FileStream inputStream = new FileStream("InputTemplate.xlsx", FileMode.Open, FileAccess.Read); + IWorkbook workbook = application.Workbooks.Open(inputStream); + IWorksheet worksheet = workbook.Worksheets[0]; + + var range = worksheet.UsedRange["A1"]; + + //Get the Column width in pixels + var width = worksheet.GetColumnWidthInPixels(range.Column); + + //Get the Row height in pixels + var height = worksheet.GetRowHeightInPixels(range.Row); + + #region Save + //Saving the workbook + FileStream outputStream = new FileStream("RowsandColumns.xlsx", FileMode.Create, FileAccess.Write); + workbook.SaveAs(outputStream); + #endregion + + //Dispose streams + outputStream.Dispose(); + inputStream.Dispose(); +} +{% 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]; + var range = worksheet.UsedRange["A1"]; + + //Get the Column width in pixels + var width = worksheet.GetColumnWidthInPixels(range.Column); + + //Get the Row height in pixels + var height = worksheet.GetRowHeightInPixels(range.Row); + + workbook.SaveAs("RowsandColumns.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.Excel2013 + Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xlsx", ExcelOpenType.Automatic) + Dim worksheet As IWorksheet = workbook.Worksheets(0) + + Dim range = worksheet.UsedRange("A1") + ' Column width in pixels + Dim width As Integer = worksheet.GetColumnWidthInPixels(range.Column) + ' Row height in pixels + Dim height As Integer = worksheet.GetRowHeightInPixels(range.Row) + + workbook.SaveAs("GridLineColor.xlsx") + End Using +{% endhighlight %} +{% endtabs %} + +## See Also + +* [How to format text within a cell?](https://help.syncfusion.com/document-processing/excel/excel-library/net/faqs/how-to-format-text-within-a-cell) +* [How to unfreeze the rows and columns in XlsIO?](https://help.syncfusion.com/document-processing/excel/excel-library/net/faqs/how-to-unfreeze-the-rows-and-columns-in-xlsio) +* [What is the maximum range of Rows and Columns?](https://help.syncfusion.com/document-processing/excel/excel-library/net/faqs/what-is-the-maximum-range-of-rows-and-columns) +* [How to find values with a matching case for specific column in Excel?](https://help.syncfusion.com/document-processing/excel/excel-library/net/faqs/how-to-find-values-with-a-matching-case-for-specific-column-in-excel) +* [How to protect certain cells in a worksheet?](https://help.syncfusion.com/document-processing/excel/excel-library/net/faqs/how-to-protect-certain-cells-in-a-worksheet) +* [How to search a value in only specific columns of an Excel worksheet?](https://help.syncfusion.com/document-processing/excel/excel-library/net/faqs/how-to-search-a-value-in-only-specific-columns-of-an-excel-worksheet)