Does WDG work with templates .docm?

Apr 29, 2013 at 8:23 PM
Edited Apr 30, 2013 at 4:57 PM
I have defined a macro to remove placeholders after template proccessing (on file openning event).

But... the Word 2007 does not open the resulting file, it looks like corrupted.

Are there any restrictions on using macros?
May 6, 2013 at 4:32 PM
Replying myself:
Since WDG can read macro enabled documents, and it generates "non macro-enable", I achieve the expected result just by changing the result document to macro-enabled and everything just worked fine.
byte[] bytes = sampleGenericDocumentGeneratorUsingXml.GenerateDocument();
            if (templateName.ToLower().EndsWith(".docm"))
                using (MemoryStream mem = new MemoryStream())
                    mem.Write(bytes, 0, (int)bytes.Length);
                    using (WordprocessingDocument document = WordprocessingDocument.Open(mem, true))
                    bytes = mem.ToArray();
May 6, 2013 at 4:36 PM
The best thing, however, would be WDG (Word Doc Generator) produces output based on template type (.DOCX or .DOCM) and not assume the resulting will always be .DOCX. In this case, the above code would be removed.

That´s my sugestion for while.

Best regards,