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

Free Support Forum - aspose.com

Error! Not a valid filename is raised from update field of INCLUDETEXT

Hi Support,

It seems like update fields function can not work well for field INCLUDETEXT. In my below test, I found a very interesting thing. If the included document is located in C:\Documents and Settings\Administrator\Local Settings\Temp\ folder, the update fields function will get the error of “Error! Not a valid filename”. But if the included document is located in c:, it can work well. Please reference the below test code. Please confirm it is a defect.

BTW, Aspose I used is 10.4.0.
Thanks.

Document doc = new Document();
DocumentBuilder builder = new DocumentBuilder(doc);
builder.writeln(“The first wrong:”);
String fieldCode = “INCLUDETEXT “C:\\Documents and Settings\\Administrator\\Local Settings\\Temp\\included.doc” \* MERGEFORMAT”;
builder.insertField(fieldCode,"");
builder.writeln();
builder.writeln(“The second wrong:”);
String fieldCode2 = “INCLUDETEXT “C:\\DOCUME~1\\ADMINI~1\\LOCALS~1\\Temp\\included.doc” \* MERGEFORMAT”;
builder.insertField(fieldCode2,"");
builder.writeln();
builder.writeln(“The correct:”);
String fieldCode3 = “INCLUDETEXT “C:\\included.doc” \* MERGEFORMAT”;
builder.insertField(fieldCode3,"");
doc.save(“c:\test-out.doc”);
doc.updateFields();
doc.save(“c:\test-out.pdf”);

Hello

Thank you for reporting this problem to us. I managed to reproduce the problem on my side. Your request has been linked to the appropriate issue. You will be notified as soon as it is fixed.

Best regards,

The issues you have found earlier (filed as WORDSJAVA-418) have been fixed in this .NET update and this Java update.