This is a migrated thread and some comments may be shown as answers.

Simple Bullet List

3 Answers 127 Views
WordsProcessing
This is a migrated thread and some comments may be shown as answers.
AP
Top achievements
Rank 1
Veteran
AP asked on 20 Jun 2018, 02:01 PM

I'm trying to create a simple two item list, with bullets using the RadFlowDocument and RadFlowDocumentEditor.

Like this:-

  • Item One
  • Item Two

I have to admit it's hard going, as the documentation leaves a lot to be desired (why do none of the examples actually end up creating anything in a document?).

I currently have:-

List list = new List();
 
 newDoc.Lists.Add(list);
 
list.Levels[0].StartIndex = 1;
list.Levels[0].NumberingStyle = NumberingStyle.Bullet;
list.Levels[0].ParagraphProperties.LeftIndent.LocalValue = 24;
 
var line1=  editor.InsertLine("Line One");
line1.Paragraph.ListId = list.Id;
 
var line2=editor.InsertLine("Line Two");
line2.Paragraph.ListId = list.Id;

 

This sort of works, with the two lines being indented, but no bullet character is shown.

This thing should be simple, but isn't.

3 Answers, 1 is accepted

Sort by
0
Accepted
Boby
Telerik team
answered on 25 Jun 2018, 01:21 PM
Hi AP,

We understand that the model of the lists is quite complex, so we've provided list templates. Using them, the code could be modified as follows:
List list = newDoc.Lists.Add(ListTemplateType.BulletDefault);
 
var section = newDoc.Sections.AddSection();
var paragraph1 = section.Blocks.AddParagraph();
paragraph1.Inlines.AddRun("Line One");
paragraph1.ListId = list.Id;
paragraph1.ListLevel = 0;
 
var paragraph2 = section.Blocks.AddParagraph();
paragraph2.Inlines.AddRun("Line Two");
paragraph2.ListId = list.Id;
paragraph2.ListLevel = 0;

I will also notify the documentation team that this information is not so visible in the help article. If you have other suggestions on how to improve the API or the documentation, please let us know. 

Regards,
Boby
Progress Telerik

0
AP
Top achievements
Rank 1
Veteran
answered on 25 Jun 2018, 01:30 PM

Thanks for this, it does exactly what I want now.

As far as documentation is concerned, an example which creates a document from scratch using sections, paragraphs and blocks etc.., with a table or two, along with a bulleted / numbered list would be extremely helpful. The only example you have simply uses the editor insertLine and insertText functions, with a table to hold the image  and signature.

This isn't helpful when trying to work out how the more complex features work.

0
Boby
Telerik team
answered on 26 Jun 2018, 08:09 AM
Hi AP,

Thanks for the suggestion. I've tried make the lists information more visible, and log an internal item to extend the GenerateDocument SDK example with more document model features. I've added some Telerik points to your accountas a token of appreciation for taking time to give us feedback.

Regards,
Boby
Progress Telerik

Tags
WordsProcessing
Asked by
AP
Top achievements
Rank 1
Veteran
Answers by
Boby
Telerik team
AP
Top achievements
Rank 1
Veteran
Share this question
or