Me.spreadsheet1.Workbook.Worksheets(0).DisplayOptions.ShowGridlines = True
This topic explains how to show or hide the gridlines and set their color.
The following topics are prerequisites to understanding this topic:
This topic contains the following sections:
The gridlines are used to visually separate the cells in the worksheet. You may show or hide the gridlines and also change their color.
The following screenshot shows the gridlines displayed with their default gray color:
The following table explains briefly the configurable aspects of the gridlines and maps them to the properties that configure them.
You can show or hide the gridlines using the ShowGridlines
property.
The following table maps the desired configuration to the property settings that manage it.
The following code snippet demonstrates how to show the gridlines on the first worksheet of the opened workbook.
In Visual Basic:
Me.spreadsheet1.Workbook.Worksheets(0).DisplayOptions.ShowGridlines = True
In C#:
this.spreadsheet1.Workbook.Worksheets[0].DisplayOptions.ShowGridlines = true;
You can configure the gridlines’ color using the GridlineColor
property.
The following table maps the desired configuration to the property settings that manage it.
The following code snippet demonstrates how to set the gridlines’ color to red.
In Visual Basic:
Me.spreadsheet1.Workbook.Worksheets(0).DisplayOptions.GridlineColor = Colors.Red
In C#:
this.spreadsheet1.Workbook.Worksheets[0].DisplayOptions.GridlineColor = Colors.Red;
The following topics provide additional information related to this topic.