Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

How to: Show and Hide Gridlines

Important

You need a license for the DevExpress Office File API Subscription or DevExpress Universal Subscription to use these examples in production code.

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

workbook.Worksheets[0].ActiveView.ShowGridlines = false;

A worksheet with hidden gridlines

#Change the Gridline Color

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

workbook.Worksheets[0].ActiveView.GridlineColor = Color.Blue;

The image below demonstrates the result.

A worksheet with blue gridlines