Delete Blank Rows and Columns in a Worksheet
Contents
[
Hide
]
It is possible to delete all blank rows and columns from a worksheet. This is useful when, for example, generating a PDF file from a Microsoft Excel file and want to convert only rows and columns that contain data or related object.
Use the following Aspose.Cells methods to delete empty rows and columns:
- To delete blank rows, use the Cells.DeleteBlankRows() method. Please note, for blank rows that will be deleted, it is not only required that Row.IsBlank should be true, but also there should be no visible comment defined for any cell in those rows, and no pivot table whose range intersects with them.
- To delete blank columns, use the Cells.DeleteBlankColumns() method.
C# code to delete Blank Rows
C# code to Delete Blank Columns