Embed list inside text paragraph

Hi, I’m using Aspose.PDF.Generator for .NET 3.5. So far the aspose API has all the functionality I need, but I don’t know how to embed a list inside a text paragraph.

Example:

Paragraph Starts here
  1. Element 1
  2. Element 2
Paragraph ends here

I checked out the ListSection object but since the list will be in another section, I don’t think this is suitable.

What can I do?

Hi Mikael,

Thanks for contacting support and sorry for the delayed response.

In order to accomplish your requirement, I would suggest you use HTML tags inside text. Please try using the following code snippet. For your reference, I have also attached the resultant file generated on my end.

You may also check HTML Tags in Text

C#

//Instantiate a Pdf document
Aspose.Pdf.Generator.Pdf pdf1 = new Aspose.Pdf.Generator.Pdf();
//Create a section in the Pdf document
Aspose.Pdf.Generator.Section sec1 = pdf1.Sections.Add();
//Create string variables with text containing HTML tags
string s =
"use markdown "
<here>
Paragraph Starts here
<ol><li>Element 1</li><li>Element 2</li></ol>
Paragraph ends here
//Create text paragraphs containing HTML text
Aspose.Pdf.Generator.Text text1 = new Aspose.Pdf.Generator.Text(s);
  text1.IsHtmlTagSupported = true;
//Add the text paragraphs containing HTML tags to section
sec1.Paragraphs.Add(text1);
//Save the Pdf document
pdf1.Save("c:/pdftest/TestHtml.pdf");