Content is cut when printing

Hi,

we are having an issue with printing an excel sheet via Aspose. The content from the footer is cut and not fully visible on the printed sheet.
I attached you an example excel sheet and a PDF with scans. First page is printed with Aspose, seconds page is saved to PDF (with Aspose) and printed PDF, third page is printed with Excel.
You can clearly see, that all three sheets are printed differently and cells do not have the same height and width sometimes. This results in missing content when printing with Aspose.

Code used to print the document:

var lic = new License();
lic.SetLicense(@"S:\Aspose.Total.lic");

var workbook = new Workbook(@"S:\ims-6737.xls");

var wbr = new WorkbookRender(workbook, new ImageOrPrintOptions() {PrintingPage = PrintingPageType.Default});
wbr.ToPrinter(new PrinterSettings().PrinterName);

If you print each sheet with a Sheetrenderer, you will have the same problem.

PDF was generated with the following code:

var lic = new License();
lic.SetLicense(@"S:\Aspose.Total.lic");

var workbook = new Workbook(@"S:\ims-6737.xls");
workbook.Save(@"S:\out.pdf");

This issue is reproducable on different printers for us.

example.zip (783.3 KB)

Kind Regards,
Daniel

@Serraniel,

Thanks for the template file, sample code and details.

I am afraid, I could not find the issue on my end. I am using our latest version/fix: Aspose.Cells for .NET v19.9.x (please try it if you are not already using it). I used “Microsoft XPS Document Writer” as printer on my pc. Here is the sample code that I used and please find attached the printout in .xps file format:
e.g
Sample code:

 var workbook = new Workbook("e:\\test2\\ims-6737.xls");
            var wbr = new WorkbookRender(workbook, new ImageOrPrintOptions() {PrintingPage = PrintingPageType.Default});
            wbr.ToPrinter("Microsoft XPS Document Writer");

files1.zip (193.6 KB)

Hi @Amjad_Sahi,

I checked the results when printing to XPS and with using a PDF printer and get correct results using them, too. So I assume that is something related to the Sharp printer we use and to the printer our customer who reported the bug uses.
I noticed, that the document has a 1.2 cm top margin, but printed with Aspose it hast 1.6 cm on the actual sheet. If I configure 0.8 cm (via code) I get 1.2 cm margin in the printed result, so there somehow seems to be a 4 mm offset. So I investigated a bit further and noticed, that the “hardware printer” in C# has hard margins set:
image.png (9.5 KB)

That property uses hunmdreths of an inch as unit, so that value 16 converts to 4.064 mm. That might be the cause as it matches exactly those 4 mm offset I get on the paper.

Now my question is: Is that something we have to handle at our side to adjust the margins in the pagesetup of each page? Are there any best practices for this? Or is this something which will be rated as a bug in the WorkbookRender?
I did a comparison to Aspose.Words: The AsposeWordsPrintDocument seems to be aware of those hard margins and to handle them correctly as the margins on the printed documents are correct and the same as with printed via Word.

You may have a look into that. I personally would expect Aspose to generate the same output as excel does when printing to a printer with hard margins and it seems like excel “fixes” this during printing.

Kind Regards,
Daniel

@Serraniel,

Thanks for the image and further details.

I have logged an investigation ticket with an id “CELLSNET-46953” for your issue. We will evaluate your issue and try to test on different printers. We will try to figure out issue (if found) soon.

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

@Serraniel,
Please try latest version/hotfix and then let us know your feedback.

Aspose.Cells19.10.1 For .Net2_AuthenticodeSigned.Zip (4.9 MB)
Aspose.Cells19.10.1 For .Net4.0.Zip (5.0 MB)

Your issue should be resolved in it.

1 Like

Hi,

I tested the scenarios with your Aspose.Cells19.10.1 For .Net4.0.Zip hotfix. The issue is fixed with this.
Will this hotfix be made available via nuget so we can use our common deployments? Otherwhise we can wait for the 19.11 release, too.

Kind regards,
Daniel

@Serraniel,

Good to know that your issue is sorted out by the fix/version. I am afraid, you have to wait for next official release of the product (i.e., Aspose.Cells for .NET v19.11) which is scheduled to be published in the third week of November 2019. Please note, only official releases are published on Nuget repos./Downloads section.

By the way, you may try to use this fix as an official release, it includes all the functionality of previous release v19.10 (full fledged) plus this fix and other enhancements. The fixes are fully tested regarding QA and can be used on production server without any issue.

The issues you have found earlier (filed as CELLSNET-46953) have been fixed in Aspose.Cells for .NET v19.11. This message was posted using Bugs notification tool by Amjad_Sahi