Tech Tip Using Aspose.Words to Guard Against Macro Viruses It is well known that macros stored in Microsoft Word documents might be malicious. They may contain macro viruses or other destructive code. See Frequently Asked Questions About Word Macro Viruses in the Microsoft Knowledge Base for more information. Aspose.Words is a Word document processing component that is fully aware of macros (the VBA project) in the following ways: - Aspose.Words is completely safe against macro viruses because it never executes them (simply because it has no means to execute macros).
- By default, Aspose.Words fully preserves existing macros in Words documents, including their digital signatures.
- Aspose.Words allows one to quickly remove all macros from a document to ensure it is free from any harmful code.
To remove all macros from a Word document using Aspose.Words, call the Document.RemoveMacros method: [C#] Document doc = new Document(“DangerousDocument.doc”); doc.RemoveMacros(); doc.Save(“PureDocument.doc”); [VB .NET] Dim doc As Document = New Document(“DangerousDocument.doc”) doc.RemoveMacros() doc.Save(“PureDocument.doc”) [Java] Document doc = new Document(“DangerousDocument.doc”); doc.removeMacros(); doc.save(“PureDocument.doc”); |