Print multiple copies of a worksheet
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
// 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); |