Hiding and Showing Rows and Columns
Controlling the Visibility of Rows and Columns
Aspose.Cells for Python via .NET provides a class, Workbook, that represents a Microsoft Excel file. The Workbook class contains a WorksheetCollection that allows developers to access each worksheet in the Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a cells collection that represents all cells in the worksheet. The cells collection provides several methods for managing rows or columns in a worksheet. A few of these are discussed below.
How to Hide Rows and Columns
Developers can hide a row or column by calling the hide_row and hide_column methods of the cells collection respectively. Both methods take the row and column index as a parameter to hide the specific row or column.
How to Show Rows and Columns
Developers can show any hidden row or column by calling the unhide_row and unhide_column methods of the cells collection respectively. Both methods take two parameters:
- Row or column index - the index of a row or column that is used to show the specific row or column.
- Row height or column width - the row height or column width assigned to the row or column after unhiding.
How to Hide Multiple Rows and Columns
Developers can hide multiple rows or columns at once by calling the hide_rows and hide_columns methods of the cells collection respectively. Both methods take the starting row or column index and the number of rows or columns that should be hidden as parameters.