We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Bullet font incorrect

dear Apose team,

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.

Regards
Alex

Dear Alex,

Thanks for reporting.

I will look into it and let you know as soon as possible. It would be helpful, if you attach your template ppt file.

Hi Shakeel,

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.

Cheers,
Alex

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");

Thanks for code example. It works for as late as 2.8.4.0 and broken in newer version. We will fix it as soon as possible.

Shakeel,

where can I get 2.8.4 for .Net 1.1?

Cheers,
Alex

Dear Alex,

Please get it from this link.

http://www.aspose.com/community/files/51/file-format-components/aspose.slides-for-.net-and-java/entry120790.aspx