تصفية نوع البيانات أثناء تحميل المصنف من ملف القالب
Contents
[
Hide
]
في بعض الأحيان ، تريد تحديد نوع البيانات التي يجب تحميلها عند إنشاء المصنف من ملف القالب. يمكن أن تؤدي تصفية البيانات المحملة إلى تحسين الأداء لغرضك الخاص ، خاصة عند استخدامواجهات برمجة تطبيقات LightCells . الرجاء استخدامLoadOptions.LoadFilter خاصية لهذا الغرض.
يقوم نموذج التعليمات البرمجية التالي بتحميل كائنات الشكل فقط أثناء تحميل المصنف من ملفملف نموذجي والتي يمكنك تنزيلها من الرابط المحدد. تُظهر لقطة الشاشة التالية ملفملف نموذجيالمحتويات ويوضح أيضًا أن البيانات باللون الأحمر والخلفية الصفراء لن يتم تحميلها بسببLoadOptions.LoadFilterتم تعيين الخاصية علىLoadDataFilterOptions.Shape
تُظهر لقطة الشاشة التالية ملفالإخراج PDF والتي يمكنك تنزيلها من الرابط المحدد. هنا يمكنك أن ترى ، البيانات باللون الأحمر والخلفية الصفراء غير موجودة ولكن جميع الأشكال موجودة.
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-.NET | |
//Source directory | |
string sourceDir = RunExamples.Get_SourceDirectory(); | |
//Output directory | |
string outputDir = RunExamples.Get_OutputDirectory(); | |
// Set the load options, we only want to load shapes and do not want to load data | |
LoadOptions loadOptions = new LoadOptions(LoadFormat.Xlsx); | |
loadOptions.LoadFilter = new LoadFilter(LoadDataFilterOptions.All & ~LoadDataFilterOptions.Chart); | |
// Create workbook object from sample excel file using load options | |
Workbook workbook = new Workbook(sourceDir + "sampleFilterChars.xlsx", loadOptions); | |
// Save the output in pdf format | |
workbook.Save(outputDir + "sampleFilterChars_out.pdf", SaveFormat.Pdf); |