none
How can I attach an XLSX to the Word document that is open? RRS feed

Answers

  • Hi Dave

    I'm not sure I understand the details of what you ask...

    When you insert a chart in the Word UI it automatically creates an Excel workbook that's embedded in the file. This workbook is only visible when the chart is being created/edited, otherwise not. Do you mean you want to suppress this window?

    There is no way to create the workbook behind the chart "silently" from within the Word UI - this has been an FAQ since the current charting engine was introduced. The only work-around is the one you mention, creating the chart and workbook in the closed file by leveraging the Word Open XML file format.

    You could try a couple of things: Create it as an Excel file, using the OOXML file format, then insert that into the open Word document (InlineShapes.AddOLEObject). Temporarily close the Word document, run the OOXML code, re-open the document... Possibly use the Window API to "freeze" the screen so that the user doesn't notice the document closes and re-opens...


    Cindy Meister, Office Developer/Word MVP, <a href="http://blogs.msmvps.com/wordmeister"> my blog</a>

    • Marked as answer by DavidThi808 Saturday, November 24, 2018 8:00 PM
    Wednesday, November 21, 2018 11:24 AM
    Moderator

All replies

  • Hi Dave,

    >> I want to create an XLSX that is placed in the DOCX that the chart uses for its data.

    >> Not an embedded object that is displayed, just a data filed used solely by the chart that is a file in the docx.

    Unfortunately, I only found a way to modify the embedded Excel in a Word document supplying chart data.

    For more information, please review the following link:

    How to modify the imbedded Excel in a Word document supplying chart data

    Hopefully it helps you.

    Best Regards,

    Yuki


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Tuesday, November 20, 2018 6:00 AM
    Moderator
  • Hi Yuki;

    Your link is how to access the XLSX file, not how to access the Word document via the COM API from the AddIn.

    How from my AddIn can I add the backing XLSX to a chart I insert into the active document open in Word?

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Tuesday, November 20, 2018 2:05 PM
  • Hi Dave

    I'm not sure I understand the details of what you ask...

    When you insert a chart in the Word UI it automatically creates an Excel workbook that's embedded in the file. This workbook is only visible when the chart is being created/edited, otherwise not. Do you mean you want to suppress this window?

    There is no way to create the workbook behind the chart "silently" from within the Word UI - this has been an FAQ since the current charting engine was introduced. The only work-around is the one you mention, creating the chart and workbook in the closed file by leveraging the Word Open XML file format.

    You could try a couple of things: Create it as an Excel file, using the OOXML file format, then insert that into the open Word document (InlineShapes.AddOLEObject). Temporarily close the Word document, run the OOXML code, re-open the document... Possibly use the Window API to "freeze" the screen so that the user doesn't notice the document closes and re-opens...


    Cindy Meister, Office Developer/Word MVP, <a href="http://blogs.msmvps.com/wordmeister"> my blog</a>

    • Marked as answer by DavidThi808 Saturday, November 24, 2018 8:00 PM
    Wednesday, November 21, 2018 11:24 AM
    Moderator
  • Hi;

    We presently create a chart and populate it with literal values. I guess we'll stay with that.

    thanks - dave


    What we did for the last 6 months - Made the world's coolest reporting & docgen system even more amazing

    Saturday, November 24, 2018 8:01 PM