We aren’t able to print on a different papersource in Aspose.Cells. Is there a way to do this. We tried the following code:
Private sr As SheetRender
Private pd As New PrintDocument
Private Sub ToPrinter(ByVal Tray As PaperSource)
Dim book As Workbook = New Workbook("test.xlsx")
Dim io As New ImageOrPrintOptions
io.ImageFormat = System.Drawing.Imaging.ImageFormat.Tiff
pd.PrinterSettings.PrinterName = cboprinter.SelectedItem
For Each _ps As PaperSource In pd.PrinterSettings.PaperSources
If _ps.RawKind = Tray.RawKind Then
pd.DefaultPageSettings.PaperSource = _ps
End If
Next
Dim pe As New PrintPageEventHandler(AddressOf PrintPage)
'Dim qe As New QueryPageSettingsEventHandler(AddressOf QueryPage)
io.CustomPrintPageEventHandler = pe
'io.CustomQueryPageSettingsHandler = pe
sr = New SheetRender(book.Worksheets(0), io)
sr.ToPrinter(cboprinter.SelectedItem)
End Sub
'Private Sub QueryPage(ByVal sender As Object, ByVal ev As QueryPageSettingsEventArgs)
' ev.PageSettings.PaperSource = pd.DefaultPageSettings.PaperSource
'End Sub
Private Sub PrintPage(ByVal sender As Object, ByVal ev As System.Drawing.Printing.PrintPageEventArgs)
ev.PageSettings.PaperSource = pd.DefaultPageSettings.PaperSource
sr.CustomPrint(False, ev)
ev.HasMorePages = False
End Sub
But I think it should be in the queryPageSettings handler instead of the printPage. Problem is that we can’t add a handler to this queryPageSettings.
We tried everything, we do it now with the aspose.pdf.facade, but it takes very long and the quality isn’t good enough.
Does someone knows a solution?
It seems your issue is not related with Aspose.Cells. Could you elaborate your issue more? It will help us look into your issue more closely and we will be able to help you asap.
The issues is certainly related to Aspose.Cells. We are trying to print a worksheet to a printer with different papersources (trays). for example: sheet 1 from workbook 1 to tray 1, sheet 1 from workbook 2 to bypass tray, ...
For this we were using the ImageOrPrintOptions class of the aspose.cells.rendering namespace and the sheetrender.toprinter function. This code we get from an old topic (293308). But this is not working. For this reason we have created some additional functions to save the (excel) cells document to a pdf and print the pdf on the tray. This is working, but the quality is poor and the printing time is too high for our customer.
In our tests we tried the print a printdocument of the .net framework with setting the papersource in the PrintPage method with the same result (not working). But if we place it in the QueryPageSettings handler it works perfectly. This handler is not available in the ImageOrPrintOptions class of aspose.cells. (This code we added in comment in the example above)
You cannot change the paper source in .NET Framework as we requested you to provide demo project earlier in this post. However, we have logged your issue in our database for investigation. We will look into it and if possible implement this feature. Once, we will have some fix or update for you, we will let you know asap.
is this something for the near future or could this take several months? Just because a customer is complaining about the printing speed and we need to find a solution. Otherwise we will have to look for an other possibility.
Attached a demo project where we are able to print a printdocument in .net to different papersources.
Thank you for sharing your sample project. I have attached it to the ticket (CELLSNET-42063) already associated with this thread.
Regarding the status of the ticket, I am afraid; it is pending for analysis, and therefore we can not share a estimated release schedule for this feature (if applicable). Please spare us little time to properly analyze the problem, and to check the feasibility for its implementation. As soon as we have any updates in this regard, we will share here for your reference.
As we described above, the provided code is not working. If we print with this code the printer is taking the paper from the default tray.<span style=“font-size:10.0pt;font-family:“Courier New”;color:blue;
mso-ansi-language:EN-US;mso-no-proof:yes” lang=“EN-US”>
We have logged your feedback and comments in our database for investigation. We will look into it and see if we could meet your requirements. Once, we will have some update for you, we will let you know asap.