حفظ ملف ODS في المواصفات ODF 1.1 و 1.2
Contents
[
Hide
]
تدعم Aspose.Cells حفظ ملف ODS (OpenDocument Spreadsheet) في مواصفات ODF (OpenDocument Format) 1.1 و ODF 1.2. وقد أضافت Aspose.Cells خاصية OdsSaveOptions.setStrictSchema11() لاستخدام مواصفات ODF 1.1 لحفظ ملفات ODS. القيمة الافتراضية لهذه الخاصية هي false، لذلك ستحفظ ملفات ODS بدون هذه الإعدادات الخاصة باستخدام المواصفات 1.2.
الكود العينة أدناه ينشئ كائن الدفتر، يضيف بعض القيم في الخلية A1 للورقة العمل الأولى ثم يحفظ ملف ODS في مواصفات ODF 1.1 و 1.2. بشكل افتراضي، يتم حفظ ملف ODS في مواصفات ODF 1.2.
This file contains 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); | |