Filtering the kind of data while loading the workbook from template file with C++

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.GetLoadFilter() 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

#include <iostream>
#include "Aspose.Cells.h"

using namespace Aspose::Cells;

int main()
{
    Aspose::Cells::Startup();

    // Source directory path
    U16String srcDir(u"..\\Data\\01_SourceDirectory\\");

    // Output directory path
    U16String outDir(u"..\\Data\\02_OutputDirectory\\");

    // Set the load options, we only want to load shapes and do not want to load data
    LoadOptions loadOptions(LoadFormat::Xlsx);
    loadOptions.SetLoadFilter(new LoadFilter(LoadDataFilterOptions::All & ~LoadDataFilterOptions::Chart));

    // Create workbook object from sample excel file using load options
    Workbook workbook(srcDir + u"sampleFilterChars.xlsx", loadOptions);

    // Save the output in pdf format
    workbook.Save(outDir + u"sampleFilterChars_out.pdf", SaveFormat::Pdf);

    std::cout << "File saved successfully." << std::endl;

    Aspose::Cells::Cleanup();
}