C++でシェイプのグロー効果の色を読む

可能な使用シナリオ

形状のグローエフェクトの色を読み取りたい場合は、Shape.Glow.Colorプロパティを使用してください。これにより、形状のグローエフェクトの色に関連するさまざまなプロパティがわかります。

シェイプのグローエフェクトの色を読む

参照のために、以下はサンプルコードとその ソースエクセルファイル およびコンソール出力を示したスクリーンショットです。次のスクリーンショットは、Microsoft Excelで表示したときのソースエクセルファイル内の形状のグローエフェクトを示しています。

todo:image_alt_text

C++コード: シェイプのグロー効果の色を読む

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

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

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

    U16String srcDir(u"..\\Data\\01_SourceDirectory\\");
    Workbook book(srcDir + u"sourceGlowEffectColor.xlsx");
    Worksheet sheet = book.GetWorksheets().Get(0);
    Shape shape = sheet.GetShapes().Get(0);
    GlowEffect effect = shape.GetGlow();
    CellsColor color = effect.GetColor();

    Color clr = color.GetColor();
    uint32_t argb = (static_cast<uint32_t>(clr.a) << 24) | 
                    (static_cast<uint32_t>(clr.r) << 16) | 
                    (static_cast<uint32_t>(clr.g) << 8) | 
                    static_cast<uint32_t>(clr.b);

    std::cout << "Color: " << argb << std::endl;
    std::cout << "ColorIndex: " << color.GetColorIndex() << std::endl;
    std::cout << "IsShapeColor: " << color.IsShapeColor() << std::endl;
    std::cout << "Transparency: " << color.GetTransparency() << std::endl;
    std::cout << "Type: " << static_cast<int>(color.GetType()) << std::endl;

    Aspose::Cells::Cleanup();
}

コンソール出力

提供された ソースエクセルファイル で上記のサンプルコードを実行したときのコンソール出力は次のとおりです。

Color: Color [A=222, R=255, G=0, B=0]

ColorIndex: 16711672

IsShapeColor: True

Transparency: 0.13

Type: RGB