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

Free Support Forum - aspose.com

Custom Menu GONE after saving file

We have to figure this out before we adopt Aspose as a solution…we are using the Eval copy so I only have a few days to say yes or no on Aspose… Thanks in advance for any help…

I have a Word Doc with a custom menu I added. The custom menu invokes Macros we have written which reside in the word document as well.

As a test…using Aspose I open the document and then do a save as to another document.
Then I open the new document up in MS Word…
PROBLEM: The custom menu does not show in the new file on my computer.
NOTE 1: The same test on another developers computer works fine…perhaps it is a Word setting?
NOTE: The macro’s do appear to be in the new file…

We are both using Word 2003 Pro and Aspose latest version as of 9/10/2008

Any ideas? Thoughts?





Hi

Thanks for your inquiry. Could you please attach your document for testing? I will investigate this issue and provide you more information.

Best regards.

Thanks Alexey…

I had another developer test this on his machine and the menu also did not show up…
We are all running SP3 on Office 2003 Pro

New information as well:
We are loading a *.dot (template file) and inserting word xml from another file…

I am not allowed to send the .dot file at this time…

I can say this about it though:
File 1: is a *.dot file (not the Normal.dot file…we are using a modified version of Normal.dot)
File 1: has a custom menu that you create which runs macros.
File 1: has macros which run upon opening the document which disable certain word menus and menu items.

Finally, you do not have to perform a merge of any kind…just open that file and do a Document.Save.
The macro’s appear to have copied over…the menu does not…


Do you need more than that?


An aha moment…

The problem appears to be that we are using a different *.dot file other than Normal.dot on the two machines where the menu disappears…

I tried the Document.AttachedTemplate property to point to the path of our *.dot file but no luck…


Further, on the machine where it was apparently working…he had saved our custom template AS normal.dot

We deleted his normal.dot and opened Word (which creates a new Normal.dot).

Then tried the test again and he had the same results as us…

~ Clint

Ok, we theorized that perhaps Aspose was having an issue with the *.dot file. That issue being that the Template Path was not getting set when we saved it to a *.doc file. So we tried using the AttachedTemplate property…with no success.

So we saved our *.dot file to a *.doc file using MS Word.
Note: Word automatically sets the Template path to the *.dot file when it gets saved to the *.doc file.

Then we ran the same test and the menu DID finally show up… :slight_smile:

Question: Is there a way to use the *.dot file like we want without having to save it to a *.doc file?
The problem is setting the Attached Template path in the resulting file…is there a way to do that?
The AttachedTemplate property did not appear to work…


After reading my post I am thinking that it might be hard to follow…

We use a *.dot file to store our macros and custom menus. We send this file from the server to our client. The client then uses that *.dot file to create a new Word doc (save as) using Word’s Interops.

Note: When you save a *.dot file to a *.doc file, the resulting *.doc file has it’s Template Path set to the path of the *.dot file (which means that the resulting *.doc file inherits the macros and custom menus.)

This is the desired behavior we would like to see from Aspose:
1. Open the *.dot file into Aspose object
2. Insert content into the *.dot file in Aspose object memory
3. have the Aspose object save the modified version of the *.dot file to a *.doc file.
Issue: The saved file’s Template Path must point to the *.dot file’s path.
AttachedTemplate property doesn’t seem to work for this…is it intended for that purpose? If so, is there an example?

Can we do this with Aspose?

Thanks so much for your quick responses.

~ Clint
Texas

Hi

Thank you for additional information. You should specify explicit path to template if you would like to attach it to document. See the following code:

//Create new Document

Document doc = new Document();

//Attach template

doc.AttachedTemplate = @"C:\Documents and Settings\Administrator\Application Data\Microsoft\Templates\mytemplate.dot";

//Save document

doc.Save(@"Test076\out.doc");

This works as expected. The output document refers to “mytemplate” and inherits the macros from this template.

Also you can just open .dot file as normal document using Aspose.Words. In this case document will be attached to the Normal.dot template but should preserves macros from original template.

So in your case I think you should use AttachedTemplate.

Best regards.

Hi Alexey,

Thanks for the quick reply again. This did work as you described.
It is not ideal for us but we can make this work.

Thank you for your help.

~ Clint