فتح ملفات إصدارات Excel Microsoft المختلفة

فتح ملفات مختلفة من إصدارات إكسل Microsoft

غالبًا ما يجب أن يكون التطبيق قادرًا على فتح ملفات Excel Microsoft التي تم إنشاؤها في إصدارات مختلفة ، على سبيل المثال ، Microsoft Excel 95،97 أو Microsoft Excel 2007/2010/2013/2016/2019 و Office 365. قد تحتاج إلى تحميل ملف بأي من التنسيقات المتعددة ، بما في ذلك XLS ، XLSX ، XLSM ، XLSB ، SpreadsheetML ، TabDelimited أو TSV ، CSV ، ODS وما إلى ذلك. استخدم المنشئ أو حدد**[IWorkbook] (https://reference.aspose.com/cells/cpp/class/aspose.cells.i_workbook)** صف دراسي'**[SetFileFormat] (https://reference.aspose.com/cells/cpp/class/aspose.cells.i_workbook#aa74a10e0aa88e3a8386ea328165896dc)**طريقة لتحديد التنسيق باستخدام**[FileFormatType] (https://reference.aspose.com/cells/cpp/namespace/aspose.cells#a7831f25a251b1cd95079f091aa1faf40)**تعداد.

ال**[FileFormatType] (https://reference.aspose.com/cells/cpp/namespace/aspose.cells#a7831f25a251b1cd95079f091aa1faf40)**يحتوي التعداد على العديد من تنسيقات الملفات المحددة مسبقًا والتي يرد بعضها أدناه.

أنواع تنسيق الملف وصف
FileFormatType_CSV يمثل ملف CSV
FileFormatType_Excel97To2003 يمثل ملف Excel 97 - 2003
FileFormatType_Xlsx يمثل ملف Excel 2007/2010/2013/2016/2019 و Office 365 XLSX
FileFormatType_Xlsm يمثل ملف Excel 2007/2010/2013/2016/2019 و Office 365 XLSM
FileFormatType_Xltx يمثل ملف Excel 2007/2010/2013/2016/2019 ونموذج Office 365 XLTX
FileFormatType_Xltm يمثل ملف XLTM ممكّن للماكرو في Excel 2007/2010/2013/2016/2019 و Office 365
FileFormatType_Xlsb يمثل ملف Excel 2007/2010/2013/2016/2019 و Office 365 ثنائي XLSB
FileFormatType_SpreadsheetML يمثل ملف SpreadsheetML
FileFormatType_Tsv يمثل ملف قيم مفصولة بعلامات جدولة
FileFormatType_Tab محدد يمثل ملفًا نصيًا محددًا بعلامات جدولة
FileFormatType_Ods يمثل ملف ODS
FileFormatType_Html يمثل ملف HTML
FileFormatType_MHtml يمثل ملف MHTML

فتح Microsoft ملفات Excel 95 / 5.0

لفتح ملف Microsoft Excel 95 / 5.0 ، استخدم**[ILoadOptions] (https://reference.aspose.com/cells/cpp/class/aspose.cells.i_load_options)**وقم بتعيين السمة ذات الصلة لـ**ILoadOptions**فئة ملف القالب المراد تحميله. يمكن تنزيل نموذج ملف لاختبار هذه الميزة من الرابط التالي:

ملف Excel95

#include "Aspose.Cells.h"
// Get the Excel file into stream
intrusive_ptr<FileStream> fstream = new FileStream(new String("Excel95.xls"), FileMode_Open);
// Instantiate LoadOptions specified by the LoadFormat.
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_Excel97To2003);
// Create a Workbook object and opening the file from the stream
intrusive_ptr<IWorkbook> wbExcel95 = Factory::CreateIWorkbook(fstream, loadOptions);
//Show following message on console
Console::WriteLine(new String("Microsoft Excel 95/5.0 workbook opened successfully!"));
//Close the Stream object
fstream->Close();

فتح Microsoft ملفات Excel 97-2003

لفتح ملف Microsoft Excel 97-2003 ، استخدم**[ILoadOptions] (https://reference.aspose.com/cells/cpp/class/aspose.cells.i_load_options)** وقم بتعيين السمة ذات الصلة لـ**ILoadOptions**فئة ملف القالب المراد تحميله.

#include "Aspose.Cells.h"
// Get the Excel file into stream
intrusive_ptr<FileStream> fstream = new FileStream(new String("Excel03.xls"), FileMode_Open);
// Instantiate LoadOptions specified by the LoadFormat.
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_Excel97To2003);
// Create a Workbook object and opening the file from the stream
intrusive_ptr<IWorkbook> wbExcel03 = Factory::CreateIWorkbook(fstream, loadOptions);
//Show following message on console
Console::WriteLine(new String("Microsoft Excel 97 - 2003 workbook opened successfully!"));
//Close the Stream object
fstream->Close();

فتح Microsoft Excel 2007/2010/2013/2016/2019 وملفات Office 365 XLSX

لفتح تنسيق Microsoft Excel 2007/2010/2013/2016/2019 وتنسيق Office 365 ، أي XLSX أو XLSB ، حدد مسار الملف. تستطيع ايضا استخذام**[ILoadOptions] (https://reference.aspose.com/cells/cpp/class/aspose.cells.i_load_options)** وقم بتعيين السمة / الخيارات ذات الصلة لـ**ILoadOptions**فئة ملف القالب المراد تحميله.

#include "Aspose.Cells.h"
// The path to the documents directory.
StringPtr dataDir = new String("");
// Opening Microsoft Excel 2007 Xlsx Files
intrusive_ptr <Aspose::Cells::ILoadOptions> loadOptions = Factory::CreateILoadOptions(LoadFormat::LoadFormat_Xlsx);
// Create a Workbook object and opening the file from its path
intrusive_ptr<IWorkbook> wbExcel07 = Factory::CreateIWorkbook(dataDir->StringAppend(new String("Input.xlsx")), loadOptions);
// Show following message on console
Console::WriteLine(new String("Microsoft Excel 2007 - Office365 workbook opened successfully!"));

يدعم Aspose.Cells أيضًا فتح ملفات Microsoft المحمية بكلمة مرور في Excel 2007 و 2010 و 2013 و 2016 و 2019 و Office 365.