FlexCelPrintDocument Class
A PrintDocument descendant that can be used to print and preview an Excel document.
Syntax
Namespace: FlexCel.Render
public class FlexCelPrintDocument: PrintDocument
Constructors
Name | Description |
---|---|
FlexCelPrintDocument | Overloaded FlexCelPrintDocument FlexCelPrintDocument(ExcelFile) |
Methods
Name | Description |
---|---|
OnGetPrinterHardMargins | Replace this event when creating a custom descendant of FlexCelPrintDocument. |
OnBeginPrint | Raises the BeginPrint event. It is called after the Print method is called and before the first page of the document prints. |
OnEndPrint | Raises the EndPrint event. It is called after the Print method has finished. |
OnBeforePrintPage | Replace this event when creating a custom descendant of FlexCelPrintDocument. |
OnQueryPageSettings | Overrides the standard method to change landscape or portrait settings when AllVisibleSheets is true. You can override this method on a descendant class to change the behavior./> |
OnPrintPage | Raises the PrintDocument.PrintPage event. It is called before a page prints. |
Properties
Name | Description |
---|---|
Workbook | The ExcelFile to print. |
HidePrintObjects | Select which kind of objects should not be printed or exported to pdf. |
ExportSheetBackgroundImages | If false (the default) then the background images in the sheet won't be printed. Note that Excel doesn't print background images, and when it shows them on the screen they look the same no matter the sheet zoom. When you set this to true we will try to print the image, but it will grow and shrink when you zoom, making it look different from what Excel shows. |
AntiAliasedText | When true, the text will be antialiased. Depending on the device display might look better, but it consumes more processor time. |
PrintRangeLeft | First column to print (1 based). if this or any other PrintRange property is 0, the range will be automatically calculated. |
PrintRangeTop | First row to print (1 based). if this or any other PrintRange property is 0, the range will be automatically calculated. |
PrintRangeRight | Last column to print (1 based). if this or any other PrintRange property is 0, the range will be automatically calculated. |
PrintRangeBottom | Last row to print (1 based). if this or any other PrintRange property is 0, the range will be automatically calculated. |
AllVisibleSheets | If true, All visible sheets on the workbook will be printed. See ResetPageNumberOnEachSheet for behavior of the page number when printing multiple sheets. |
ResetPageNumberOnEachSheet | This property only makes sense when AllVisibleSheets is true. On that case, if this property is true each sheet of the workbook will have the page number reset. For example if the xls file has 2 sheets and each has 3 pages: When ResetPageNumberOnEachSheet = true then footers will look like "Page 1 of 3". If false, they will look like "Page 5 of 6" |
CurrentPage | Returns the next page that we are going to print. |
CurrentPageInSheet | Returns the next page we are going to print, on the current sheet. When not printing more than one sheet, it is equivalent to CurrentPage |
Events
Name | Description |
---|---|
GetPrinterHardMargins | On .NET there is no way to get the actual physical margins of a printer without a p/invoke. As FlexCel doesn't contain p/invokes (in order to be portable to any platform), it will try to guess the best value for them by averaging the printer visible clip area. If you are not getting good results, you can let FlexCel know the real printer margins on this event. Normally, you would call GetDeviceCaps for this. |
BeforePrintPage | Fires before printing each sheet, so you can print and set up your own stuff before FlexCel renders the page. |