We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date
close icon

Add bulleted list to a paragraph programatically

I have checked the online documentation but the documentation is for the old RichTextBoxAdv control and not for the new version 13.2 SfRichTextBoxAdv control.
Could you please, if possible, give me an example of hot to programtically add a bulleted/numbered list to a paragraph.

Thank you,

Shaun Verduyn

6 Replies

AP Arumuga Perumal S Syncfusion Team July 15, 2015 05:42 AM UTC

Hi Shaun,

Thank you for your interest in Syncfusion products.

Our RichTextBoxAdv control supports both simple list and multilevel list. We have mentioned below the sample code snippet to illustrate how to add a list to the RichTextBoxAdv document and how to apply the list to the paragraph.

Sample Code:

[C#]


// Initializes a new abstract list instance.

AbstractListAdv abstractListAdv = new AbstractListAdv(null);

abstractListAdv.AbstractListId = 1;

// Creates a new list instance.

ListAdv listAdv = new ListAdv(null);

listAdv.AbstractList = abstractListAdv;

listAdv.AbstractListId = abstractListAdv.AbstractListId;

listAdv.ListId = 1;

// Defines new ListLevel instance.

ListLevelAdv listLevel = new ListLevelAdv(abstractListAdv);

listLevel.ParagraphFormat.LeftIndent = 48d;

listLevel.ParagraphFormat.FirstLineIndent = 24d;

listLevel.FollowCharacter = FollowCharacterType.Tab;

listLevel.ListLevelPattern = ListLevelPattern.LowLetter;

listLevel.NumberFormat = "(%1.)";

listLevel.RestartLevel = 0;

listLevel.StartAt = 1;

// Adds list level to abstract list.

abstractListAdv.Levels.Add(listLevel);


// Adds abstract list to the document.

richTextBoxAdv.Document.AbstractLists.Add(abstractListAdv);

// Adds list to the document.

richTextBoxAdv.Document.Lists.Add(listAdv);

// Defines list format for a paragraph.

paragraph.ParagraphFormat.ListFormat.ListId = listAdv.ListId;

paragraph.ParagraphFormat.ListFormat.ListLevelNumber = 0;



We have also prepared a sample to demonstrate the same. Please do find the sample from below link. Try running the sample and let us know if this helps you.

Sample link:
Sample

Please let us know if you have any other questions.

Regards,
Arumuga Perumal S.



SV Shaun Verduyn July 15, 2015 10:34 AM UTC

Hi Arumuga,

Awesome, thank you very much for the sample, the great support and the great controls. I tested the sample and it works great!
Will see if I can implement it correctly in my project.

Thank you,

Shaun



SV Shaun Verduyn July 15, 2015 12:42 PM UTC

Hi Arumuga,

I have managed to get it working, but I can't seem to get the following right :-

Wall Type Information
1.  The following types of masonry walling comply with the R-value requirements:
     a.  Double-skin masonry with no cavity, plastered internally, or rendered externally; or NOTE The cavity and grouted cavity walling systems exceed the minimum R-value of 0.35
     b.  Single-leaf masonry walls with a nominal wall thickness greater than or equal to 140 mm (excluding plastering and rendering), plastered internally and rendered externally. The requirements refer to the external walls of the habitable portions of
          the building fabric only
2.  For masonry walling types not covered in 4.4.3.2, such walls shall achieve a minimum total R-value of 0.35. The total R-value shall be determined by means of a test conducted in accordance with ASTM C 1363, ASTM C 518 or ASTM C 177. Surface
     film resistance shall be in accordance with SANS 6946.

Could you please show me how to do this.

Thank you,

Shaun


AP Arumuga Perumal S Syncfusion Team July 16, 2015 05:30 AM UTC

Hi Shaun,

Thank you for your update.

We have prepared a sample to illustrate how to create multilevel list in SfRichTextBoxAdv control programmatically as per your requirement. Please do find the sample from below link. Try running the sample and let us know if this helps you.

Sample link:
MultiLevelListSample

Please let us know if you have any other questions.

Regards,
Arumuga Perumal S.



SV Shaun Verduyn July 16, 2015 08:13 AM UTC

Hi Arumuga,

The sample is great, actually a life saver. I was tearing my hear out and managed to get it part way there, what got me was the setting up of the abstract levels.
Feel a bit stupid now that I see how simple it actually is.

Thank you very much, it is most appreciated!!

Thanks,

Shaun


SK Sathish K Syncfusion Team July 17, 2015 03:42 PM UTC

Hi Shaun,

Thank you for your valuable feedback. It is our pleasure to know that the provided sample has resolved your issue. Please let us know if you need further assistance. We will be happy to assist you as always.

Regards,
Sathish


Loader.
Live Chat Icon For mobile
Up arrow icon