I am creating a spreadsheet which contains barcodes (based on a barcode font) using Aspose.Cells. If I go to Excel and do a QuickPrint (i.e.- don't change any settings), it prints exactly as desired. However, if I try to print it via the following Aspose code, the barcodes can't be scanned (they are too dark and run together), the margins are different, and some of the other formatting is off.
Here's the code snippet:
Dim r As Aspose.Cells.Rendering
Dim o As Aspose.Cells.Rendering.ImageOrPrintOptions = New Aspose.Cells.Rendering.ImageOrPrintOptions
Dim p As System.Drawing.Printing.PrinterSettings = New System.Drawing.Printing.PrinterSettings
Dim defPrinter As String = p.PrinterName
r = New Aspose.Cells.Rendering.SheetRender(xlWorkSheet, o) 'sheet was previously referenced and last used in xlWorkBook.Save(tmpPath)
r.ToPrinter(defPrinter)
I've tried modifying various settings without any luck. Can someone please explain why I get different results via Aspose? Thanks,
I had downloaded and installed 6.0.0 from the Aspose site before I opened this thread. Is 6.0.0.4 different from the version that was on the site yesterday? (I am not at work at the moment and can’t confirm the exact sub version I got.)
It seems that 6.0.0.5 does give me a printout with scannable bar codes but it not using the correct font. The flow of my test application right now is something like the following:
[code to pull in a template spreadsheet and populate it using Aspose.Cells giving xlWorkBook] xlWorkBook.Save(tmpPath) PrintViaExcel(tmpPath) [print saved worksheet using Excel (code below)]
Dim r As Aspose.Cells.Rendering.SheetRender Dim o As Aspose.Cells.Rendering.ImageOrPrintOptions = New Aspose.Cells.Rendering.ImageOrPrintOptions Dim p As System.Drawing.Printing.PrinterSettings = New System.Drawing.Printing.PrinterSettings Dim defPrinter As String = p.PrinterName
r = New Aspose.Cells.Rendering.SheetRender(xlWorkSheet, o) 'note: this is the sheet in xlWorkBook r.ToPrinter(defPrinter) ... Code to print saved worksheet via Excel Dim xlApp As Microsoft.Office.Interop.Excel.Application Dim xlWkbk As Microsoft.Office.Interop.Excel.Workbook Dim xlWksht As Microsoft.Office.Interop.Excel.Worksheet
xlApp = New Microsoft.Office.Interop.Excel.ApplicationClass With xlApp xlWkbk = .Workbooks.Open(path) .Visible = False End With
With xlWkbk .PrintOut() End With releaseObject(xlWksht) releaseObject(xlWkbk) xlApp.Quit() releaseObject(xlApp)
The resulting two printed documents clearly use different fonts even though they are starting with the same xlWorkbook object. I don't see how that can be happening -- can you explain it?
Here is the “test.zip” file. Please check if the print result of both files in “test.zip” can be recognized by barcode scanner. These two files are converted by Excel 2010, we found
they are different in viewer. We want to know which one we should follow.
Neither of those files have usable barcodes. In the past I have found that going through some intermediate application like PDF never results in real barcodes on the output.
As I mentioned in my last update, however, v6.0.0.5 does let me print useful barcode via Aspose but they are not coming out with the same font as when I have saved an Excel file and printed it through Excel.
In our end, if we set barcode style to regular (original is bold) we can use device to recognize the barcode text in (print|pdf|xps) converted by (Aspose.Cells & Excel). The recognized text are the same as Excel.
But using barcode as bold, neither of them could be recognized.
I think we have two different discussions going on here and I am not sure which one your post relates to. My last post was in response to the two test files that Amjad had posted earlier. I was just printing those two files and had no choices regarding which font was being used.
If, as I suspect, your response was related to post 316670 (15JUL11 9:44AM) then I am still confused because I removed the bold font from my template but the copy I print via Aspose (v6.0.0.6) still uses a different barcode font than the one I specified.
While it is true that v6.0.1.0 now allows me to print a page which contains good bar codes, the new release does not address the concern I raised earlier in this thread because it is still printing with a different font than the one specified in my spreadsheet. Can you please explain this behavior? Is there a way I can control it?
Your picture looks like what I get for the Aspose version, but not the Excel version where I specify a bar code font (currently IDAutomationSXHC39M demo) which shows text below the bar codes. I've attached a picture of what I get; the one on the left (with text under the bar codes) was created by printing in Excel (although the file was updated and saved via Aspose) whereas the one on the right was printed via Aspose from the same in memory worksheet that was saved to create the left one).
Is your code possibly trying to control the fonts and thereby overriding what is specified in the worksheet?