我正在尝试使用jOpenDocument 库来创建文档。我已经执行了创建电子表格的示例 - 代码编译并运行正常,但是当我尝试使用 Excel Office 2012 或 Google Docs 打开文档时,他们向我指出格式不正确。
这是示例,我使用的是 jOpenDocument 1.2 版:
final Object[][] data = new Object[6][2];
data[0] = new Object[] { "January", 1 };
data[1] = new Object[] { "February", 3 };
data[2] = new Object[] { "March", 8 };
data[3] = new Object[] { "April", 10 };
data[4] = new Object[] { "May", 15 };
data[5] = new Object[] { "June", 18 };
String[] columns = new String[] { "Month", "Temp" };
TableModel model = new DefaultTableModel(data, columns);
// Save the data to an ODS file and open it.
final File file = new File(destpath, "temperature.ods");
SpreadSheet.createEmpty(model).saveAs(file);