Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Wed Dec 22, 2021 9:19 pm

I have below. Everything is fine other than I want number list instead of bullet list. How can I get number list? It does not look like list object has this option.

Please advise!

PdfListItemCollection coll = new PdfListItemCollection();

coll.Add(new PdfListItem(@"Long paragraph one."));
coll.Add(new PdfListItem(@"Long paragraph two."));
coll.Add(new PdfListItem(@"Long paragraph three."));

PdfList list = new PdfList(coll);
list.Font = smallerFont;
list.Indent = 8;
list.TextIndent = 5;
list.Brush = brush;

PdfLayoutResult result = list.Draw(page, 0, y);

tyiniceblue
 
Posts: 2
Joined: Thu Dec 16, 2021 8:40 pm

Thu Dec 23, 2021 1:52 am

Hello,

Thanks for your inquiry!

Please refer to the following code to change the bullet list to number list. If you have any other questions, just feel free to write back!

Code: Select all
            PdfDocument pdf = new PdfDocument();
            PdfPageBase page = pdf.Pages.Add();

            PdfListItemCollection coll = new PdfListItemCollection();       
            coll.Add(new PdfListItem(@"Long paragraph one."));
            coll.Add(new PdfListItem(@"Long paragraph two."));
            coll.Add(new PdfListItem(@"Long paragraph three."));


            PdfSortedList SortedList = new PdfSortedList(coll);
            SortedList.Font = new PdfTrueTypeFont(new Font("Arial",12f),true);
            SortedList.Indent = 8;
            SortedList.TextIndent = 5;
            SortedList.Brush = PdfBrushes.Red;
           

            PdfLayoutResult result = SortedList.Draw(page, 0, 20);

            string a = "result.pdf";
            pdf.SaveToFile(a);


Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Thu Dec 23, 2021 3:31 pm

Your suggestion works perfectly, exactly what I need. Thank you Marcia!

tyiniceblue
 
Posts: 2
Joined: Thu Dec 16, 2021 8:40 pm

Fri Dec 24, 2021 2:12 am

Hello,

Thanks for your feedback!

Glad to hear that the code is working.

If you encounter any issues related to our product in the future, just feel free to contact us.

Have a nice day!

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.PDF

cron