Numbered and Bulletted List generation


#1

I tried inserting numbered/bulletted text in the document using

DocBuilder.ListFormat.ApplyNumberDefault();

DocBuilder.Writeln("Bullet-1");

DocBuilder.ListFormat.ApplyBulletDefault();

DocBuilder.ListFormat.ListIndent();

DocBuilder.ListFormat.ListIndent();

DocBuilder.Writeln("Bullet-1");

DocBuilder.Writeln("Bullet-2");

DocBuilder.Writeln("Bullet-3");

DocBuilder.ListFormat.ListOutdent();

DocBuilder.ListFormat.ListOutdent();

DocBuilder.ListFormat.ApplyNumberDefault();

DocBuilder.ListFormat.ListLevelNumber=1;

DocBuilder.Writeln("Bullet-2");

DocBuilder.Writeln("Bullet-3");

DocBuilder.ListFormat.RemoveNumbers();

The output i am getting is

  1. Bullet-1
  • Bullet-1
  • Bullet-2
  • Bullet-3
  1. Bullet-2
  2. Bullet-3

But i want to generate the output in the below format

1. Bullet-1

  • Bullet-1
  • Bullet-2
  • Bullet-3

2. Bullet-2

3. Bullet-3

How can i do that?


#2

List formatting have limited support in Aspose.Words. We plan to add richer support for list formatting and styles later this year.

It is still possible to do some list manipulation even with the current model.

For a example in your case you can do the following:

builder.ListFormat.ApplyNumberDefault();

builder.ListFormat.ListLevelNumber = 0;

builder.Writeln("Number-1");

Paragraph para1 = builder.CurrentParagraph;

builder.Writeln("");

builder.Writeln("Number-2");

builder.Writeln("Number-3");

builder.ListFormat.RemoveNumbers();

builder.MoveTo(para1);

builder.ListFormat.ApplyBulletDefault();

builder.ListFormat.ListIndent();

builder.ListFormat.ListIndent();

builder.Writeln("Bullet-1");

builder.Writeln("Bullet-2");

builder.Writeln("Bullet-3");

builder.CurrentParagraph.Remove();

builder.ListFormat.RemoveNumbers();