Filtering the kind of data while loading the workbook from template file

Contents
[ ]

The following sample code loads only shape objects while loading the workbook from the template file which you can download from the given link. The following screenshot shows the template file contents and also explains that the data in Red color and Yellow background will not be loaded because LoadOptions.load_filter property has been set to LoadDataFilterOptions.SHAPE

todo:image_alt_text

The following screenshot shows the output PDF which you can download from the given link. Here you can see, the data in Red color and Yellow background is not present but all shapes are there.

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)