ExcelPrintOptions Class
Stores MS Excel print and print related options.
- Inheritance:
- System.ObjectExcelPrintOptions
Properties
AutomaticPageBreakScalingFactor
Scaling factor for automatic page breaks.
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).
Property Value
- System.Double
Remarks
Default value for this property is 0.75.
DraftQuality
true for printing in draft quality, false otherwise.
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.
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).
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).
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).
Property Value
- System.Double
Remarks
Default value for this property is 0.3.
HeaderMargin
Header margin (in inches).
Property Value
- System.Double
Remarks
Default value for this property is 0.3.
HorizontalCentered
true for printing sheet horizontal centered, false otherwise.
Property Value
- System.Boolean
Remarks
Default value for this property is false.
LeftMargin
Left margin (in inches).
Property Value
- System.Double
Remarks
Default value for this property is 0.7.
NumberOfCopies
Number of copies to print.
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).
Property Value
- System.Double
The height of the page.
Remarks
If the PaperType is Custom, this will return page height from printer settings.
Accessing printer settings (if PaperType is Custom) doesn't work in Medium Trust.
PageWidth
Gets the width of the page (in inches).
Property Value
- System.Double
The width of the page.
Remarks
If the PaperType is Custom, this will return page width from printer settings.
Accessing printer settings (if PaperType is Custom) doesn't work in Medium Trust.
PaperType
Gets or sets the type of the paper for the page.
Property Value
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.
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.
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.
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.
Property Value
- System.Boolean
Remarks
Default value for this property is false.
PrintHeadings
true for print headings, false otherwise.
Property Value
- System.Boolean
Remarks
Default value for this property is false.
PrintNotesSheetEnd
true for printing notes at end of sheet, false otherwise.
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.
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).
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).
Property Value
- System.Double
Remarks
Default value for this property is 0.7.
StartPageNumber
Start page number.
Property Value
- System.Int32
Remarks
Default value for this property is 1.
TopMargin
Top margin (in inches).
Property Value
- System.Double
Remarks
Default value for this property is 0.75.
UseStartPageNumber
true for using start page number, false otherwise.
Property Value
- System.Boolean
Remarks
Default value for this property is false.
VerticalCentered
true for printing sheet vertical centered, false otherwise.
Property Value
- System.Boolean
Remarks
Default value for this property is false.
VerticalPrintResolution
Vertical print resolution in DPI (dots per inch).
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.
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
GetHashCode()
Returns the hash code of this object.
Returns
- System.Int32
Hash code.
Overrides
SetPrinterSettings(Byte[])
Sets the printer settings by using a byte array that contains the DEVMODE structure that corresponds to the printer settings.
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
SetPrinterSettings(IntPtr)
Sets the printer settings by using a handle to a DEVMODE structure that corresponds to the printer settings.
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.
Setting printer settings doesn't work in Medium Trust.
See Also
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.
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.
Remarks
Setting printer settings doesn't work in Medium Trust.