We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Print multiple copies question


I am using the following code to print the excel workbook, but it doesn't seem to respect the copies number I input in the print dialogue, it always just print one copy, I am not sure this is a bug or I miss to set up some properties?

MyWorkBook = New Workbook("C:\Users\wmeng\Desktop\ChartTest1.xlsx")

Dim options As New Aspose.Cells.Rendering.ImageOrPrintOptions()

Dim pdlg As New PrintDialog

Dim wr As WorkbookRender

Dim ws As Worksheet = MyWorkBook.Worksheets(0)

If pdlg.ShowDialog() = DialogResult.OK Then

options.PrintingPage = PrintingPageType.Default

wr = New WorkbookRender(MyWorkBook, options)


End If



I think you may try the following options if it works for your needs:

1) Use Worksheet.PageSetup.PrintCopies attribute to print your desired number of copies and set it for your sheet(s) before rendering to printer.

2) See the sample code below for your reference, you may try to use the PrinterSettings.Copies property before rendering:
Sample code:

Dim workbook As New Workbook(“e:\test2\Book1.xlsx”)

Dim ws As Worksheet = workbook.Worksheets(0)
Dim printSettings As New System.Drawing.Printing.PrinterSettings()
printSettings.Copies = 3
Dim strPrinterName As String = printSettings.PrinterName

'printing Worksheet
Dim options As New Aspose.Cells.Rendering.ImageOrPrintOptions()
options.PrintingPage = PrintingPageType.Default
Dim wr As New Aspose.Cells.Rendering.WorkbookRender(workbook, options)

Thank you.

Hi <span style=“font-size:12.0pt;font-family:“Times New Roman”,“serif”;
mso-fareast-font-family:“Times New Roman”;mso-ansi-language:EN-CA;mso-fareast-language:
ZH-CN;mso-bidi-language:AR-SA”>Amjad ,

Thanks for your update, this solution doesn’t meet our requirement. We want to take the copies number from print dialog which users has choice to select how many copies to print, not hard code in the program.
when I use this wr.ToPrinter(pdlg.PrinterSettings) statement to print, I checked the copies properties value in the pdlg.PrinterSetting is correct number, but it doesn’t print the number of copies when it actually print. Somehow I think this maybe a bug.



Thanks for providing further details.

I have logged a ticket with an id “CELLSNET-43133” for your issue into our database. We need to thoroughly investigate and look into it if there is an issue when
printing multiple copies of the document using the Printer dialog box
while rendering to Printer by Aspose.Cells’ WorkbookRender APIs. We will look into it soon.

Once we have any update on it, we will let you know here.

Thank you.

Hi Wei,

Thanks for your using Aspose.Cells.

Please download and try the latest fix: Aspose.Cells for .NET v8.2.2.2 and let us know your feedback.

I have tried the new fix, it works great. Thanks for the quick fix.



Good to know that it figures out your issue now. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.

The issues you have found earlier (filed as CELLSNET-43133) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.