You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
title: How to get the column width and row height in pixels | Syncfusion
3
+
description: Code example showing how to retrieve column width and row height in pixels using the Syncfusion .NET Excel library (XlsIO).
4
+
platform: document-processing
5
+
control: XlsIO
6
+
documentation: UG
7
+
---
8
+
9
+
# How to get the column width and row height in pixels?
10
+
11
+
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.
12
+
13
+
{% tabs %}
14
+
{% highlight c# tabtitle="C# [Cross-platform]" %}
15
+
using (ExcelEngine excelEngine = new ExcelEngine())
16
+
{
17
+
IApplication application = excelEngine.Excel;
18
+
application.DefaultVersion = ExcelVersion.Xlsx;
19
+
FileStream inputStream = new FileStream("InputTemplate.xlsx", FileMode.Open, FileAccess.Read);
Dim workbook As IWorkbook = application.Workbooks.Open("InputTemplate.xlsx", ExcelOpenType.Automatic)
67
+
Dim worksheet As IWorksheet = workbook.Worksheets(0)
68
+
69
+
Dim range = worksheet.UsedRange("A1")
70
+
' Column width in pixels
71
+
Dim width As Integer = worksheet.GetColumnWidthInPixels(range.Column)
72
+
' Row height in pixels
73
+
Dim height As Integer = worksheet.GetRowHeightInPixels(range.Row)
74
+
75
+
workbook.SaveAs("GridLineColor.xlsx")
76
+
End Using
77
+
{% endhighlight %}
78
+
{% endtabs %}
79
+
80
+
## See Also
81
+
82
+
*[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)
83
+
*[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)
84
+
*[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)
85
+
*[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)
86
+
*[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)
87
+
*[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)
0 commit comments