Not perfect convertion of ods files

Hi all,

I’m doing a java application that converts ods, xl and xlsx files. Excel files will convert fine, but I have a problem about ods.
I’m using a temporary demo license without label and aspose-cells-17.1.0.jar. The code is the following:

import com.aspose.cells.*

License license = new License()
license.setLicense(“C:\Program Files\GMC\Inspire Automation 10\lib\plugin\server\Aspose.Cells.lic”)

String inputFilepath = "C:\test\22460001001_Attachment_1.ODS"
String outputFilepath = "C:\test\22460001001_Attachment_1_ODS.pdf"
def i,n;
try {
Workbook workbook = new Workbook(inputFilepath);
n = workbook.getWorksheets().count;

for(i=0; i<n; i++)
{
PageSetup pageSetup = workbook.getWorksheets().get(i).getPageSetup();
//Setting worksheet name at headers
pageSetup.setHeader(0, “”);
pageSetup.setHeader(1, “”);
pageSetup.setHeader(2, “”);

//Setting worksheet name at footers
pageSetup.setFooter(0, “”);
pageSetup.setFooter(1, “”);
pageSetup.setFooter(2, “”);
}

workbook.save(outputFilepath, FileFormatType.PDF)
} catch (Exception e) {
println e.getMessage()
job.cancel(e.getMessage())
}

println "Conversion done."

Attached you can find ods input file and pdf produced. You can see the text “Fine di prova con
qualche valore” is a bit cutted.

Many thanks in advance.

Antonio

Hi,


I like to inform that this issue is related to Aspose.Cells. I am moving this thread to Aspose.Cells forum. Our Colleague from Aspose.Cells team will soon help you to resolve this problem.

Best Regards,

Hi,


Thanks for the template file.

Please add a line (in bold) to your code segment, it will fix your issue.
e.g
Sample code:

for(i=0; i<n; i++)

{

PageSetup pageSetup = workbook.getWorksheets().get(i).getPageSetup();


//Setting worksheet name at headers

pageSetup.setHeader(0, “”);

pageSetup.setHeader(1, “”);

pageSetup.setHeader(2, “”);


//Setting worksheet name at footers

pageSetup.setFooter(0, “”);

pageSetup.setFooter(1, “”);

pageSetup.setFooter(2, “”);

}

//AutoFit rows in the worksheet.
workbook.getWorksheets().get(0).autoFitRows();


workbook.save(outputFilepath, FileFormatType.PDF);
.........

Hope, this helps a bit.

Thank you.

Hi Amjad,


yes, I can confirm that with the new code line the problem is solved.

Thank you for the help.

Antonio

Hi,


Thanks for your feedback.

Good to know that the workaround fixes your issue for now. Feel free to write us back if you have further comments or questions, we will be happy to assist you soon.

Thank you.