Skip to main content

How to: Specify Chart Sheet Print Options

This example demonstrates how set print options for a chart sheet by using properties of the ChartSheetView object returned by the ChartSheet.ActiveView property. This object enables you to set page orientation, margins and paper size.

Use the ChartSheet.PrintOptions property to specify additional print options.

View Example

Worksheet worksheet = workbook.Worksheets["chartTask1"];
workbook.Unit = DevExpress.Office.DocumentUnit.Inch;

// Create a chart sheet containing a pie chart.
ChartSheet chartSheet = workbook.ChartSheets.Add(ChartType.Pie, worksheet["B2:C7"]);

// Specify print settings.
chartSheet.ActiveView.Orientation = PageOrientation.Landscape;
chartSheet.ActiveView.PaperKind = DevExpress.Drawing.Printing.DXPaperKind.Letter;

// Specify page margins.
Margins pageMargins = chartSheet.ActiveView.Margins;
pageMargins.Left = 0.7F;
pageMargins.Top = 0.75F;
pageMargins.Right = 0.7F;
pageMargins.Bottom = 0.75F;

workbook.ChartSheets.ActiveChartSheet = chartSheet;