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

Free Support Forum - aspose.com

setLinkedStyle is not working

Hi,


The method setLinkedStyle available for the ListLevel element, when trying to create a list style, is not working.

Please advice.
Thank you.

Hi Cutlac,


Thanks for your inquiry. To ensure a timely and accurate response, it would be great if you please create a standalone runnable simple Java application that helps me reproduce your problem on my end and attach it here for testing. As soon as you get this simple application ready for me, I’ll start investigation into your issue and log an issue in our issue tracking system. Please share what version of Aspose.Words for Java are you currently using? Also, please attach the Aspose.Words output document which shows the undesired behavior here for testing.

Best regards,

I’m using :

Release-Date: 2013.09.30
Implementation-Version: 13.9.0.0

I will try to rephrase the problem. If you create a list style, edit the font properties for each level, only the font for the numbering is changed, and the list text is not changed. How can this be solved ?

Thank you.

Hi Cutlac,


Thanks for your inquiry. Formatting gets applied to only list labels when using ListLevel.Font property; however, please try running the following code to be able to format entire list item:
Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);

List list = doc.getLists().add(ListTemplate.NUMBER_DEFAULT);
Style myStyle = doc.getStyles().add(StyleType.PARAGRAPH, “myStyle”);

builder.writeln(“At level 1”);
builder.writeln(“At level 2”);
builder.writeln(“At level 3”);

doc.getFirstSection().getBody().getParagraphs().get(0).getParagraphFormat().setStyle(myStyle);
doc.getFirstSection().getBody().getParagraphs().get(0).getListFormat().setList(list);
doc.getFirstSection().getBody().getParagraphs().get(0).getListFormat().setListLevelNumber(0);

doc.getFirstSection().getBody().getParagraphs().get(1).getListFormat().setList(list);
doc.getFirstSection().getBody().getParagraphs().get(1).getListFormat().setListLevelNumber(1);

doc.getFirstSection().getBody().getParagraphs().get(2).getListFormat().setList(list);
doc.getFirstSection().getBody().getParagraphs().get(2).getListFormat().setListLevelNumber(2);

list.getListLevels().get(0).setLinkedStyle(myStyle);
list.getListLevels().get(0).getLinkedStyle().getFont().setColor(Color.ORANGE);
list.getListLevels().get(0).getFont().setSize(16);
list.getListLevels().get(0).getFont().setColor(Color.GREEN);

doc.save(“C:\Temp\out.docx”);

I hope, this helps.

Best regards,

My question was about the case when you create a style with the type “List”. Something like :


StyleCollection styleCollection = document.getStyles();
Style listStyle = styleCollection.add(StyleType.LIST, “My List Style”);
ListLevelCollection col = listStyle.getList().getListLevels();
Style paragraphStyle = styleCollection.add(StyleType.PARAGRAPH, “Level 1 Style”);
/
* Font
*/
ListLevel wordListLevel = col.get(0);
Font listFont = wordListLevel.getFont();
Font paragraphFont = paragraphStyle.getFont();
/
* Numbering font - list edit
*/
//numbering font family
listFont.setName(“Calibri”);
/**
* Font - paragraph style edit
*/
//text font family
paragraphFont.setName(“Calibri”);
//THIS DOES NOT WORK
wordListLevel.setLinkedStyle(paragraphStyle);

//save doc…

When I open the document, the “My List Style” has the Calibri font type assigned only over the number from the 1st level. This 1st level hasn’t the “Level 1 Style” assigned - so the setLinkedStyle method does not work, or I’m missing something.

Thank you.

Hi Cutlac,


Thanks for your inquiry. We are working over your query and will get back to you soon.

Best regards,

Hi Cutlac,


Thanks for being patient. The ListLevel.LinkedStyle property should be able to format the “ListLabel” as well as “list paragraph” (complete ListLevel) with specified style. I have logged this problem in out issue tracking system as WORDSNET-9596. Our development team will further look into the details of this problem and we will keep you updated on the status of correction. We apologize for your inconvenience.

Best regards,

Hello,

It seems this bug it still not fixed.
We got the same problem about setLinkedStyle() of ListLevel items.

We really need it to be fixed.
Do you expect to fix it soon ?

Hi Jean,


Thanks for your inquiry. Unfortunately, WORDSNET-9596 is not resolved yet. The implementation of this issue has been postponed till a later date. I have asked the ETA of this issue from our development team and will update you as soon as any estimates are available. We apologize for any inconvenience.

Best regards,

Hi awais,

Thanks for your answer.
We are waiting for the ETA of this issue.

Hi Jean,


Thank you for being patient. Please spare us some time, we will update you as soon as any further information is available.

Best regards,