Support macro manipulation planned?

Hi,

As far as I know, Aspose.Words currently doesn’t support manipulating macros in word files.

Is it planned to be supported in the future?

Hi

Thank you for your interest in Aspose.Words. Yes, you are right, at the moment you can only remove macros from document using Aspose.Words.

What kind of manipulation would you like to perform on macros in documents? Insertion or changing macros requires checking them to make sure that macro is valid. So VBA compiler/interpreter is required.

Best regards.

Hi,

I basically need to add a new macro (or replace it if it exists already). I don’t need the macro to be verified, I would make sure its code is valid.

Is this achievable with Aspose (or maybe some other component that you can recommend)?

I would preferably do the macro insertion server-side, but I don’t discard doing it client-side (via javascript or anything else).

Hi

Thank you for additional information. As I already mentioned, unfortunately, you cannot edit existing or add new macros using Aspose.Words.

The only way to work with macros is using templates, which already contains predefined macros. During processing these macros will be preserved.

Best regards.

Hi again,

I’ve just figured out that I can attach a template file to a document. After doing that, the macros contained in the template are available from the document.

Is it possible to programmatically attach a template file with Aspose.Words?

Just to clarify, attaching a template file is done in the following way (Word 2007):

- Click the “Office” button, then “Word options”

- Click “Add-ins”, then on the bottom choose “Templates” and click “Go”

- Edit the contents of the “Document template” textbox and click “Ok”.

In my specific case I need to set the template to a remote file ("http://server/template.dot", for example). I can do that via the Word UI, the question is if I can do it with Aspose.Words.

Hi
Thanks for your request. You can use Document.AttachedTemplate property to specify path to the attached template. Please see the following link for more information:
https://reference.aspose.com/words/net/aspose.words/document/attachedtemplate/
Hope this helps.
Best regards.