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

Free Support Forum - aspose.com

List number format (\u0000.\u0001) does not work for Word

Hi ,
i am using Aspose.Words.jdk15-11.2.0.jar and getting issue related to List number format (\u0000.\u0001) does not work for Word in MS word 2010 and 2007.

My test code is

Document doc = null;
try
{
    doc = new Document();
}
catch (Exception e1)
{
    // TODO Auto-generated catch block
    e1.printStackTrace();
}

DocumentBuilder builder = new DocumentBuilder(doc);
// Create a list.
com.aspose.words.List list = doc.getLists().add(ListTemplate.NUMBER_ARABIC_DOT);
// Configure list if necessary
// Configure first level.
list.getListLevels().get(0).setNumberStyle(NumberStyle.ARABIC);
list.getListLevels().get(0).setNumberFormat("\u0000)");
// Configure second level
list.getListLevels().get(1).setNumberStyle(NumberStyle.ARABIC);
list.getListLevels().get(1).setNumberFormat("\u0000.\u0001)");
// Configure next levels if neccessary
// …
// First level styel.
// Create a style with a list asociated with it.
Style firstLevelStyel = doc.getStyles().add(StyleType.PARAGRAPH, "FirstLevel");
// Asociate a list with style.
firstLevelStyel.getListFormat().setList(list);
firstLevelStyel.getListFormat().setListLevelNumber(0);
firstLevelStyel.getFont().setSize(20);
// Second level styel.
Style secondLevelStyel = doc.getStyles().add(StyleType.PARAGRAPH, "SecondLevel");
secondLevelStyel.getListFormat().setList(list);
secondLevelStyel.getListFormat().setListLevelNumber(1);
// Apply the list to the current paragraph.
builder.getParagraphFormat().setStyle(firstLevelStyel);
builder.writeln("item 1");
// Incerease level.
builder.getParagraphFormat().setStyle(secondLevelStyel);
builder.writeln("item 1.1");
builder.writeln("item 1.2");
builder.writeln("item 1.3");
// Decrease level
builder.getParagraphFormat().setStyle(firstLevelStyel);
builder.writeln("item 2");
// Disable numbering.
builder.getParagraphFormat().setStyleIdentifier(StyleIdentifier.NORMAL);
try
{
    doc.save("C:\ Test.doc");

}
catch (Exception e)
{
    // TODO Auto-generated catch block
    e.printStackTrace();
}

and output of code is :

please, replay as soon as possible

Thanks & regards.

Hi Nikhil,

Thanks for your interest in Aspose.Words.

Could you please attach your target Word document showing the desired behavior here for testing. I will investigate as to how you are expecting your final document to be generated like. You can use Microsoft Word to create your target Word document. I will then provide you code to achieve what you’re looking for.

Best regards,

hi Awais,

My Actual and Expected Results :

Actual Result is :

  1. item 1
    item 1.1
    item 1.2
    item 1.3
  2. item 2

Expected Result should be :

  1. item 1
    1.1) item 1.1
    1.2) item 1.2
    1.3) item 1.3
  2. item 2

Thanks & regards.

Hi Nikhil,

Thanks for the additional information. We’re checking with this scenario and will get back to you soon.

Best regards,

hi Awais,

Thanks for your quick response.
if i m going wrong at any place please provide the details else
then provide work around for expected output.

please, replay as soon as possible

Thanks & regards.

Hi Nikhil,

Thanks for your inquiry.

Your code seems good to me and if you produce a PDF document using the same code you will observe that the list at second level is coming out as expected. Secondly, Microsoft Word 2010 also interprets the DOC output generated by Aspose.Words correctly. It appears the problem occurs only when the DOC is viewed with Microsoft Word 2007. To address this problem, I have logged an issue in our bug tracking system as WORDSNET-7856. Your request has also been linked to this issue and you will be notified as soon as it is resolved.

Sorry for the inconvenience.

Best regards,

The issues you have found earlier (filed as WORDSNET-7856) have been fixed in this .NET update and this Java update.


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