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

Free Support Forum - aspose.com

IndexOutOfRangeException when Saving presentation that contains bullet lists

I am using version 8.1.0.0 (we are planning to update to the latest version but there are numerous API changes and our next application release is due)


I am trying to add a bullet list to a slide, but whenever I try to save, it crashes with IndexOutOfRangeException during PresentationEx.Save(). The exception is thrown in ParagraphFormatEx.Save()

I have tried two ways to do this. One is using the Paragraph.AddFromHTML() method and pass in “
” markup and another way is to manually add paragraphs with BulletType set to Numbered and Depth set to 1.

var currentDepth = paragraph.ParagraphFormat.Depth;
paragraph = new ParagraphEx();
paragraph.ParagraphFormat.BulletType = BulletTypeEx.Numbered;
paragraph.ParagraphFormat.Depth = (short)(currentDepth + 1);
textFrame.Paragraphs.Add(paragraph);

Then I add a portion to the paragraph and add newlines for each list item.

Is this a known issue and has this been fixed in newer versions?

Apparently this issue occurs when no NumberedBulletStyle has been set on the ParagraphFormat, or when it is set to NumberedBulletStyleEx.NotDefined. You need to set the NumberedBulletStyle to some other value than NotDefined.


The problem also exists when adding from html. The default is still NotDefined so the exception will still be thrown.

The following code can fix this:

shape.AddTextFrame("");

var textFrame = shape.TextFrame;

textFrame.Paragraphs.Clear();
textFrame.Paragraphs.AddFromHtml(“
  1. A
  2. B
  3. C
”);

foreach (ParagraphEx paragraph in textFrame.Paragraphs)
{
if (paragraph.ParagraphFormat.BulletType == BulletTypeEx.Numbered && paragraph.ParagraphFormat.NumberedBulletStyle == NumberedBulletStyleEx.NotDefined)
{
paragraph.ParagraphFormat.NumberedBulletStyle = NumberedBulletStyleEx.BulletArabicPeriod;
}
}

Hi David,

Thank you for the details.

I am able to reproduce your mentioned issue after an initial test regarding Numbered Bullets. Your reported issue has been registered in our issue tracking system with issue id: SLIDESNET-36113. You will be notified via this forum thread once the issue gets resolved.

Thanks & Regards,

The issues you have found earlier (filed as SLIDESNET-36113) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by Aspose Notifier.