Show and Hide Gridlines and Row Column Headers

Show and Hide Gridlines

All Excel worksheets have gridlines by default. They help delineate cells so that it is easy to enter data into particular cells. Gridlines enable us to view a worksheet as a collection of cells, where each cell is easily identifiable.

Controlling the Visibility of the Gridlines

Aspose.Cells for Python via .NET provides a class, Workbook, that represents a Microsoft Excel file. The Workbook class contains a worksheets collection that allows developers to access each worksheet in the Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a wide range of properties and methods for managing a worksheet. To control the visibility of gridlines, use the Worksheet class is_gridlines_visible property. is_gridlines_visible is a Boolean property, which means that it can only store a true or false value.

Making Gridlines Visible

Make the gridlines visible by setting the Worksheet class is_gridlines_visible property to true.

Hiding Gridlines

Hide gridlines by setting the Worksheet class is_gridlines_visible property to false.

A complete example is given below that demonstrates the use of the is_gridlines_visible property by opening an excel file(book1.xls), hiding the gridlines on the first worksheet and saving the modified file as output.xls.

Show and Hide Row Column Headers

All worksheets in an Excel file are composed of cells that are arranged in rows and columns. All rows and columns have unique values that are used to identify them and to identify individual cells. For example, rows are numbered – 1, 2, 3, 4, etc. – and columns are ordered alphabetically – A, B, C, D, etc. The row and column values are displayed in the headers. Using Aspose.Cells for Python via .NET, developers can control the visibility of these row and column headers.

Controlling the Visibility of the Worksheets

Aspose.Cells for Python via .NET provides a class, Workbook, that represents a Microsoft Excel file. The Workbook class contains a worksheets collection that allows developers to access each worksheet in the Excel file. A worksheet is represented by the Worksheet class. The Worksheet class provides a wide range of properties and methods for managing a worksheet. To control the visibility of row and column headers, use the Worksheet class is_row_column_headers_visible property. is_row_column_headers_visible is a Boolean property, which means that it can only store a true or false value.

Making Row/Column Headers Visible

Make row and column headers visible by setting the Worksheet class is_row_column_headers_visible property to true.

Hiding Row/Column Headers

Hide row and column headers by setting the Worksheet class is_row_column_headers_visible property to false.

A complete example is given below that shows how to use the is_row_column_headers_visible property by opening an excel file(book1.xls), hiding the row and column headers on the first worksheet and saving the modified file as output.xls.