Salva il file ODS in conformità alle Specifiche ODF 1.1, 1.2 e 1.3
Contents
[
Hide
]
Aspose.Cells supporta il salvataggio (file OpenDocument Spreadsheet) ODS in (OpenDocument Format) ODF 1.1, 1.2 e specifiche ODF 1.3. Aspose.Cells ha aggiunto la proprietà OdsSaveOptions.setOdfStrictVersion() per usare la versione ODF per il salvataggio dei file ODS. Il valore predefinto di questa proprietà è OpenDocumentFormatVersionType.ODF_12, quindi un file ODS salvato senza questa impostazione speciale utilizzerà la specifica 1.2.
Il codice di esempio di seguito crea l’oggetto del foglio di lavoro, aggiunge alcuni valori nella cella A1 del primo foglio di lavoro e quindi salva il file ODS nelle specifiche ODF 1.1 e 1.2. Per impostazione predefinita, il file ODS viene salvato nelle specifiche ODF 1.2.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-Java | |
// The path to the documents directory. | |
String dataDir = Utils.getDataDir(SaveODSfile.class); | |
// Create workbook | |
Workbook workbook = new Workbook(); | |
// Access first worksheet | |
Worksheet worksheet = workbook.getWorksheets().get(0); | |
// Put some value in cell A1 | |
Cell cell = worksheet.getCells().get("A1"); | |
cell.putValue("Welcome to Aspose!"); | |
// Save ODS in ODF 1.2 version which is default | |
OdsSaveOptions options = new OdsSaveOptions(); | |
workbook.save("ODF1.2.ods", options); | |
// Save ODS in ODF 1.1 version | |
options.setOdfStrictVersion(OpenDocumentFormatVersionType.ODF_11); | |
workbook.save("ODF1.1.ods", options); | |
// Save ODS in ODF 1.3 version | |
options.setOdfStrictVersion(OpenDocumentFormatVersionType.ODF_13); | |
workbook.save("ODF1.3.ods", options); | |