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

Free Support Forum - aspose.com

Problem in Creating Second List level

Hi Aspose team,

I am creating a list like,

1)Section

1.1) Clause

some text in clause

But my output is coming like :

1)Section

Clause

some text in clause

I am using aspose 4.0.2.0 and word-2007

My code snippet is:

public OutputStream buildDocument(List contractSections)throws Exception{

builder.getListFormat().applyNumberDefault();

for(ContractSectionGeneric sectionInDoc:contractSections){

builder.getListFormat().listOutdent();

//builder.getListFormat().getListLevel().setNumberStyle(NumberStyle.ARABIC);

//builder.getListFormat().getListLevel().setNumberFormat("\u0000)");

builder.getListFormat().setList(doc.getLists().get(0));

builder.getListFormat().getList().getListLevels().get(0).setNumberStyle(NumberStyle.ARABIC);

builder.getListFormat().getList().getListLevels().get(0).setNumberFormat("\u0000)");

builder.startBookmark("section_"+sectionInDoc.getId());

builder.setBold(true);

builder.writeln(sectionInDoc.getSectionName());

builder.setBold(false);

List sectionClauses = sectionInDoc.getClauses();

if(sectionClauses != null)

{

for(ContractSectionClausesGeneric clauseInSection:sectionClauses){

builder.getListFormat().listIndent();

//builder.getListFormat().getListLevel().setNumberStyle(NumberStyle.ARABIC);

//builder.getListFormat().getListLevel().setNumberFormat("\u0000.\u0001)");

builder.getListFormat().setList(doc.getLists().get(0));

/*

* Comment out next 2 lines bcz these not working in word 2007

*/

builder.getListFormat().getList().getListLevels().get(1).setNumberStyle(NumberStyle.ARABIC);

builder.getListFormat().getList().getListLevels().get(1).setNumberFormat("\u0000.\u0001)");

builder.startBookmark("clause_"+clauseInSection.getId());

String finalHTMLText = ""+clauseInSection.getClauseTitle()+"

"+clauseInSection.getClauseText()+"

";

builder.insertHtml(finalHTMLText);

//builder.insertBreak(BreakType.LINE_BREAK);

builder.endBookmark("clause_"+clauseInSection.getId());

//builder.insertBreak(BreakType.PARAGRAPH_BREAK);

}

}

builder.endBookmark("section_"+sectionInDoc.getId());

//builder.insertBreak(BreakType.PARAGRAPH_BREAK);

}

setDocProperties(doc);

doc.setTrackRevisions(true);

doc.protect(ProtectionType.ALLOW_ONLY_REVISIONS, "1234");

OutputStream outStream = new ByteArrayOutputStream();

doc.save(outStream,SaveFormat.DOC);

return outStream;

}

I will be highly greatfull for you quick response

Thank you!!!

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Please try using the following code:

Document doc = new Document();

DocumentBuilder builder = new DocumentBuilder(doc);

// Create a list.

List list = doc.getLists().add(ListTemplate.NUMBER_ARABIC_DOT);

// Modify list if required.

list.getListLevels().get(0).setNumberStyle(NumberStyle.ARABIC);

list.getListLevels().get(0).setNumberFormat("\u0000)");

list.getListLevels().get(0).setNumberPosition(0);

list.getListLevels().get(0).setTextPosition(20);

list.getListLevels().get(0).setTabPosition(20);

list.getListLevels().get(1).setNumberStyle(NumberStyle.ARABIC);

list.getListLevels().get(1).setNumberFormat("\u0000.\u0001)");

list.getListLevels().get(1).setNumberPosition(20);

list.getListLevels().get(1).setTextPosition(50);

list.getListLevels().get(1).setTabPosition(50);

// Create few items.

builder.getListFormat().setList(list);

builder.writeln("This is the first level");

builder.getListFormat().listIndent();

builder.writeln("This is the second level");

builder.getListFormat().listOutdent();

builder.writeln("This is the first level again");

// Stop buildign the list.

builder.getListFormat().removeNumbers();

doc.save("C:\\Temp\\out.doc");

Please see the following link for more information:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/listlevel.html

Best regards,

Thanks for Replying ...Aspose Team!!

I think you did not get my problem. My problem is that I am not getting second level list.

I execute your code on my machine and it just shift the text towards right but did not give second level list i.e. 1.1)

I want 1.1) to be displayed on second level list

This problem occurs in word-2007. But when I open same file in word-2003 it displays second level list.

Please guide me that how can i resolve this problem

I am attaching an Image for your reference.

Thanks!!!

If not what is your plan to solve this defect??

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. I cannot reproduce the problem on my side using the latest version of Aspose.Words for Java (4.0.2). I use the code from my previous post.

Please see the attached screenshot and the attached documents.

Best regards,

For me the issue was resolved with updating MS Word 2007 with latest
patch.

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.