Free Support Forum - aspose.com

Getting list-style Font-family wrongly

Hi,

I am using Aspose Words for java.I am taking the font-family for list style using the following code,

((Paragraph)this.node).getListFormat().getListLevel().getFont().getName();

I am getting as Times New Roman,but the original font-family is calibri.I attached the document.


Hi

Thanks for your request. If you take a look at your document, you will see that font for the list label is not specified (See the attached screenshot). That is why Aspose.Words returns a default font.

Usually, Ms Word uses paragraph break font for list labels:

System.out.println(doc.getFirstSection().getBody().getFirstParagraph().getParagraphBreakFont().getName());

Best regards,

Hi,

Thanks for your reply. I am getting calibri for the bullet list also, My code looks like,

ParagraphFormat para = ((Paragraph)this.node).getParagraphFormat();
if(para.isListItem())
{
System.out.println(“Font-family =”+((Paragraph)this.node).getParagraphBreakFont().getName());
}

Expected is Symbol(which shows in MSWord).How to take the list label styles like bold,color,font-size etc…

Hi

Thank you for additional information. If you need to get a font of a list label you can use ListLabel.Font property. Please follow the link for more information:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/listlabel.html#Font

Here is code example:

Document doc = new Document("C:\\Temp\\list_font.doc");

System.out.println(doc.getFirstSection().getBody().getFirstParagraph().getListLabel().getFont().getName());

Hope this helps.

Best regards,

Hi,

I am using Aspose Words for java. I have created a list with foregroundColor as red and bold.How to take the color property from list style(bullet).

ParagraphFormat para = ((Paragraph)this.node).getParagraphFormat();
if(para.isListItem())
{
System.out.println(((Paragraph)this.node).getListFormat().getListLevel().getFont().getBold());
System.out.println(((Paragraph)this.node).getListFormat().getListLevel().getFont().getColor());
}

I am getting false and color as r=0,g=0,b=0…How to take such properties?

Hi

Thanks for your request. Theoretically, the following code should give the desired result.

Document doc = new Document("C:\\Temp\\list.odt");

System.out.println(doc.getFirstSection().getBody().getFirstParagraph().getListLabel().getFont().getName());

System.out.println(doc.getFirstSection().getBody().getFirstParagraph().getListLabel().getFont().getBold());

System.out.println(doc.getFirstSection().getBody().getFirstParagraph().getListLabel().getFont().getColor());

However with this particular document formatting of list label is lost upon loading. I logged this problem in our defect database. We will let you know once it is resolved.

Best regards,

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


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