Back to Devexpress

WorksheetPrintOptions.BlackAndWhite Property

officefileapi-devexpress-dot-spreadsheet-dot-worksheetprintoptions-ced3ca37.md

latest3.8 KB
Original Source

WorksheetPrintOptions.BlackAndWhite Property

Gets or sets whether to print the worksheet in black and white or in color.

Namespace : DevExpress.Spreadsheet

Assembly : DevExpress.Spreadsheet.v25.2.Core.dll

NuGet Package : DevExpress.Spreadsheet.Core

Declaration

csharp
bool BlackAndWhite { get; set; }
vb
Property BlackAndWhite As Boolean

Property Value

TypeDescription
Boolean

true , to print the worksheet in black and white; otherwise, false.

|

Property Paths

You can access this nested property as listed below:

Object TypePath to BlackAndWhite
Worksheet

.PrintOptions .BlackAndWhite

|

Remarks

Use this property to print your worksheet in black and white.

Example

This example demonstrates how to specify print options.

Note

The WorksheetPrintOptions.Draft, WorksheetPrintOptions.NumberOfCopies and WorksheetPrintOptions.CommentsPrintMode options are not supported when you print a document from the Spreadsheet. However, they are saved to a file, so you can use Microsoft® Excel® or another spreadsheet application to load and print a document.

View Example

csharp
worksheet.ActiveView.Orientation = PageOrientation.Landscape;
// Display row and column headings.
worksheet.ActiveView.ShowHeadings = true;
worksheet.ActiveView.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4;
// Access an object that contains print options.
WorksheetPrintOptions printOptions = worksheet.PrintOptions;
// Do not print gridlines.
printOptions.PrintGridlines = false;
// Scale the print area to fit to the width of two pages.
printOptions.FitToPage = true;
printOptions.FitToWidth = 2;
// Print in black and white.
printOptions.BlackAndWhite = true;
// Print a dash instead of a cell error message.
printOptions.ErrorsPrintMode = ErrorsPrintMode.Dash;
vb
worksheet.ActiveView.Orientation = PageOrientation.Landscape
' Display row and column headings.
worksheet.ActiveView.ShowHeadings = True
worksheet.ActiveView.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.A4
' Access an object that contains print options.
Dim printOptions As WorksheetPrintOptions = worksheet.PrintOptions
' Do not print gridlines.
printOptions.PrintGridlines = False
' Scale the print area to fit to the width of two pages.
printOptions.FitToPage = True
printOptions.FitToWidth = 2
' Print in black and white.
printOptions.BlackAndWhite = True
' Print a dash instead of a cell error message.
printOptions.ErrorsPrintMode = ErrorsPrintMode.Dash

See Also

WorksheetPrintOptions Interface

WorksheetPrintOptions Members

DevExpress.Spreadsheet Namespace