none
.docm RRS feed

  • Question

  • Is it possible to call a macro by using the Open XML SDK?
    Next convert .docm to .docx and save. 
    If so, please help example

    Thanks
    Thursday, January 21, 2010 1:39 PM

All replies

  • Thanks for your question, FoEn!

    Of course that is possible. To do this, you could follow the steps:
    1. Use the SDK to open the .docm file
    2. Remove the the macro parts, such as /word/vbaProject.bin
    3. And then change the document type
    4. Do not forget to change the file extension to be .docx

                using (var doc = WordprocessingDocument.Open("textfile.docm", true))
                {
                    // Remove the vba part if there is ...

                    // Change the document type.
                    doc.ChangeDocumentType(DocumentFormat.OpenXml.WordprocessingDocumentType.Document);
                }

    Monday, January 25, 2010 3:02 AM
    Moderator