Free Support Forum - aspose.com

Lists within lists and within table cells

Is it possible to have lists within lists, either bulleted or ordered?

Also, is it possible to have lists within a table cell or even plain text plus a list within a cell?

Dear jhoward88,

Thank you for considering Aspose.

Lists within lists and within table cells are not supported in the current version. But you can easyly implement them by your self using multiple-segment text. We will consider enhance the list feature when we have finished our current work (hopes to be in late Sep).

I tried an example (see below) which works ok, but how do I adjust the space between the bullet or number and the text that follows? I tried firstLineIndent, but that just adds makes the space larger after the bullet.

Dim pdf As pdf = New pdf
Dim sec1 As Section = pdf.Sections.Add()
Dim heading1 As Heading = New Heading(pdf, sec1, 1)
Dim segment1 As Segment = New Segment(heading1)
heading1.Segments.Add(segment1)
heading1.IsAutoSequence = True
segment1.Content = "First line of numbered list"
sec1.Paragraphs.Add(heading1)
Dim heading1B As Heading = New Heading(pdf, sec1, 1)
Dim segment1B As Segment = New Segment(heading1B)
heading1B.Segments.Add(segment1B)
heading1B.IsAutoSequence = False
heading1B.LabelWidth = 5
heading1B.UserLabel = "bullet1"
heading1B.Margin.Left = 15
segment1B.Content = "First line of bullet list within numbered list"
sec1.Paragraphs.Add(heading1B)

Dear jhoward88,

Thank you for considering Aspose.

The “LabelWidth” is used to adjust the space between the bullet or number and the text that follows. But there is a bug when using this property for system defined bullet. I have fixed this bug. Please download hot fix here.

Thanks Tommy, The fix worked just fine!

Tommy, Now that I know how to do lists within lists, how would I put that same list into a table cell? I have been trying various things and the list always seems to appear outside the table.

Thanks for your help.

Dear jhoward88,

Thank you for considering Aspose.

List in table cell is not supported directly. But you can easyly implement it using multi-segment text. Here is an example:

[XML]







l
bullet1







[C#]
Pdf pdf1 = new Pdf();
Section sec1 = pdf1.Sections.Add();

Table table1 = new Table();
sec1.Paragraphs.Add(table1);

table1.DefaultCellBorder = new BorderInfo((int)BorderSide.All);

Row row1 = table1.Rows.Add();

Cell cell1 = row1.Cells.Add();
Text text1 = new Text();
cell1.Paragraphs.Add(text1);

Segment seg1 = text1.Segments.Add(((char)108).ToString());
seg1.TextInfo.FontName = "ZapfDingbats";
text1.Segments.Add(" bullet1");

pdf1.Save("e:/temp/test.pdf");

[VisualBasic]
Dim pdf1 As Pdf = New Pdf()
Dim sec1 As Section = pdf1.Sections.Add()

Dim table1 As Table = New Table()
sec1.Paragraphs.Add(table1)

table1.DefaultCellBorder = New BorderInfo(BorderSide.All)

Dim row1 As Row = table1.Rows.Add()

Dim cell1 As Cell = row1.Cells.Add()
Dim text1 As Aspose.Pdf.Text = New Aspose.Pdf.Text()
cell1.Paragraphs.Add(text1)

Dim seg1 As Segment = text1.Segments.Add(Microsoft.VisualBasic.ChrW(108).ToString())
seg1.TextInfo.FontName = "ZapfDingbats"
text1.Segments.Add(" bullet1")

pdf1.Save("e:/temp/test.pdf")