GemBox.Spreadsheet
  • Overview
  • Examples
  • Free version
  • Support
  • Pricelist

    Show / Hide Table of Contents

    ExcelPrintOptions Class

    Namespace:
    GemBox.Spreadsheet
    Assembly:
    GemBox.Spreadsheet.dll

    Stores MS Excel print and print related options.

    • C#
    • VB.NET
    public sealed class ExcelPrintOptions
    Public NotInheritable Class ExcelPrintOptions
    Inheritance:
    System.Object
    ExcelPrintOptions

    Properties

    AutomaticPageBreakScalingFactor

    Scaling factor for automatic page breaks.

    • C#
    • VB.NET
    public int AutomaticPageBreakScalingFactor { get; set; }
    Public Property AutomaticPageBreakScalingFactor As Integer
    Property Value
    System.Int32
    Remarks

    Unit is one percent. Value must be between 10 and 400.

    Default value for this property is 100.

    MS Excel inserts automatic page breaks depending on this scaling factor. Smaller it gets, bigger will be the distance between the two automatic page breaks.

    If you set this property, FitToPage will automatically be set to false.

    Exceptions
    System.ArgumentOutOfRangeException

    Value is out of 10 to 400 range.

    BottomMargin

    Bottom margin (in inches).

    • C#
    • VB.NET
    public double BottomMargin { get; set; }
    Public Property BottomMargin As Double
    Property Value
    System.Double
    Remarks

    Default value for this property is 0.75.

    DraftQuality

    true for printing in draft quality, false otherwise.

    • C#
    • VB.NET
    public bool DraftQuality { get; set; }
    Public Property DraftQuality As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is false.

    This value is currently ignored when exporting a document to PDF, XPS, or image formats.

    This member is supported in Print().

    GemBox.Spreadsheet uses enhanced printing services provided with Windows Presentation Foundation (WPF). All pages of a specific ExcelWorksheet will be printed with settings from PrintOptions of that worksheet. Internally, WPF printing uses PrintTicket class to specify page printing settings and value of this member is applied to appropriate member of PrintTicket instance which is used to print all pages of a worksheet with this print options member.

    PrintTicket instance which is used to print every page of a worksheet is constructed in following order:

    Printing settings which do not exist in PrintOptions nor in ExcelPrintOptions can be specified on base print ticket (which stream is passed to PrintOptions(MemoryStream) constructor).

    FitToPage

    true for using FitWorksheetHeightToPages and FitWorksheetWidthToPages, false otherwise.

    • C#
    • VB.NET
    public bool FitToPage { get; set; }
    Public Property FitToPage As Boolean
    Property Value
    System.Boolean
    Remarks

    This property determines whether AutomaticPageBreakScalingFactor or FitWorksheetHeightToPages and FitWorksheetWidthToPages will be used in printing.

    Default value for this property is false.

    FitWorksheetHeightToPages

    Fit worksheet height to this number of pages (0 = use as many as needed).

    • C#
    • VB.NET
    public int FitWorksheetHeightToPages { get; set; }
    Public Property FitWorksheetHeightToPages As Integer
    Property Value
    System.Int32
    Remarks

    Default value for this property is 0.

    If you set this property, FitToPage will automatically be set to true.

    FitWorksheetWidthToPages

    Fit worksheet width to this number of pages (0 = use as many as needed).

    • C#
    • VB.NET
    public int FitWorksheetWidthToPages { get; set; }
    Public Property FitWorksheetWidthToPages As Integer
    Property Value
    System.Int32
    Remarks

    Default value for this property is 0.

    If you set this property, FitToPage will automatically be set to true.

    FooterMargin

    Footer margin (in inches).

    • C#
    • VB.NET
    public double FooterMargin { get; set; }
    Public Property FooterMargin As Double
    Property Value
    System.Double
    Remarks

    Default value for this property is 0.3.

    HeaderMargin

    Header margin (in inches).

    • C#
    • VB.NET
    public double HeaderMargin { get; set; }
    Public Property HeaderMargin As Double
    Property Value
    System.Double
    Remarks

    Default value for this property is 0.3.

    HorizontalCentered

    true for printing sheet horizontal centered, false otherwise.

    • C#
    • VB.NET
    public bool HorizontalCentered { get; set; }
    Public Property HorizontalCentered As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is false.

    LeftMargin

    Left margin (in inches).

    • C#
    • VB.NET
    public double LeftMargin { get; set; }
    Public Property LeftMargin As Double
    Property Value
    System.Double
    Remarks

    Default value for this property is 0.7.

    NumberOfCopies

    Number of copies to print.

    • C#
    • VB.NET
    public int NumberOfCopies { get; set; }
    Public Property NumberOfCopies As Integer
    Property Value
    System.Int32
    Remarks

    Default value for this property is 1.

    This value is currently ignored when exporting a document to PDF, XPS, or image formats.

    PageHeight

    Gets the height of the page (in inches).

    • C#
    • VB.NET
    public double PageHeight { get; }
    Public ReadOnly Property PageHeight As Double
    Property Value
    System.Double

    The height of the page.

    Remarks

    If the PaperType is Custom, this will return page height from printer settings.

    PageWidth

    Gets the width of the page (in inches).

    • C#
    • VB.NET
    public double PageWidth { get; }
    Public ReadOnly Property PageWidth As Double
    Property Value
    System.Double

    The width of the page.

    Remarks

    If the PaperType is Custom, this will return page width from printer settings.

    PaperType

    Gets or sets the type of the paper for the page.

    • C#
    • VB.NET
    public PaperType PaperType { get; set; }
    Public Property PaperType As PaperType
    Property Value
    PaperType

    The type of the paper.

    Remarks

    Default value for this property is A4.

    This member is supported in Print().

    GemBox.Spreadsheet uses enhanced printing services provided with Windows Presentation Foundation (WPF). All pages of a specific ExcelWorksheet will be printed with settings from PrintOptions of that worksheet. Internally, WPF printing uses PrintTicket class to specify page printing settings and value of this member is applied to appropriate member of PrintTicket instance which is used to print all pages of a worksheet with this print options member.

    PrintTicket instance which is used to print every page of a worksheet is constructed in following order:

    Printing settings which do not exist in PrintOptions nor in ExcelPrintOptions can be specified on base print ticket (which stream is passed to PrintOptions(MemoryStream) constructor).

    Exceptions
    System.ArgumentException

    Thrown if type is set to Custom

    Portrait

    true for portrait orientation, false for landscape orientation.

    • C#
    • VB.NET
    public bool Portrait { get; set; }
    Public Property Portrait As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is true.

    This member is supported in Print().

    GemBox.Spreadsheet uses enhanced printing services provided with Windows Presentation Foundation (WPF). All pages of a specific ExcelWorksheet will be printed with settings from PrintOptions of that worksheet. Internally, WPF printing uses PrintTicket class to specify page printing settings and value of this member is applied to appropriate member of PrintTicket instance which is used to print all pages of a worksheet with this print options member.

    PrintTicket instance which is used to print every page of a worksheet is constructed in following order:

    Printing settings which do not exist in PrintOptions nor in ExcelPrintOptions can be specified on base print ticket (which stream is passed to PrintOptions(MemoryStream) constructor).

    PrintBlackWhite

    true for printing in black and white, false otherwise.

    • C#
    • VB.NET
    public bool PrintBlackWhite { get; set; }
    Public Property PrintBlackWhite As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is false.

    This value is currently ignored when exporting a document to PDF, XPS, or image formats.

    This member is supported in Print().

    GemBox.Spreadsheet uses enhanced printing services provided with Windows Presentation Foundation (WPF). All pages of a specific ExcelWorksheet will be printed with settings from PrintOptions of that worksheet. Internally, WPF printing uses PrintTicket class to specify page printing settings and value of this member is applied to appropriate member of PrintTicket instance which is used to print all pages of a worksheet with this print options member.

    PrintTicket instance which is used to print every page of a worksheet is constructed in following order:

    Printing settings which do not exist in PrintOptions nor in ExcelPrintOptions can be specified on base print ticket (which stream is passed to PrintOptions(MemoryStream) constructor).

    PrintCellNotes

    true for printing cell notes, false otherwise.

    • C#
    • VB.NET
    public bool PrintCellNotes { get; set; }
    Public Property PrintCellNotes As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is false.

    This value is currently ignored when exporting a document to PDF, XPS, or image formats.

    PrintGridlines

    true for printing gridlines, false otherwise.

    • C#
    • VB.NET
    public bool PrintGridlines { get; set; }
    Public Property PrintGridlines As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is false.

    PrintHeadings

    true for print headings, false otherwise.

    • C#
    • VB.NET
    public bool PrintHeadings { get; set; }
    Public Property PrintHeadings As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is false.

    PrintNotesSheetEnd

    true for printing notes at end of sheet, false otherwise.

    • C#
    • VB.NET
    public bool PrintNotesSheetEnd { get; set; }
    Public Property PrintNotesSheetEnd As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is false.

    This value is currently ignored when exporting a document to PDF, XPS, or image formats.

    PrintPagesInRows

    true for printing pages in rows, false otherwise.

    • C#
    • VB.NET
    public bool PrintPagesInRows { get; set; }
    Public Property PrintPagesInRows As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is false.

    This member is supported in Print().

    GemBox.Spreadsheet uses enhanced printing services provided with Windows Presentation Foundation (WPF). All pages of a specific ExcelWorksheet will be printed with settings from PrintOptions of that worksheet. Internally, WPF printing uses PrintTicket class to specify page printing settings and value of this member is applied to appropriate member of PrintTicket instance which is used to print all pages of a worksheet with this print options member.

    PrintTicket instance which is used to print every page of a worksheet is constructed in following order:

    Printing settings which do not exist in PrintOptions nor in ExcelPrintOptions can be specified on base print ticket (which stream is passed to PrintOptions(MemoryStream) constructor).

    PrintResolution

    Print resolution in DPI (dots per inch).

    • C#
    • VB.NET
    public int PrintResolution { get; set; }
    Public Property PrintResolution As Integer
    Property Value
    System.Int32
    Remarks

    Default value for this property is 0.

    This value is currently ignored when exporting a document to PDF, XPS, or image formats.

    This member is supported in Print().

    GemBox.Spreadsheet uses enhanced printing services provided with Windows Presentation Foundation (WPF). All pages of a specific ExcelWorksheet will be printed with settings from PrintOptions of that worksheet. Internally, WPF printing uses PrintTicket class to specify page printing settings and value of this member is applied to appropriate member of PrintTicket instance which is used to print all pages of a worksheet with this print options member.

    PrintTicket instance which is used to print every page of a worksheet is constructed in following order:

    Printing settings which do not exist in PrintOptions nor in ExcelPrintOptions can be specified on base print ticket (which stream is passed to PrintOptions(MemoryStream) constructor).

    RightMargin

    Right margin (in inches).

    • C#
    • VB.NET
    public double RightMargin { get; set; }
    Public Property RightMargin As Double
    Property Value
    System.Double
    Remarks

    Default value for this property is 0.7.

    StartPageNumber

    Start page number.

    • C#
    • VB.NET
    public int StartPageNumber { get; set; }
    Public Property StartPageNumber As Integer
    Property Value
    System.Int32
    Remarks

    Default value for this property is 1.

    TopMargin

    Top margin (in inches).

    • C#
    • VB.NET
    public double TopMargin { get; set; }
    Public Property TopMargin As Double
    Property Value
    System.Double
    Remarks

    Default value for this property is 0.75.

    UseStartPageNumber

    true for using start page number, false otherwise.

    • C#
    • VB.NET
    public bool UseStartPageNumber { get; set; }
    Public Property UseStartPageNumber As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is false.

    VerticalCentered

    true for printing sheet vertical centered, false otherwise.

    • C#
    • VB.NET
    public bool VerticalCentered { get; set; }
    Public Property VerticalCentered As Boolean
    Property Value
    System.Boolean
    Remarks

    Default value for this property is false.

    VerticalPrintResolution

    Vertical print resolution in DPI (dots per inch).

    • C#
    • VB.NET
    public int VerticalPrintResolution { get; set; }
    Public Property VerticalPrintResolution As Integer
    Property Value
    System.Int32
    Remarks

    Default value for this property is 0.

    This value is currently ignored when exporting a document to PDF, XPS, or image formats.

    This member is supported in Print().

    GemBox.Spreadsheet uses enhanced printing services provided with Windows Presentation Foundation (WPF). All pages of a specific ExcelWorksheet will be printed with settings from PrintOptions of that worksheet. Internally, WPF printing uses PrintTicket class to specify page printing settings and value of this member is applied to appropriate member of PrintTicket instance which is used to print all pages of a worksheet with this print options member.

    PrintTicket instance which is used to print every page of a worksheet is constructed in following order:

    Printing settings which do not exist in PrintOptions nor in ExcelPrintOptions can be specified on base print ticket (which stream is passed to PrintOptions(MemoryStream) constructor).

    Methods

    Equals(Object)

    Determines whether the specified ExcelPrintOptions is equal to the current ExcelPrintOptions.

    • C#
    • VB.NET
    public override bool Equals(object obj)
    Public Overrides Function Equals(obj As Object) As Boolean
    Parameters
    obj
    System.Object

    Object of ExcelPrintOptions type.

    Returns
    System.Boolean

    true if the specified ExcelPrintOptions is equal to the current ExcelPrintOptions; otherwise, false.

    Overrides
    System.Object.Equals(System.Object)

    GetHashCode()

    Returns the hash code of this object.

    • C#
    • VB.NET
    public override int GetHashCode()
    Public Overrides Function GetHashCode As Integer
    Returns
    System.Int32

    Hash code.

    Overrides
    System.Object.GetHashCode()

    SetPrinterSettings(Byte[])

    Sets the printer settings by using a byte array that contains the DEVMODE structure that corresponds to the printer settings.

    • C#
    • VB.NET
    public void SetPrinterSettings(byte[] devMode)
    Public Sub SetPrinterSettings(devMode As Byte())
    Parameters
    devMode
    System.Byte[]

    A byte array that contains the DEVMODE structure.

    See Also
    DEVMODE structure
    How can I save and restore PrinterSettings?

    SetPrinterSettings(IntPtr)

    Sets the printer settings by using a handle to a DEVMODE structure that corresponds to the printer settings.

    • C#
    • VB.NET
    public void SetPrinterSettings(IntPtr hdevmode)
    Public Sub SetPrinterSettings(hdevmode As IntPtr)
    Parameters
    hdevmode
    System.IntPtr

    A handle to a DEVMODE structure obtained from System.Drawing.Printing.PrinterSettings.GetHdevmode method.

    Remarks

    Handle is automatically deallocated by calling the native Win32 GlobalFree method before this method ends.

    See Also
    System.Drawing.Printing.PrinterSettings
    System.Drawing.Printing.PrinterSettings.GetHdevmode
    DEVMODE structure

    SetPrinterSettings(String, Stream)

    Sets the printer settings by using a printer name and an XML stream (that contains a System.Printing.PrintTicket document) that complies with the XML Print Schema.

    • C#
    • VB.NET
    public void SetPrinterSettings(string printerName, Stream xmlStream)
    Public Sub SetPrinterSettings(printerName As String, xmlStream As Stream)
    Parameters
    printerName
    System.String

    Name of the printer.

    xmlStream
    System.IO.Stream

    An XML stream that describes a print job and conforms to the Print Schema.

    See Also
    System.Printing.PrintTicket
    System.Printing.PrintTicket.GetXmlStream
    Print Schema
    Back to top

    Facebook • Twitter • LinkedIn

    © GemBox Ltd. — All rights reserved.