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

Free Support Forum - aspose.com

Creating macros dynamically

Hi,

I am using Aspose.Words 6.1.0 for .NET with Temporary Licence. I created a document using Document class and added some contents to document using DocumentBuilder class and finally i added Table of Contents field at begining of document.

I need to update the Table of Contents on opening the document, so i would like to write a macro for that, how should i create a macro dynamically and how should i attach that macro to object of Document class...

Regards,

SrinuDhulipalla

Hi<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Unfortunately, Aspose.Words still does not update TOC and IF fields conditions. We are going to support IF and TOC fields evaluation soon. There is an issue #126 in our defect database regarding this. Hopefully, this feature will be supported in Q2-Q3 2009.

As a workaround you can update fields inside the document manually (ctrl+A and F9) or using macro. See the following link to learn more.

http://support.microsoft.com/kb/832897

You cannot create macros using Aspose.Words. You can create macro in the template document, and use this template for document generating.

Best regards.

I wasn't able to find a quick answer on how to create a macro that will update the TOC onload.

Could ether of you give me the steps needed?

Edit: ofcourse I figured it out right after

If ActiveDocument.TablesOfContents.Count = 1 Then _
ActiveDocument.TablesOfContents(1).Update

should be added to the AutoOpen() macro as described here:

http://support.microsoft.com/kb/832897

Hi

<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

Thanks for your request. Yes, you should add AutoOpen macro in your template. You should do this manually in MS Word. Unfortunately, there is no way to add macro programmatically. So you should just follow the steps described here:

http://support.microsoft.com/kb/832897

Best regards.

The issues you have found earlier (filed as 126) have been fixed in this update.


This message was posted using Notification2Forum from Downloads module by aspose.notifier.
(46)

The issues you have found earlier (filed as 10380) have been fixed in this update.