I've read in the forum that there were issues on the bullets before (font and color), and that they were fixed. Alas, I am using Aspose.Slides 2.9.2.0 and the font on bullets is incorrect. The bullet shows as the paragraph mark in stead of the standard square block (from Wingdings) as used in the template. When I check the bullet style in the resulting presentation, it appears that the bullet does not have a font associated with it, and uses the font from the paragraph test after the bullet.
My code needs to produce an extensive PowerPoint presentation based on a template provided by the customer with the customer style and branding in it. It is important to maintain as much of the style in the template as possible.
Rough outline of what I'm doing (the code is way to complicated to post here, will need to re-write it if you really need an example):
load a template presentation from a stream
delete all slides except last
add slide(s) using Presentation.AddBodySlide()
find placeholders on the new slides by enumerating slide.PlaceHolders and compare each placeholder on the required place holder type (note: would like functions for stuff like that in Aspose.Slides :-) )
cast to PlaceHolder to TextHolder on appropriate place holders
for the first bullet:
update the first portion in the first paragraph
for subsequent bullets:
create a new paragraph using the new Paragraph(Paragraph para) constructor. The parameter passed in is the first paragraph in the textholder
clear the existing portions in the new paragraph
add the paragraph to the TextFrame.Paragraphs collection
create a new portion with the bullet's text
add the portion to the paragraph.Portions collection
delete the remaining slide from the template
save presentation
All formatting goes well (or at least well enough), except the bullet character!
The same logic was used on an older version (called Aspose.Powerpoint back then), and there it worked OK if I copied the formatting from the first portion of the first paragraph to the newer portions in the later paragraphs. That does not make a difference now.
Any suggestions on how to preserve full fidelity from the template in the resulting presentation is very much appreciated.
Thanks for the quick reply. The template is nothing special, even the simplest template exposes this behaviour (that is, any template with a font-based bullet). Anyway, an example is attached.
For your convenience (and for my customer :-) ) here is a rewritten piece of code that shows the bug. (I've tried both .Net 1.1 and .Net 2.0 versions, no difference)
Cheers, Alex
//load a template presentation pres = new Presentation(@"c:\standard.ppt"); //delete all slides except last while (pres.Slides.Count > 1) pres.Slides.RemoveAt(pres.Slides.Count - 1); //add slide(s) using Presentation.AddBodySlide() Slide s = pres.AddBodySlide(); //find placeholders on the new slides by enumerating slide.PlaceHolders and compare each placeholder on the required place holder type (note: would like functions for stuff like that in Aspose.Slides :-) ) Placeholder phBody = null; for (int i = 0; i < s.Placeholders.Count; i++) { Placeholder ph = s.Placeholders[i]; if (ph.PlaceholderType == PlaceholderType.Body) { phBody = ph; break; } } //cast to PlaceHolder to TextHolder on appropriate place holders TextHolder thBody = phBody as TextHolder; if (thBody != null) { //for the first bullet: //update the first portion in the first paragraph thBody.Paragraphs[0].Portions[0].Text = "First bullet"; //for subsequent bullets: //create a new paragraph using the new Paragraph(Paragraph para) constructor. The parameter passed in is the first paragraph in the textholder Paragraph para = new Paragraph(thBody.Paragraphs[0]); //clear the existing portions in the new paragraph para.Portions.Clear(); //add the paragraph to the TextFrame.Paragraphs collection thBody.Paragraphs.Add(para); //create a new portion with the bullet's text Portion por = new Portion("Second bullet"); //add the portion to the paragraph.Portions collection para.Portions.Add(por); } //delete the last slide we got loaded from the template pres.Slides.RemoveAt(0); //save presentation pres.Write(@"c:\report.ppt");