user1334858
user1334858

Reputation: 1935

Place Bullets in Text Box Powerpoint C++/CLI

I am placing a text box on a slide with my program, but I want to have bullets in the text box. I cannot seem to find how to do this? Say I have the text in a string:

Hey \rIt is cold

How do I turn that into bullets like:

 - Hey 
 - It is cold

I have found:

NewSlide->Shapes[1]->TextFrame->TextRange->ParagraphFormat->Bullet->Character = 8226;

But now the issue is how do I change the indentation of the second line I have tried

txtRange->Paragraphs(1,1)->IndentLevel = 2;
txtRange->Paragraphs(2,1)->IndentLevel = 3;

But it does not change the indentation at all when my PPT shows up, but in my code when I debug it says there is a different indentation? How do I use the Paragraphs method to change the indentation?

Upvotes: 1

Views: 342

Answers (1)

JohnZaj
JohnZaj

Reputation: 3230

The ParagraphFormat.Bullet property is read-only, however it is still a full-fledged object that has access to other objects such as Character. You can insert a bullet character using NewSlide->Shapes[1]->TextFrame->TextRange->Paragraphs[1]->ParagraphFormat->Bullet->Character = 8226. (8226 is the Unicode character value). There is also the Bullet.Type property where you can set an enumeration for example: Bullet.Type = ppBulletUnnumbered

You can set the IndentLevel of the bulleted paragraph with NewSlide->Shapes[1]->TextFrame->TextRange->Paragraphs[1]->IndentLevel = {yourInteger1through5}

Side note: In my experience, if you have a lot of work to do with programming Office documents, instead of fighting with its object model, it is best to ditch Interop and use OpenXML.

Upvotes: 1

Related Questions