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

Free Support Forum - aspose.com

Formatting Slide Notes


We’re using Aspose.Slides successfully to dynamically create a presentation in a ASP.NET environment. The Notes are being pulled from the database where they are stored in HTML format. Tags in question are bold, italics, underline, ordered lists, and unordered lists.

We’re able to successfully put in bold and italics text within the notes, but are stumped when trying to get the other text formatted correctly in the presentation that’s created.

Would appreciate it if you could point us to a code sample or post a snippet of how we can approach this. Good news is that we’re already purchased Slides and it works great so far - along with the other Apose products we’ve used. Bad news is that the client isn’t ready to accept notes that aren’t formatted correctly (atleast as far as the tags above are concerned).

Let us know if you need any more information.

Thanks in advance,

Dear Chandan,

Below is the sample code, it extracts the Ordered and Unordered List items from sample HTML and then insert it on a slide as well as in its Notes.

I have also attached its output as well as code.



static void Main(string[] args)


string sampleHtml = @"

Untitled Page

  • List Item One
  • List Item Two
  • List Item Three

  1. List Item Four
  2. List Item Five
  3. List Item Five


//Create a presentation

Presentation pres = new Presentation();

//Get the slide

Slide sld = pres.GetSlideByPosition(1);


//Add a TextFrame

Shape shp = sld.Shapes.AddRectangle(500, 500, 3000, 1);

shp.LineFormat.ShowLines = false;


TextFrame tf = shp.TextFrame;

tf.FitShapeToText = true;

tf.WrapText = true;

Paragraphs paras = tf.Paragraphs;

//Extract Unordered List Items

string[] ulLstItems = GetListItems(sampleHtml, "

    ", "

//Display it

ShowListItems(ulLstItems, false, paras);


//Add another TextFrame

shp = sld.Shapes.AddRectangle(500, 1500, 3000, 1);

shp.LineFormat.ShowLines = false;


tf = shp.TextFrame;

tf.FitShapeToText = true;

tf.WrapText = true;

paras = tf.Paragraphs;

//Extract Ordered List Items

string[] olLstItems = GetListItems(sampleHtml, "

    ", "

//Display it

ShowListItems(olLstItems, true, paras);


//Also show unordered list inside Notes

Paragraphs notesParas = sld.AddNotes().Paragraphs;

ShowListItems(ulLstItems, false, notesParas);

//Write Presentation on disk



static string[] GetListItems(string Html, string StartTag, string EndTag)


//Get list items from HTML

int idxStartItems = Html.IndexOf(StartTag, StringComparison.CurrentCultureIgnoreCase)

+ StartTag.Length;

int idxEndItems = Html.IndexOf(EndTag, StringComparison.CurrentCultureIgnoreCase);

return Html.Substring(idxStartItems, idxEndItems - idxStartItems)

.Replace("\r", "").Replace("\n", "")

.Split(new string[] { "

  • ", "
  • ", " " }, StringSplitOptions.RemoveEmptyEntries);


    static void ShowListItems(string[] lstItems,bool isOrdered, Paragraphs paras)


    if (isOrdered==true)

    paras[0].BulletType = BulletType.Numbered;

    foreach (String item in lstItems)


    Paragraph para = new Paragraph(paras[0]);

    para.HasBullet = true;

    //para.BulletOffset = 100;

    para.TextOffset = 150;

    para.Portions[0].Text = item;