Paper size isn't maintained in xlsx and pdf document

I found two problems while using Aspose Cells.

I made a example which explains my problems better.
When I set the page layout to a size, for example 'SRA3', if I force the paper size in code, then save xlsx a paper size is maintaind. If I don't force the PaperSize in the code, format isn't kept.

The paper size isn't propagated from xlsx file by saving it as a pdf file in either case.

When making tests, feel free to modify Test.xlsx

Regards,

Devid.

Hi,


Thanks for the sample files and project.

I am not able to find the issue or understand your issue fully. For your information, Aspose.Cells does render the PDF file based on the print preview of the sheets in MS Excel. Apparently, I don’t see any issue in the generated Excel and PDF files.

Could you elaborate it more and provide us some screen shots comparing both Excel files (original Excel file Vs re-saved Excel file (by Aspose.Cells)). Also give us the screen shots comparing both PDFs. It will help us to trace the issue to rectify it soon.

Thank you.

Hi,

Taking the file Test.xlsx, I set the paper size to 'SRA3' and filled the corrisponding area with yellow. If I manually save in pdf from Microsoft Excel (Test.microsoftexcel.pdf), it produces only one page. If I save the file with the program Aspose pdf product (Test.xlsx.out.pdf), it produce 2 pages for the same area.
The same problem happens setting paper size 'B5' or others.

Thanks,

Devid

Hi,


Well, it is not an issue with Aspose.Cells as I tested opening your file into MS Excel and resaved the file in PDF file manually, the output PDF also has 4 pages, see the attached output PDF file. Aspose.Cells does render the PDF pages as per print preview shown in MS Excel, so the rendered PDF is same as per MS Excel’s generated PDF file.

For your requirements, you may use OnePagePerSheet attribute to set it to true, this way, one one page will be generated in the output PDF file for the sheet. I have tested and it works fine for your needs. See the sample code below.


Sample code:

Workbook wbk = new Workbook(“e:\test2\Test.xlsx”);
PdfSaveOptions saveOptions = new PdfSaveOptions(SaveFormat.Pdf);
saveOptions.OnePagePerSheet = true;

wbk.Save(“e:\test2\out_test_PDFs.pdf”, saveOptions);


Thank you.

Hi,

1-We use Aspose.Cells 7.3.1.0
2-please follow the steps:
a- open test.xlsx.
b- configure paper size, B4, SRA4, or 12x18 for example.
c- fill the page area with yellow.
d- save and export the xlsx from ms excel to pdf.
e- execute program.
f- pdf check to see they are equal.
g- redo the steps from a to g for at least 3 paper sizes.

Follow the steps and check with your printer if there are formats that do not work.

I've tried all formats on my printer. Some work and others like B4, SRA4, 12x18 do not.

Thanks,

Devid

Hi,


Well, I simply open your “test.xlsx” file into MS Excel and check its print preview, it has four pages on my MS Excel 2007 and 2010. I don’t have SRA4, 12*18 paper sizes etc., in the PageSetup dialog. I only have A4, B4(JIS) etc. When set any one of them, it still shows me 4 pages. So, whether I use MS Excel to save to PDF or use Aspose.Cells APIs, it will give me PDF with four pages.

By the way, did you try my suggested workaround by using OnePagePerSheet of PdfSaveOptions as it works fine?

Thank you.


Hi,

Did you change the yellow area in the "Test.xlxs" in accordance with the paper size you chose? After you set the paper size, fill in the area of the paper corresponding to the paper size with yellow.

Thanks,

Devid

Hi,


"Did you change the yellow area in the “Test.xlxs” in accordance with the paper size you chose? After you set the paper size, fill in the area of the paper corresponding to the paper size with yellow."

No, I did not. I just simply opened your “Test.xlsx” file into MS Excel and save it as PDF manually. I also tested this after changing the paper size. Am I supposed to change the yellow filled area (that is already filled)?

Thank you.

Hi,

It is when you change the paper size that you have to change the yellow area to the area of the paper size selected.
Follow the steps I wrote before, which are:

a- open test.xlsx.
b- configure paper size, B4 for example.
c- fill the page area with yellow.
d- save and export the xlsx from ms excel to pdf.
e- execute program.
f- pdf check to see they are equal.
g- redo the steps from a to g for other paper size.

Follow the steps and check your printer to see if there are formats that do not work i.e. there is a difference between the pdf saved by MS Excel and other than the pdf created by running the program in Aspose.

In my case, setting the paper size to B4, 12x18, or SRA4, the output of the first pdf created by Ms Excel and the one saved with Aspose are different.

I'm attaching the file 'Text.xlsx' with paper size set to 'B4' with the output from the two procedures.

Thanks,

Devid

Hi Devid ,


Thanks for providing us new files.

Using the new “Test.xlsx” with the latest fix/version: Aspose.Cells for .NET v7.4.1.1 I am able to reproduce the issue for PDF rendering only as it works fine when I re-saved the file in XLSX file format. Both PDF and XLSX files are attached. I simply used your “Test.xlsx” file as input.

Sample code:

Workbook wbk = new Workbook(“e:\test2\papersize\new\Test.xlsx”);

wbk.Save(“e:\test2\out_test_XLSX1.xlsx”);
wbk.Save(“e:\test2\out1_test_PDF1.pdf”,SaveFormat.Pdf);

I have logged a ticket with an id “CELLSNET-41462” for your issue. We will look into your issue soon.

Note: XLSX file has one page which it should while PDF file has two pages and this is the issue.

Thank you.

Hi,


Please try the attached fix/version: Aspose.Cells for .NET v7.4.1.2, we have fixed your issue.

Let us know if it fixes your issue now.


Thank you.

Hi,

Thanks, now it works.
Is Aspose.Cells for .NET v7.4.1.2 a fix or an official release?
I need 3.5 client profile.

Thanks,
Devid

Hi,

Thanks for using Aspose.Cells for .NET.

It is called a minor release. This is not official release but can be used for production use. After every month we release a major release which is an official release.

For client profile version, we will provide you a client profile release asap.

Hi,

Thanks for your posting and using Aspose.Cells for .NET.

Please download and try the latest client profile version: Aspose.Cells for .NET v7.4.1.2 (Client Profile).

Hi,

When will the next official version for Aspose.Cells for. NET be released?

Thanks,

Devid

Hi,


We are scheduled to release our next official release of the product before the end of this month. Also, we recommend you that you may use this fix (client profile version) as an official release for your production usage, it includes all the features and fixes/enhancements.

Thank you.

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


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