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

Free Support Forum - aspose.com

Issues when saving a doc with Page fields as docx with 22.05

Hello,

we noticed and issue that word would prompt a dialog that a document contains fields which reference another file:

I analyzed that this is due to our header file in doc format, which we include into the documents. After some further analysis I discovered the cause is the PAGE and NUMPAGE fields in the header

and saving it to docx.

Following snippet is enough to reproduce:

static void Main(string[] args)
{
    var lic = new License();
    lic.SetLicense(@"S:\Aspose.Total.Net.lic");

    var doc = new Document(@"S:\tmp\header.doc");
    doc.Save(@"S:\tmp\aspose.docx");
}

The error only occurs with the new version 22.05. The older versions never had those issues and also in 22.04 it still works good and word does not prompt that message when opening the rendered document.

I attached you the header.doc testfile and two outputs generated with Aspose 22.04 and Aspose 22.05 for reference which show the problem.

Thanks for your help,
Daniel

files.zip (69.6 KB)

@Serraniel This occurs due the changes made per WORDSNET-16037. In earlier version Field.IsDirty was always set to false. In the current version, this property is set to true, most likely because they are set as dirty in the original document. To get the old behavior with the latest version you should reset Field.IsDirty property to false:

Document doc = new Document("in.docx");

foreach (Field f in doc.Range.Fields)
    f.IsDirty = false;

doc.Save("out.docx");

I will also consult with the developer, who worked on this issue and provide you more information.