الحصول على رقم الإصدار للتطبيق الذي أنشأ مستند Excel
Contents
[
Hide
]
غالبًا ما تحتاج إلى معرفة رقم الإصدار للتطبيق الذي أنشأ مستند Microsoft Excel. توفر Aspose.Cells الخاصية Workbook.getBuiltInDocumentProperties().getVersion() لهذا الغرض.
الكود النموذجي التالي يظهر استخدام خاصية Workbook.getBuiltInDocumentProperties().getVersion(). يقوم بتحميل ملفات Excel التي تم إنشاؤها باستخدام Microsoft Excel 2003 و 2007 و 2010 و 2013 ويقوم بطباعة رقم الإصدار للتطبيق الذي أنشأ هذه المستندات في Excel.
للرجوع إليها، إليك إخراج وحدة التحكم الذي ينشئه الكود العينة.
Excel 2003 XLS Version: 726502
Excel 2007 XLS Version: 786432
Excel 2010 XLS Version: 917504
Excel 2013 XLS Version: 983040
Excel 2007 XLSX Version: 12.0000
Excel 2010 XLSX Version: 14.0300
Excel 2013 XLSX Version: 15.0300
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(GetVersionNumberofApplication.class); | |
// Create a workbook reference | |
Workbook workbook = null; | |
// Print the version number of Excel 2003 XLS file | |
workbook = new Workbook(dataDir + "Excel2003.xls"); | |
System.out.println("Excel 2003 XLS Version: " + workbook.getBuiltInDocumentProperties().getVersion()); | |
// Print the version number of Excel 2007 XLS file | |
workbook = new Workbook(dataDir + "Excel2007.xls"); | |
System.out.println("Excel 2007 XLS Version: " + workbook.getBuiltInDocumentProperties().getVersion()); | |
// Print the version number of Excel 2010 XLS file | |
workbook = new Workbook(dataDir + "Excel2010.xls"); | |
System.out.println("Excel 2010 XLS Version: " + workbook.getBuiltInDocumentProperties().getVersion()); | |
// Print the version number of Excel 2013 XLS file | |
workbook = new Workbook(dataDir + "Excel2013.xls"); | |
System.out.println("Excel 2013 XLS Version: " + workbook.getBuiltInDocumentProperties().getVersion()); | |
// Print the version number of Excel 2007 XLSX file | |
workbook = new Workbook(dataDir + "Excel2007.xlsx"); | |
System.out.println("Excel 2007 XLSX Version: " + workbook.getBuiltInDocumentProperties().getVersion()); | |
// Print the version number of Excel 2010 XLSX file | |
workbook = new Workbook(dataDir + "Excel2010.xlsx"); | |
System.out.println("Excel 2010 XLSX Version: " + workbook.getBuiltInDocumentProperties().getVersion()); | |
// Print the version number of Excel 2013 XLSX file | |
workbook = new Workbook(dataDir + "Excel2013.xlsx"); | |
System.out.println("Excel 2013 XLSX Version: " + workbook.getBuiltInDocumentProperties().getVersion()); |