Reputation: 397
Look at this screenshot: http://imagizer.imageshack.us/a/img844/4241/at9t.jpg ... This is from Powerpoint. There you can change your bullets. But I create a Powerpoint add-in and I need to change bullets in c#.
Here is how to add first bullet (black small circle) but I would like to add others (white big circle or others). How can I do this?
char myCharacter = (char)9675; // white circle unicode
textRange.Paragraphs(i).ParagraphFormat.Bullet.Character = myCharacter;
textRange.Paragraphs(i).ParagraphFormat.Bullet.Type = PpBulletType.ppBulletUnnumbered;
Here is the webpage of microsoft, but I don´t see anything useful for me. http://msdn.microsoft.com/en-us/library/microsoft.office.interop.powerpoint.ppbullettype(v=office.14).aspx
Upvotes: 1
Views: 2613
Reputation: 93
you can also use
textRange.ParagraphFormat.Bullet.Character = '○';
Where '○' (used in above line) can be changed and even can use bullets not defined in powerpoint
Upvotes: 0
Reputation: 1232
Have you tried BulletFormat.Character?
Returns or sets the Unicode character value that is used for bullets in the specified text. Read/write.
int Character { get; set; }
If you want the white circle icon ○
the unicode is 9675
and you can simply cast the number to a char as this example shows or the concept code below.
char myCharacter= (char) 9675; // white circle unicode
textRange.Paragraphs(i).ParagraphFormat.Bullet.Character = myCharacter;
Since it doesn't work at your end, I have created an example that gets the job done. Please let me know if you have any further questions.
// Create the Presentation File
Application pptApplication = new Application();
Presentation pptPresentation = pptApplication.Presentations.Add(MsoTriState.msoTrue);
CustomLayout customLayout = pptPresentation.SlideMaster.CustomLayouts[PpSlideLayout.ppLayoutText];
// Create new Slide
var slides = pptPresentation.Slides;
var slide = slides.AddSlide(1, customLayout);
// Add title
slide.Shapes[1].TextFrame.TextRange.Text = "Title of slide.com";
// Add items to list
var bulletedList = slide.Shapes[2]; // Bulleted point shape
var listTextRange = bulletedList.TextFrame.TextRange;
listTextRange.Text = "Content goes here\nYou can add text\nItem 3";
// Change the bullet character
var format = listTextRange.Paragraphs().ParagraphFormat;
format.Bullet.Character = (char)9675;
pptPresentation.SaveAs(@"c:\temp\fppt.pptx", PpSaveAsFileType.ppSaveAsDefault, MsoTriState.msoTrue);
pptPresentation.Close();
pptApplication.Quit();
Upvotes: 5