Hi,
We are using the Aspose.Word in 15.9.0 with a supported license.
We have some Word document that contains Macro and missing template reference.
This produce an error in our own workflow for Word processing, so we try to remove this reference thanks to Aspose.word. But we could not manage to do it.
We see the reference thanks to the Document.getAttachedTemplate() method, which returns the Template path.
For example: C:\Users\foo\Temp\MyTemplate.dot
So we tried to use the Document.setAttachedTemplate("") method to remove it.
The value is removed (in another tool, we check the attachedTemplate value and it is the empty string), but the Template is still visible inside Word (and our workflow process still fail with the new file).
This is the whole code:
{code}
Document document = new Document(fileInputStream);
//it display the real attachedTemplate at the first execution, and empty string at the second execution
System.out.println("’"+document.getAttachedTemplate()+"’");
document.setAttachedTemplate("");
document.save(baos, SaveFormat.DOC);
{code}
Do you know a way to remove the Template and all its references in the document?
I give you in Attachment a zip file containing an word file that contains the problem (there is no content in the document), and screen of the missing template reference.
To see the problem in Word in the provided file:
Open it with Word, and Activate Macro/modification.
Go to Developer Tab and click on Visual Basic.
In the next Window, go to Tools>References, and you will see the term “MISSING: SpellcheckSample.dot” (as in the screenshot).
Regards.