طرق مختلفة لفتح الملفات
Contents
[
Hide
]
مع Aspose.Cells من الممكن فتح الملفات، على سبيل المثال لاسترداد البيانات، أو استخدام قالب مصمم لتسريع عملية التطوير. يمكن لـAspose.Cells فتح مجموعة متنوعة من الملفات المختلفة، مثل ورقات العمل Microsoft Excel (XLS، XLSX، XLSM، XLSB)، ملفات CSV أو TabDelimited.
فتح ملف عبر مسار
يمكن للمطورين فتح ملف Microsoft Excel باستخدام مساره في الكمبيوتر المحلي عن طريق تحديده في مُنشئ فئة Workbook ببساطة قم بتمرير المسار في المُنشئ كسلسلة نص. سوف Aspose.Cells يكتشف نوع تنسيق الملف تلقائياً.
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-C | |
Aspose::Cells::Startup(); | |
//Source directory path | |
U16String dirPath(u"..\\Data\\LoadingSavingAndConverting\\"); | |
//Create Workbook object from an Excel file path | |
Workbook workbook(dirPath + u"sampleExcelFile.xlsx"); | |
//Show following message on console | |
std::cout << "Workbook opened successfully using file path." << std::endl; | |
Aspose::Cells::Cleanup(); |
فتح ملف باستخدام تيار
من الممكن أيضاً فتح ملف Excel كتيار. للقيام بذلك، استخدم الإصدار المحدث من المُنشئ الذي يأخذ كائن Stream الذي يحتوي على الملف.
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-C | |
Aspose::Cells::Startup(); | |
//For complete examples and data files, please go to https://github.com/aspose-cells/Aspose.Cells-for-C | |
//Source directory path | |
U16String dirPath(u"..\\Data\\LoadingSavingAndConverting\\"); | |
//You need to write your own code to read the contents of the sampleExcelFile.xlsx file into this variable. | |
Vector<uint8_t> FileStream{ 0 }; //"sampleExcelFile.xlsx" | |
//Create Workbook object from a Stream object | |
Workbook workbook(FileStream); | |
//Show following message on console | |
std::cout << "Workbook opened successfully using stream." << std::endl; | |
Aspose::Cells::Cleanup(); |