We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Level Number Format not appearing

I have been trying to format a list using the following code:

mindMapList = doc.getLists().add(ListTemplate.NUMBER_DEFAULT);

mindMapList.getListLevels().get(0).setNumberFormat("\u0000");
mindMapList.getListLevels().get(0).setNumberStyle(NumberStyle.ARABIC);

mindMapList.getListLevels().get(1).setNumberFormat("(\u0000.\u0001)");
mindMapList.getListLevels().get(1).setNumberStyle(NumberStyle.ARABIC);
mindMapList.getListLevels().get(1).isRestartAfterHigher(true);
mindMapList.getListLevels().get(1).setRestartAfterLevel(0);

mindMapList.getListLevels().get(2).setNumberFormat("\u0000.\u0001.\u0002");
mindMapList.getListLevels().get(2).setNumberStyle(NumberStyle.ARABIC);
mindMapList.getListLevels().get(2).isRestartAfterHigher(true);
mindMapList.getListLevels().get(2).setRestartAfterLevel(1);

builder.getListFormat().setList(mindMapList);

but it does not appear correctly after i have inserted things into the document, there are no numbers and no indentation. The only level that appears indented and numbered correctly is level 0 that is formatted with “\u0000”. If i then go and change level 1 to just “\u0001” then it indents correctly and shows a number. Am i doing something wrong, i am trying to get something like:

1
1.1
1.2
1.2.1
1.2.2

and so on.

Hi
Thanks fro your inquiry. Please try using the following code example.

// Create document
Document doc = new Document();
// Create Builder
DocumentBuilder builder = new DocumentBuilder(doc);
// Start list
builder.getListFormat().applyNumberDefault();
// Set number format
builder.getListFormat().getListLevel().setNumberFormat("\u0000");
builder.writeln("Item 1");
builder.writeln("Item 2");
// Increases the list level of the current paragraph by one level. 
builder.getListFormat().listIndent();
builder.getListFormat().getListLevel().setNumberFormat("\u0000.\u0001");
builder.getListFormat().getListLevel().setNumberStyle(NumberStyle.ARABIC);
builder.writeln("Item 2.1");
builder.writeln("Item 2.2");
builder.getListFormat().listIndent();
builder.getListFormat().getListLevel().setNumberFormat("\u0000.\u0001.\u0002");
builder.getListFormat().getListLevel().setNumberStyle(NumberStyle.ARABIC);
builder.writeln("Item 2.2.1");
builder.writeln("Item 2.2.2");
// Decreases the list level of the current paragraph by one level.
builder.getListFormat().listOutdent();
builder.writeln("Item 2.3");
builder.getListFormat().listOutdent();
builder.writeln("Item 3");
builder.getListFormat().removeNumbers();
// Save output.
doc.save("out.doc");

Hope this helps.
Best regards.

I cannot get the above code to work either, the output is gives is:

1 Item 1
2 Item 2
Item 2.1
Item 2.2
Item 2.2.1
Item 2.2.2
Item 2.3
3 Item 3
which is the same problem as i was getting before. it only seems able to apply one level, i can do “\u0001” but not “\u0000.\u0001”.

Hi
It is strange. This code works fine on my side. I use for testing the latest version of Aspose.Words for Java. I attached generated document.
Best regards.

That document doesnt appear correctly on mine either. I think it may be a problem displaying it with word 2007 (which is what i am running), when i tested it on a previous version of word it works ok. Are you running 2007 or a previous version?

Hi
Thank you for additional information. Now I see the problem. I have managed to reproduce this issue on .NET and Java versions of Aspose.Words. I created an issue # 4445 in our defect database. Issue will be fixed on .NET version and then fix is ported to Java version.
Best regards.

I am running the evaluation version (2.5.0) and the issue persists. Is there any workaround to produce a list like the examples above?

Hi
Thanks for your inquiry. Unfortunately this issue is unresolved yet.
Best regards.

Hi,
Is this problem has been solved for Java?
I am facing same problem.

Hi

Thanks for your request. I have tested with the latest version and I cannot reproduce this problem on my side.
Best regards,

The issues you have found earlier (filed as 4445) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(53)