How to add bullets to TableCell in code

1 Answer 45 Views
RichTextBox
Steve
Top achievements
Rank 2
Iron
Iron
Iron
Steve asked on 06 Sep 2024, 09:55 AM

Hi,

I need to add bullets to a TableCell from code. I have tried cell.Blocks.Add(bullets) where bullets is a DocumentList but I am getting 'cannot convert from DocumentList to Block.

Code snippet:


                            DocumentList bullets = new DocumentList(DefaultListStyles.Bulleted, document);
                            p1 = new Paragraph();
                            s1 = new Span();
                            cell1.Background = Color.FromRgb(255, 255, 255);
                            cell1.PreferredWidth = w1;
                            cell1.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                            s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                            s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                            s1.Text = name;
                            p1.Inlines.Add(s1);
                            bullets.AddParagraph(p1);
                            cell1.Blocks.Add(bullets);

Thank you

1 Answer, 1 is accepted

Sort by
0
Steve
Top achievements
Rank 2
Iron
Iron
Iron
answered on 06 Sep 2024, 10:22 AM

Okay found the answer, you don't need to add the DocumentList to the cell, the below works:

 

 
                            DocumentList bullets = new DocumentList(DefaultListStyles.Bulleted, document);
                            p1 = new Paragraph();
                            s1 = new Span();
                            cell1.Background = Color.FromRgb(255, 255, 255);
                            cell1.PreferredWidth = w1;
                            cell1.Padding = new Telerik.Windows.Documents.Layout.Padding(3, 6, 3, 6);
                            s1.FontFamily = new FontFamily(CGlobals.docu_default_font);
                            s1.FontSize = Unit.PointToDip(CGlobals.docu_default_font_size);
                            s1.Text = name;
                            p1.Inlines.Add(s1);
                            bullets.AddParagraph(p1);
                            cell1.Blocks.Add(p1);

Tags
RichTextBox
Asked by
Steve
Top achievements
Rank 2
Iron
Iron
Iron
Answers by
Steve
Top achievements
Rank 2
Iron
Iron
Iron
Share this question
or