REF fields will be treated such as mail merge fields

Hi

After migrating Aspose.Words in Java 15.3.0 to 15.8.0 we recognized following behaviour

  • Aspose.Words 15.3.0 – REF fields are left in the document correctly.

  • Aspose.Words 15.8.0 – REF fields will be treated such as mail merge fields.

I think the new behaviour in Aspose.Words 15.8.0 is a bug, because the REF fields will be removed after saving the document. Can anybody help on this issue?

Regards,
Gökhan Demirkiyik

Hi Peter,


Thanks for your inquiry. To ensure a timely and accurate response, please attach the following resources here for testing:

  • Your sample input Word document
  • Aspose.Words 15.12.0 generated output document which shows the undesired behavior
  • Aspose.Words 15.3.0 generated output document which shows the correct behavior
  • Please create a standalone Java application (source code without compilation errors) that helps us reproduce your current problem on our end and attach it here for testing.

As soon as you get these pieces of information ready, we’ll start further investigation into your scenario and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip them and Click ‘Reply’ button that will bring you to the ‘reply page’ and there at the bottom you can include any attachments with that post by clicking the ‘Add/Update’ button.

Best regards,

Hello Awais



I attached a zip archive. I created a working sample built as maven project. It can be imported with Eclipse IDE. Please read the readme.txt file, because it contains all the required information to reproduce the issue.



Regards,

Gökhan Demirkiyik

Hi Gökhan,


Thanks for your inquiry. We tested the scenario and have managed to reproduce the same problem on our end. For the sake of correction, we have logged this problem in our issue tracking system as WORDSJAVA-1275. Our product 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,

Hi again

Thanks for your effort.

Are there any update for this issue. Where can I track the progress?

Thanks & Regards
Gökhan Demirkiyik

Hi Gökhan,

Thanks for your inquiry. Unfortunately, there is no direct way you can use to track issues by yourself. But, you are welcome to ask your issue status via forum threads. We will verify the status from our internal issue tracking system and reply you back.

Unfortunately, your issue (WORDSJAVA-1275) is not resolved yet. This issue is currently pending for analysis and is in the queue. We will inform you via this thread as soon as this issue is resolved. We apologize for any inconvenience.

Best regards,
Hi Gökhan,

Thanks for your inquiry. Regarding WORDSJAVA-1275, our product team has completed the work on your issue and has come to a conclusion that this issue and the undesired behavior you're observing is actually not a bug. So, we will close this issue as 'Not a Bug'.

This is MS Word's behavior. We slightly simplified your scenario as follows:

Document doc = new Document(getMyDir() + "Buggy.docx");
// process report
doc.getMailMerge().execute(new DataSource());
// cleanup: REF fields and page counters may contain an intermediate state, therefore we need an explicit update on all remaining fields
doc.updateFields();
doc.save(getMyDir() + "out.docx");

static class DataSource implements IMailMergeDataSource
{
private boolean first = true;

public String getTableName()
{
return "";
}

public boolean moveNext()
{
if (first)
{
first = false;
return true;
}
return false;
}

public boolean getValue(String fieldName, Object[] paramArrayOfObject)
{
if ("merge_field".equals(fieldName))
{
paramArrayOfObject[0] = "REPLACED MERGE FIELD";
return true;
}
if ("my_ref".equals(fieldName))
{
paramArrayOfObject[0] = "REPLACED REF FIELD";
return true;
}

//paramArrayOfObject[0] = null;
return false;
}

public IMailMergeDataSource getChildDataSource(String tableName)
{
return null;
}
}

Note that REF field in your scenario is not removed, it is just replaced with empty string.

Best regards,

Hello Awais



Thank you for your reply but we regret to say that your reply does not answer the issue. Your example code proves the issue that REF fields are processed during mailmerge, trigger data source query and get removed (or replaced as you call it). Otherwise, you wouldn’t be able to catch it by ‘if (“my_ref”.equals(fieldName))’. A REF field is a document internal cross reference and not meant to be evaluated from a data source.



We ask you to answer the following questions:



1. Why are REF fields processed by Document.getMailMerge().execute() in Aspose.Words 15.8.0? This is obviously a bug, as it triggers an IMailMergeDataSource query which results in removal of the REF field. In Aspose.Words 15.3.0, this does not happen.



2. Why do you call it MS Word behaviour when the issue occurs in Aspose.Words 15.8.0 but not in Aspose.Words 15.3.0? What exactly is this different MS Word behaviour w.r.t. using the exact same DOCX template file, exact same data source and exact same Word version?



Kind regards,

Daniel

Hi Daniel,

We are in coordination with product team to get answers pertaining to your queries. Soon you will be updated with the required information.

Best regards,

Are there any update for this issue? Currently we are not abe to release our application because of this issue.

Hi,


Thanks for your inquiry and sorry for the delay. Unfortunately, we have not heard back from our product team yet. We will be sure to inform you as soon as we have any updates for you. We apologize for any inconvenience.

Best regards,

Hi Daniel,


Daniel:
Why are REF fields processed by Document.getMailMerge().execute() in Aspose.Words 15.8.0?
This is MS Word’s behavior i.e. MS Word treats REF field as MERGEFIELD field, if data source contains column with referenced bookmark name.

Daniel:
This is obviously a bug, as it triggers an IMailMergeDataSource query which results in removal of the REF field.
It triggers an IMailMergeDataSource query to detect whether data source contains column with referenced bookmark name or not.

Daniel:
In Aspose.Words 15.3.0, this does not happen.
Yes, We had implemented this behavior later.

Daniel:
Why do you call it MS Word behaviour when the issue occurs in Aspose.Words 15.8.0 but not in Aspose.Words 15.3.0?
Because this is how MS Word works, but we did not support this in 15.3.0.

Hope, this helps.

Best regards,