Print multiple copies of a worksheet
Contents
[
Hide
]
Print multiple copies of a worksheet
Aspose.Cells provides the ability to print multiple copies of a worksheet by using the SheetRender.ToPrinter(PrintSettings PrinterSettings) method. The following code snippet demonstrates the use of SheetRender.ToPrinter(PrintSettings PrinterSettings) method to print multiple copies of a worksheet. The following code snippet uses this sample excel file.
Sample Code
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-.NET | |
//Source directory | |
string sourceDir = RunExamples.Get_SourceDirectory(); | |
//Load source Excel file | |
Workbook workbook = new Workbook(sourceDir + "SheetRenderSample.xlsx"); | |
ImageOrPrintOptions imgOpt = new ImageOrPrintOptions(); | |
//Access first worksheet | |
Worksheet worksheet = workbook.Worksheets[1]; | |
SheetRender sheetRender = new SheetRender(worksheet, imgOpt); | |
PrinterSettings printerSettings = new PrinterSettings(); | |
printerSettings.PrinterName = "<PRINTER NAME>"; | |
printerSettings.Copies = 2; | |
sheetRender.ToPrinter(printerSettings); |