# Bullet list with no bullet

#1

In Word is possible to customize a bullet list to use a custom bullet, or remove the bullet entirely.
I need lists that have the proper indentation but no visible bullet. Is it possible to do it with Aspose (Java)?
If I do listFormat.removeNumbers() not just the bullets get removed, but also the indentation.

#2

Please ZIP and attach your expected Word document showing the correct output here for our reference. You can create expected document by using MS Word. Please also list complete Steps that you used in MS Word to create that expected document. We will then investigate the scenario on our end and provide you code to achieve the same by using Aspose.Words.

#3

Hi Awais, please find attached the zip file:

cm01304.en19.docx.zip (26.6 KB)

The document includes a multilevel list in which each line has its own style with its custom number format. The numbers are not in order, so the automatic numbering needs to be turned off. The number can also be a alphabet letter. This needs to be a list because if the line contains a long text that require multiple lines, the text cannot go under the line number, so it needs to be indented correctly as a multilevel list.

#4

We are working on your query and will get back to you soon.

#5

I think, you can get the desired results just by using the ParagraphFormat.LeftIndent, ParagraphFormat.RightIndent and ParagraphFormat.FirstLineIndent properties. Please see these input and output Word documents (Docs.zip (18.4 KB)) and try running the following code:

Document doc = new Document("E:\\cm01304.en19\\in.docx");

Paragraph firstPara = doc.FirstSection.Body.FirstParagraph;
firstPara.ParagraphFormat.LeftIndent = 0.5 * 36; // half inch

Paragraph targetPara = doc.LastSection.Body.LastParagraph;
targetPara.ParagraphFormat.LeftIndent = 1.0 * 72;
targetPara.ParagraphFormat.FirstLineIndent = -0.5 * 72;

TabStop ts = new TabStop(0.5 * 72, Aspose.Words.TabAlignment.Left, TabLeader.None);

Run beforeTab = new Run(doc, "1)");
targetPara.AppendChild(beforeTab);

Run run = new Run(doc, ControlChar.Tab);
targetPara.AppendChild(run);

Run afterTab = new Run(doc, "some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text ");
targetPara.AppendChild(afterTab);

doc.Save("E:\\cm01304.en19\\19.4.docx");


Hope, this helps.

#6

Thanks Awais, I think this might help me, but I need to create a brand new document, not to modify an existing one. Could you provide some code that does the same thing, but using the DocumentBuilder, instead of opening a Document from the file system? Also could you please use Java?

Kind regards

#7

Please see the following Java code:

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

builder.getParagraphFormat().setLeftIndent(1.0 * 72);
builder.getParagraphFormat().setFirstLineIndent(-0.5 * 72);

TabStop ts = new TabStop(0.5 * 72, TabAlignment.LEFT, TabLeader.NONE);

Run beforeTab = new Run(doc, "1)");
builder.getCurrentParagraph().appendChild(beforeTab);

Run run = new Run(doc, ControlChar.TAB);
builder.getCurrentParagraph().appendChild(run);

Run afterTab = new Run(doc, "some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text some long text ");
builder.getCurrentParagraph().appendChild(afterTab);

doc.save("E:\\Temp\\awjava-19.4.docx");


Hope, this helps.

#8

Hi Awais, yes that helped a lot. Thanks!