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

Free Support Forum - aspose.com

Incorrect font name in XE field

Hi,


In the attached document, there are some XE fields. For every single one of them, I get incorrect font name: Times New Roman instead of Calibri.

Here’s the code I use:

String documentPath = “index-marker-test.docx”;

InputStream inputStream = new FileInputStream(documentPath);

Document document = new Document(inputStream);

inputStream.close();

NodeCollection fields = document.getChildNodes(NodeType.FIELD_START, true);

/*
* { XE “Empire” }
/
FieldStart field = (FieldStart) fields.get(0);

Run run = (Run) field.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

/
* { XE “Kingdom” \i }
/
System.out.println();

field = (FieldStart) fields.get(1);

run = (Run) field.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

/
* { XE “India” \t “See this” \b }
/
System.out.println();
field = (FieldStart) fields.get(2);

run = (Run) field.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());
/
* { XE “Airship” \t “Behold” }
/
System.out.println();
field = (FieldStart) fields.get(3);

run = (Run) field.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

/
* { XE "Name with “sign:Airship” }
*/
System.out.println();
field = (FieldStart) fields.get(4);

run = (Run) field.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());

run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());
run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());
run = (Run) run.getNextSibling();
System.out.println(run.getText() + ": " + run.getFont().getName());
}

Here’s the output:

XE “: Times New Roman
Empire: Times New Roman
” : Times New Roman

XE “: Times New Roman
Kingdom: Times New Roman
” : Times New Roman
i: Times New Roman

XE “: Times New Roman
India: Times New Roman
” \t “: Times New Roman
See this: Times New Roman
” \b : Times New Roman

XE “: Times New Roman
Airship: Times New Roman
” \t “: Times New Roman
Behold: Times New Roman

XE “: Times New Roman
Name with : Times New Roman
: Times New Roman
”: Times New Roman
sign:Airship: Times New Roman
” : Times New Roman

I’m using Aspose.Words 16.8.0.

Can you check this?

Thanks,
Zeljko

Hi Zeljko,


Thanks for your inquiry.

While using the latest version of Aspose.Words i.e. 16.10.0, we managed to reproduce this issue on our end. We have logged this issue in our bug tracking system. The ID of this issue is WORDSNET-14302. Your request has also been linked to the appropriate 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-14302) have been fixed in this Aspose.Words for .NET 17.1.0 update and this Aspose.Words for Java 17.1.0 update.


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

The issues you have found earlier (filed as ) have been fixed in this update. This message was posted using BugNotificationTool from Downloads module by MuzammilKhan