Tile Picture as a Texture inside the Shape with C++

Possible Usage Scenarios

When the picture is small and does not cover the entire surface of the shape while preserving its quality, you have the option to tile it. Tiling fills the shape surface with a small image by repeating it as if it were a tile.

Tile Picture as a Texture inside the Shape

You can fill the shape surface with an image and tile it using the Shape.Fill.TextureFill.IsTiling property by setting it to true. Please see the following sample code, its sample Excel file as well as the screenshot for reference.

Screenshot

todo:image_alt_text

Sample Code

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

using namespace Aspose::Cells;
using namespace Aspose::Cells::Drawing;

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

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

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

    // Load sample Excel file
    Workbook wb(srcDir + u"sampleTextureFill_IsTiling.xlsx");

    // Access first worksheet
    Worksheet ws = wb.GetWorksheets().Get(0);

    // Access first shape inside the worksheet
    Shape sh = ws.GetShapes().Get(0);

    // Tile picture as a texture inside the shape
    sh.GetFill().GetTextureFill().SetIsTiling(true);

    // Save the output Excel file
    wb.Save(outDir + u"outputTextureFill_IsTiling.xlsx");

    std::cout << "Texture fill tiling applied successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}