We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Help? Problem! Print in landscape mode

Hello,

I'm implementing xlsx file printing and I have a question about this feature in Aspose Cells for java (v8.5.2):

When I try to print, it doesn't print correctly in landscape mode.

Test case to reproduce the problem:

1) Create an empty excel file, for example, test.xlsx

2) Fill A1, A2 cells

3) Set Orientation mode to Landscape. Save test.xlsx

4) If I print from within excel, it prints exactly as expected

5) If I send to the same printer via SheetRender or WorkbookRender it looks much different. There is a large left margin. Is there any known issues with the Render?


Workbook wb = new Workbook("C:\\temp\\asposeCellsPrint\\test.xlsx");
Worksheet wSh = wb.getWorksheets().get(0);
SheetRender sR = new SheetRender(wSh, new ImageOrPrintOptions());
sR.toPrinter(printerName);

Thanks for your help.

 /* Style Definitions */
 table.MsoNormalTable
	{mso-style-name:"Обычная таблица";
	mso-tstyle-rowband-size:0;
	mso-tstyle-colband-size:0;
	mso-style-noshow:yes;
	mso-style-priority:99;
	mso-style-parent:"";
	mso-padding-alt:0cm 5.4pt 0cm 5.4pt;
	mso-para-margin:0cm;
	mso-para-margin-bottom:.0001pt;
	mso-pagination:widow-orphan;
	font-size:10.0pt;
	font-family:"Times New Roman","serif";}

<![endif]–>

Hi,


Thanks for providing us some details.

Could you try our latest fix/version: Aspose.Cells for Java v8.6.3.4 if it makes any difference.

If you still find the issue, kindly provide your template Excel file, we will check it soon. Also provide print output using MS Excel.

Thank you.

Hi,

Thanks for the quick response.

The problem still exists after the installation of the latest fix/version: Aspose.Cells for Java v8.6.3.4.

I have attached a test file and printed output using MS Excel. If you print this via excel, then print with the code below, you should notice the difference.

Code

Workbook wb = new Workbook("C:\\temp\\asposeCellsPrint\\newtest.xlsx");
Worksheet wSh = wb.getWorksheets().get(
0);
SheetRender sR =
new SheetRender(wSh, new ImageOrPrintOptions());
sR.toPrinter(
printerName);

Thanks

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Обычная таблица"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi,


Thanks for the template file.

I am afraid, I still could not find the issue with our latest version/fix: Aspose.Cells for Java v8.6.3.6

I used the following sample code with your template file and I attached the printed output saved in XPS file format for your reference. I used “Microsoft XPS Document Writer” as my default printer on my system.
e.g
Sample code:

Workbook wb = new Workbook(“newtest.xlsx”);
Worksheet wSh = wb.getWorksheets().get(0);

ImageOrPrintOptions options = new ImageOrPrintOptions();
SheetRender sR = new SheetRender(wSh, options);
sR.toPrinter(“Microsoft XPS Document Writer”);


Thank you.

The attached file is in Portrait mode. I need to get Landscape orientation. The file newtest.xlsx has Landscape mode. If I use “Microsoft XPS Document Writer” I can get the same result as you. When I try to print from within excel, it print exactly as expected (attachment: img-121120502-0001.pdf). If I send to the same printer via SheetRender it has a large left margin (attachment: img-121120515-0002.pdf)

I found out the same problem description for .Net (This issue has been logged as CELLSNET-41285.)


Thank you.

/* Style Definitions */ table.MsoNormalTable {mso-style-name:"Обычная таблица"; mso-tstyle-rowband-size:0; mso-tstyle-colband-size:0; mso-style-noshow:yes; mso-style-priority:99; mso-style-parent:""; mso-padding-alt:0cm 5.4pt 0cm 5.4pt; mso-para-margin:0cm; mso-para-margin-bottom:.0001pt; mso-pagination:widow-orphan; font-size:10.0pt; font-family:"Times New Roman","serif";}

<![endif]–>

Hi,


Thanks for providing us further details.

I found an issue with printing in landscape mode via SheetRender/WorkbookRender APIs. The worksheet page is set as Landscape as I checked. I used “Microsoft XPS Document Writer” as my default printer to render the XPS document but somehow Aspose.Cells seems to start rendering the contents vertically and @ top-right corner of the landscape page.
e.g
Sample code:

Workbook wb = new Workbook(“newtest.xlsx”);
Worksheet wSh = wb.getWorksheets().get(0);

ImageOrPrintOptions options = new ImageOrPrintOptions();

SheetRender sR = new SheetRender(wSh, options);
sR.toPrinter(“Microsoft XPS Document Writer”);

I have logged an investigation ticket with an id “CELLSJAVA-41695” for your issue. Our concerned developer from product team will soon investigate and look into your issue to figure it out (if possible). Also we will try your scenario/ case using some other printers (virtual/physical).

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

Thank you.

Good day. About when to expect solutions? Please help. Thank you

Hi Barantsev,


Thank you for writing back.

Please note, the ticket attached to this thread is currently in analysis phase therefore we cannot share an ETA at this moment. As soon as we have completed the preliminary analysis, we will share the results here along with estimated time frame to provide the fix (if applicable).

Hi,


Thanks for using Aspose.Cells.

We have enhanced the rendering and done some fix but we do not have the same printer as you have. Could you please download and try our latest version:

Aspose.Cells for Java 8.7.0

Let us know your feedback.

Thank you.

Hello.
Thanks for new release. We tried. Now works correctly.

Once again we thank for the help.

Hi,


Thanks for your feedback.

Good to know that your issue is sorted out by the new version/fix. Feel free to contact us any time if you need further help or have some other issue or queries, we will be happy to assist you soon.

Thank you.