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.

NOTE

A complete sample project is available at https://github.com/DevExpress-Examples/wpf-spreadsheet-chart-api-t113198.

Dim worksheet As Worksheet = workbook.Worksheets("chartTask1")
workbook.Unit = DevExpress.Office.DocumentUnit.Inch

' Create a chart sheet containing a pie chart.
Dim chartSheet As ChartSheet = workbook.ChartSheets.Add(ChartType.Pie, worksheet("B2:C7"))

' Specify print settings.
chartSheet.ActiveView.Orientation = PageOrientation.Landscape
chartSheet.ActiveView.PaperKind = System.Drawing.Printing.PaperKind.Letter

' Specify page margins.
Dim pageMargins As Margins = chartSheet.ActiveView.Margins
pageMargins.Left = 0.7F
pageMargins.Top = 0.75F
pageMargins.Right = 0.7F
pageMargins.Bottom = 0.75F

workbook.ChartSheets.ActiveChartSheet = chartSheet