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

Free Support Forum - aspose.com

Incorrect Font properties

Hi,
can you chek this problem please…

methods Font.getColor(), Font.getUnderline() and Font.getStrikeTrough() returns wrong values, in attached Word Document “run” have a color, underline and strikeTrough but methods returns:

“java.awt.Color[r=0,g=0,b=0]
0
false”, respectively.

You can chek this problem whit this example:

public class FontTest {
@Test
public void fontTest() throws Exception {
String path = “d:/”;
Document document = new Document(path + “Biomarker.docx”);
NodeList runs = document.selectNodes("//Run");
Run run = (Run) runs.get(28);
Font font = run.getFont();
System.out.println(run.getText());
System.out.println(font.getColor());
System.out.println(font.getUnderline());
System.out.println(font.getStrikeThrough());
}
}

Thanks,
Bojan

Hi Bojan,

Thanks for your request. Actually text in your document does not have color, underline and strike through. This is a way MS Word highlights insert and delete revisions. Please try to check isDeleteRevision and isInsertRevision properties of Run:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/run.html#IsDeleteRevision

You can accept revisions in document using AcceptAllRevisions method:

http://www.aspose.com/documentation/java-components/aspose.words-for-java/com/aspose/words/document.html#acceptAllRevisions()

Best regards,