C++ ile Şekil veya Grafiklerin Gölge Etkisiyle Çalışma

Olası Kullanım Senaryoları

Aspose.Cells, GetShadowEffect() metodu ile ShadowEffect sınıfını sağlar ve şekil veya grafiklerin gölge etkisiyle çalışma sağlar. ShadowEffect sınıfı, uygulama ihtiyaçlarına göre farklı sonuçlar elde etmek için ayarlanabilecek aşağıdaki özellikleri içerir.

Şekil veya Grafik Gölgelenme Efekti ile Çalışma

Aşağıdaki örnek kod, kaynak excel dosyasını yükler ve ilk sayfadaki ilk şekli erişir ve GetShadowEffect() özelliğinin alt özelliklerini ayarlar ve ardından çalışma kitabını çıkış excel dosyasına kaydeder.

#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 shadow effect of the shape, Set its Angle, Blur, Distance and Transparency properties
    ShadowEffect se = sh.GetShadowEffect();
    se.SetAngle(150);
    se.SetBlur(4);
    se.SetDistance(45);
    se.SetTransparency(0.3);

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

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

    Aspose::Cells::Cleanup();
}