How can I get fldData by Aspose.Word

Hello Team.

I am using Aspose.Word to parse word document. I need to extract citation information from EN_CITE ADDIN fields.
Here is my code example:

public int visitFieldStart(FieldStart fieldStart) throws Exception {
  Field field = fieldStart.getField();
  if (field.getType()==FieldType.FIELD_ADDIN 
     && field.getFieldCode().startWith("ADDIN EN.CITE <EndNote>")) {
      String xmlText = field.getFieldCode().substring(14);
      System.out.println(xmlText);
  }
  return 0;
}

If a citation is a simple one such as [1], the code works correctly.
But if a citation contains a few references, field.getFieldCode does not contain any xml text.

I have checked the word document and found out that it stores ADDIN information in two ways:

  1. for simple citation inside w:instrText
  2. for citation with a few references inside w:fldData encoded by BASE64.
    <w:fldChar w:fldCharType=“begin”>
    <w:fldData xml:space=“preserve”>PEVuZE5vdGU+PENpdGU+PEF1dGhvcj5MYW50ejwvQXV0aG9yPjxZZWFyPjE5

I was wondering if there is any way to extract this encoded string by Aspose.Word?

Thank you in advance,
Svetlana

@skorpusova Could you please attach your document here for testing? we will check the issue and provide you more information.

Here is the example of document with two citations: [1-4] and [5] manuscript.docx (28.4 KB)

@skorpusova What you are asking about is accessing field data which is associated with the field. This data is read and preserved by Aspose.Words, but unfortunately, there is no public API to get this data. I have create a feature request WORDSNET-23198.
Could you please also let us know do you need only read access to these data? Or you also need to set data which is associated with the field.

@alexey.noskov, I need only read access.
Thank you for your information. I could find this field.

@skorpusova Thank you for additional information. We will let you know once the issue is resolved.

The issues you have found earlier (filed as WORDSNET-23198) have been fixed in this Aspose.Words for Java 22.2 update.

Thanks a lot

1 Like