Portion::get_Text Returns Sentence-Cased Text Instead of Original Uppercase

Hi team,

for (const auto& portion : paragraph->get_Portions()) {
            std::string portionText = portion->get_Text().ToUtf8String();
}

currently some portion text that we are getting is in sentence case, although in powerpoint it is in uppercase.
in the attached ppt:

  • “WAY TO ACHIEVE A STATE OF PEACE” comes as “way to achieve a state of peace” in portion text
  • “BALANCE” comes correctly as “BALANCE”.

Please look into this. I have attached the concerned ppt for you reference.
test1 (1).pptx.zip (587.3 KB)

we are using aspose 24.5

@pankajku,
Thank you for contacting free support. I need some time to check the issue. I will get back to you as soon as possible.

@pankajku,
Thank you for your patience. Please note that the IPortion::get_Text method returns the text exactly as it is stored in the presentation file.

If you need to retrieve text processed according to PowerPoint’s settings, use the TextCapType property.
The following example demonstrates how to do this:

for (const auto& portion : paragraph->get_Portions()) {
    auto sourceText = portion->get_Text();

    auto portionFormat = portion->get_PortionFormat()->GetEffective();
    if (portionFormat->get_TextCapType() == TextCapType::All) {
        sourceText = sourceText.ToUpper();
    }

    std::string portionText = sourceText.ToUtf8String();
}

Thank you. This helped resolve the issue.

@pankajku,
Thank you for using Aspose.Slides for C++.

Hi @andrey.potapov ,

  • TextCapType::None - No text transformation
  • TextCapType::All - All uppercase
  • TextCapType::Small - Small caps/lowercase
    but we do not have a case for sentence case, toggle case and Capitalize/Title casing. Is there any other api that we are missing out?

@pankajku,
I’ve carefully reviewed your requirements. Unfortunately, PowerPoint does not store the settings you listed in the presentation file. It applies those settings to the text and saves only the transformed text.

@andrey.potapov Do we have any means to know if the casing is toggle or title case?
like we have TextCapType::All that corresponds to Uppercase setting from powerpoint side
group copy.pptx.zip (26.0 KB)

please go through presentation for more clarity.

@pankajku,
PowerPoint stores the All Caps effect in the file, so Aspose.Slides can retrieve it. However, Toggle Case and Title Case aren’t stored in the file, so Aspose.Slides can’t retrieve them.

When the All Caps effect is applied, the text itself isn’t modified in the file—only the setting is stored. When the Toggle Case effect is applied, the text is transformed and that transformed text is saved in the file.

group copy.pptx.zip (26.0 KB)

we are using if (portion->get_PortionFormat()->GetEffective()->get_TextCapType() == TextCapType::All)
the above ppt never returns TextCapType::All or TextCapType::Small for any of the texts in the textbox. It always returns None. Can you check this?

Continuing the previous conversation, we need to retrieve the toggle case and title case from aspose as it is getting listed in UI as a dropdown of which casing is applied.

@andrey.potapov

@pankajku,
I need some time to continue investigating the issue. I will get back to you as soon as possible.

@pankajku,
In PowerPoint, there are two capitalization options: Small Caps and All Caps.

PowerPoint stores these options in the “cap” attribute in the presentation file:

In Aspose.Slides for C++, these options are represented by the TextCapType enumeration.

Also, in PowerPoint, there are the following commands:

These commands transform the text, and the presentation file stores only the transformed result. Because the file format does not preserve flags for these transformations, Aspose.Slides cannot detect or retrieve them.

As for the “group copy.pptx” file, you can rename it to “group copy.zip,” unzip it, and open “group copy.zip/ppt/slides/slide1.xml.” You will see that the text is stored in its transformed state as is, and there are no additional attributes that correspond to these commands.