Hi,
I would like to extract shape properties like shape fill, shadow, font color etc which has been applied through the theme.
Without extracting the theme directly, how can shape properties be extracted?
Thanks
Hi,
I would like to extract shape properties like shape fill, shadow, font color etc which has been applied through the theme.
Without extracting the theme directly, how can shape properties be extracted?
Thanks
@pankajku,
Thank you for your question.
In Aspose.Slides for C++, many visual properties of shapes—such as fill color, shadow, and font color—can be inherited from the master slide or design theme. When a shape does not explicitly define a particular property, its value is typically resolved through the theme or parent elements.
As a result, to accurately determine the final appearance of a shape, it’s necessary to check whether the property is set locally or inherited. This involves examining the corresponding theme or master slide definitions, even if you’re not extracting the theme as a separate object.
In short, while you can access some properties directly from the shape, a full understanding of its appearance requires traversing the inheritance chain and comparing values with the theme elements applied to the slide.
Let us know if you need an example or further clarification.
Can you please provide an example on how to extract shape fill color using theme?
@pankajku,
Please ty using the following code example:
auto presentation = MakeObject<Presentation>(u"sample.pptx");
auto slide = presentation->get_Slide(0);
auto autoshape = ExplicitCast<IAutoShape>(slide->get_Shape(0));
// Get the color from the shape style.
auto schemeColor = autoshape->get_ShapeStyle()->get_FillColor()->get_SchemeColor();
auto colorType = autoshape->get_ShapeStyle()->get_FillColor()->get_ColorType();
auto color = autoshape->get_ShapeStyle()->get_FillColor()->get_Color();
// Get the color from the Accent 1 theme.
auto colorScheme = presentation->get_MasterTheme()->get_ColorScheme();
auto accent1Color = colorScheme->get_Accent1()->get_Color();
More examples:
Presentation Theme|Aspose.Slides Documentation