Working with the Reflection Effect of Shape or Chart with C++

Possible Usage Scenarios

Aspose.Cells provides the Shape.Reflection property along with the ReflectionEffect class to work with the reflection effect of a shape or chart. The ReflectionEffect class contains the following properties, which can be set to achieve different results according to application requirements.

Working with the Reflection Effect of Shape or Chart

The following sample code loads the source Excel file, accesses the first shape in the default worksheet, sets various properties of the Shape.Reflection class, and then saves the workbook to the output Excel file.

#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\\");

    // Path of input Excel file
    U16String inputFilePath = srcDir + u"sample.xlsx";

    // Path of output Excel file
    U16String outputFilePath = outDir + u"output_out.xlsx";

    // Load your source Excel file
    Workbook wb(inputFilePath);

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

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

    // Set the reflection effect of the shape: its Blur, Size, Transparency, and Distance properties
    ReflectionEffect re = sh.GetReflection();
    re.SetBlur(30);
    re.SetSize(90);
    re.SetTransparency(0);
    re.SetDistance(80);

    // Save the workbook in XLSX format
    wb.Save(outputFilePath);

    std::cout << "Reflection effect applied successfully!" << std::endl;

    Aspose::Cells::Cleanup();
}