OpenOffice to Aspose.Cells

Hello, I would like to inform you that I have an error of when a template create from OpenOffice after the application “Aspose.Cells” the document generate contains formulas errors or we can not open it. There is no property to apply on the document to avoid this problem? How can I solve this problem? Thank you for your help

Hi,


Thanks for your posting and using Aspose.Cells.

Please download and try the latest version: Aspose.Cells for Java v16.11.10 and see if it makes any difference and resolves your issue.

If your issue still persists then please provide us your sample code and source open office files so that we could look into this issue at our end. Thanks for your cooperation in this regard and have a good day.

hi,

Thanks you for your fast response , this version has compatible with Java 7 ?

thanks you for your help

Hi,


Thanks for your posting and considering Aspose.Cells.

Yes, it is compatible with Java 7 and Java 8. Let us know if you encounter any other issue or you have any other question, we will be glad to help you.

hello,

HOW CAN I Detect an OpenOffice Document?

Aspose supports documents created or modified by OpenOffice ???

thanks you

Hi,


Thanks for your posting and using Aspose.Cells.

You can detect Appache OpenOffice ODS file, load it inside the Workbook object and modify it and save it back. Please see the following sample code, its source ods file and the output ods file as well as screenshot for your reference. Please also read comments inside the code for your more understanding.

Java
//Your Appache OpenOffice i.e. ODS file
String filePath = dirPath + “sampleOpenOffice.ods”;

//Detect its file format type, it is generic code, you can try XLSX, XLS, CSV, XLSB files as well
FileFormatInfo finfo = FileFormatUtil.detectFileFormat(filePath);

//Once, you detected the fileformat, then create LoadOptions
LoadOptions opts = new LoadOptions(finfo.getLoadFormat());

//Load your file with correct format
Workbook wb = new Workbook(filePath, opts);

//Access first worksheet and put some value in cell B4
Worksheet ws = wb.getWorksheets().get(0);
Cell cell = ws.getCells().get(“B4”);
cell.putValue(“Hello Dev_J.”);

//Set it with yellow fill color and red font color
Style st = cell.getStyle();
st.setPattern(BackgroundType.SOLID);
st.setForegroundColor(Color.getYellow());
st.getFont().setColor(Color.getRed());
cell.setStyle(st);

// ws.AutoFitColumn(cell.Column);

//Save the workbook in ODS format
wb.save(filePath + “-out.ods”, SaveFormat.ODS);



C#
//Your Appache OpenOffice i.e. ODS file
String filePath = dirPath + “sampleOpenOffice.ods”;

//Detect its file format type, it is generic code, you can try XLSX, XLS, CSV, XLSB files as well
FileFormatInfo finfo = FileFormatUtil.DetectFileFormat(filePath);

//Once, you detected the fileformat, then create LoadOptions
LoadOptions opts = new LoadOptions(finfo.LoadFormat);

//Load your file with correct format
Workbook wb = new Workbook(filePath, opts);

//Access first worksheet and put some value in cell B4
Worksheet ws = wb.Worksheets[0];
Cell cell = ws.Cells[“B4”];
cell.PutValue(“Hello Dev_J.”);

//Set it with yellow fill color and red font color
Style st = cell.GetStyle();
st.Pattern = BackgroundType.Solid;
st.ForegroundColor = Color.Yellow;
st.Font.Color = Color.Red;
cell.SetStyle(st);

// ws.AutoFitColumn(cell.Column);

//Save the workbook in ODS format
wb.Save(filePath + “-out.ods”, SaveFormat.ODS);