تصفية نوع البيانات أثناء تحميل ورق العمل من ملف النموذج

Contents
[ ]

يقوم الكود العيني التالي بتحميل كائنات الشكل فقط أثناء تحميل الدفتر من ملف النموذج الذي يمكنك تحميله من الرابط المتوفر. توضح اللقطة الشاشية التالية محتويات ملف النموذج وتشرح أيضًا أنه لن يتم تحميل البيانات ذات اللون الأحمر والخلفية الصفراء لأن الخاصية LoadOptions.load_filter تم تعيينها على LoadDataFilterOptions.SHAPE.

todo:image_alt_text

تُظهر اللقطة الشاشية التالية ال PDF الناتج الذي يمكنك تحميله من الرابط المقدم. هنا يمكنك أن ترى، البيانات ذات اللون الأحمر والخلفية الصفراء غير موجودة لكن جميع الأشكال موجودة.

todo:image_alt_text

from aspose.cells import LoadDataFilterOptions, LoadFilter, LoadFormat, LoadOptions, SaveFormat, Workbook
# For complete examples and data files, please go to https:# github.com/aspose-cells/Aspose.Cells-for-.NET
# Source directory
sourceDir = RunExamples.Get_SourceDirectory()
# Output directory
outputDir = RunExamples.Get_OutputDirectory()
# Set the load options, we only want to load shapes and do not want to load data
loadOptions = LoadOptions(LoadFormat.XLSX)
loadOptions.load_filter = LoadFilter(LoadDataFilterOptions.ALL & ~LoadDataFilterOptions.CHART)
# Create workbook object from sample excel file using load options
workbook = Workbook(sourceDir + "sampleFilterChars.xlsx", loadOptions)
# Save the output in pdf format
workbook.save(outputDir + "sampleFilterChars_out.pdf", SaveFormat.PDF)