Free Support Forum - aspose.com

.Cells Rendering problem

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,

/jeff

Hi,


Please give us the sample Excel file here, we will conduct the test to check your issue on our end.

thank you.

Amjad -

Here's a sample file. I don't know if you will also need the BarCode font file: it is FRE3OF9X.TTF which is freely available many places on the web.

Thanks,

/jeff

Hi,



Could you try the attached latest version/fix v6.0.0.4 and let us know if it works fine.

Thank you.


Amjad -


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.)

Thanks,
/jeff

Hi,


Yes, v6.0.0.4. is actually a bug fix version in which we have also made a few enhancements.
We will look into your issue soon.

thank you.

Amjad -

I used v6.0.0.4 and it did not make any difference.

Regards,

/jeff

Hi,


I have logged an issue with an id: CELLSNET-29058. We will soon look into your issue.

Thank you.

Hi,

Please download the attached test.zip and let us know if the print result of both files in test.zip can be recognized by barcode scanner.

These two files are converted by Ms Excel 2010, we found they are different in viewer. We want to know which one we should follow.

Download:
Aspose.Cells for .NET v6.0.0.5

I only see Aspose.Cells v6.0.0.5 attached, not TEST.ZIP. I will try 6.0.05 to see if makes any difference.

Regards,

/jeff

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?

Thanks,

/jeff

Hi Jeff,


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.


Thank you.

<o:p></o:p>

Amjad -

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.

Regards,

/jeff

Hi,

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.

Please use regular style barcode instead.

Download:
Aspose.Cells
for .NET v6.0.0.6

Shakeel -

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.

Thanks,

/jeff

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


This message was posted using Notification2Forum from Downloads module by aspose.notifier.

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?

Thanks,

/jeff

Hi,

Please see the attached image. We get exactly same font with Excel during test.

Shakeel -

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?

Thanks,

/jeff

Hi,

After further investigation, We found you are using IDAutomationSXHC39M font instead free FRE3OF9X.TTF.

Please see the code below how to change the font.

C#


Workbook workbook = new Workbook(@“asposeTest.xlsx”);

foreach(Worksheet ws in workbook.Worksheets)

{

foreach(Cell cell in ws.Cells)

{

Style st = cell.GetStyle();

if(st!=null && st.Font.Name == “Free 3 of 9 Extended”)

{

st.Font.Name = “IDAutomationSXHC39M”;

cell.SetStyle(st);

}

}

}

workbook.Save(“m:\test.pdf”);