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