Back to Devexpress

How to: Show and Hide Gridlines

windowsforms-15371-controls-and-libraries-spreadsheet-examples-worksheets-how-to-show-and-hide-gridlines.md

latest1.9 KB
Original Source

How to: Show and Hide Gridlines

  • Dec 09, 2022

Use the Worksheet.ActiveView.ShowGridlines property to display or hide worksheet gridlines.

Note

The Worksheet.PrintOptions.PrintGridlines property allows you to specify whether worksheet gridlines should be printed. Refer to the following help topic for more information on how to specify print options for a worksheet: How to: Specify Print Settings.

The following example hides gridlines for the first worksheet in a workbook:

View Example

csharp
workbook.Worksheets[0].ActiveView.ShowGridlines = false;
vb
workbook.Worksheets(0).ActiveView.ShowGridlines = False

Change the Gridline Color

Use the WorksheetView.GridlineColor property to change the color of worksheet gridlines.

csharp
workbook.Worksheets[0].ActiveView.GridlineColor = Color.Blue;
vb
workbook.Worksheets(0).ActiveView.GridlineColor = Color.Blue

The image below demonstrates the result.

See Also

Worksheets in Spreadsheet Documents