Modify active excel/word doc without closing it in openxml

Home Forums Open-Xml-Sdk Modify active excel/word doc without closing it in openxml

This topic contains 1 reply, has 2 voices, and was last updated by  Eric White 8 years ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3316

    espfome
    Participant

    Hello, I have created an add-in which allows me to edit word/excel documents with openxml. However, the solution I have right now basically does this:
    -Save the current document
    -Note the file location of the current document
    -Close the current document
    -Edit the file
    -Reopen the document based on the file location variable.

    This works perfectly fine. However, this is a bit confusing for users (where did my document go?) and also does not allow me to make quick updates with events in the application as it will close their document while they are in the middle of working on it.

    Is there a way to edit the active excel/word document without closing it? I know that you can do this using the interop interface but I strongly prefer openxml as it is much more powerful and flexible for my needs.

    Thank you in advance for your answer!

    #3333

    Eric White
    Keymaster

    Hi,

    With Word, you can use the approach detailed in the following MSDN article:

    Increasing Word Automation Performance for Large Amounts of Data by Using Open XML SDK

    However, there is no equivalent functionality in Excel so that from within an add-in, you can get the Open XML markup, modify, and then put it back, as you can do in Word.

    -Eric

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.