none
Readout datagrid in PowerPoint 2010 and insert datas in new PowerPoint slide RRS feed

  • Question

  • Hello,   I have a performance problem with my application accessed on an active PowerPoint presentation (2010 version). Datas should readout of a datagrid and automatically entered to a PowerPoint slide which has to be created. Each entry of the DataGrid is written in a separate text box. It is this process that takes a long time. Does anyone knows technology / solution that can make the program much more quicker. Program code is written in C #.

    List<Microsoft.Office.Interop.PowerPoint.Shape> ResponsibleTxtbox= new List<Microsoft.Office.Interop.PowerPoint.Shape>();

    ResponsibleTxtbox.Add(slide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, posLeft, posTop, 0, 0));

                        ResponsibleTxtbox[j].TextFrame2.WordWrap = MsoTriState.msoFalse;

                        ResponsibleTxtbox[j].TextFrame2.TextRange.Font.Size = mFontSize;

                        ResponsibleTxtbox[j].TextFrame2.TextRange.Font.Name = mFontName;

                        ResponsibleTxtbox[j].Tags.Add("TxtBoxType", "RespTxtBox" + j.ToString());

    ResponsibleTxtbox[j].TextFrame2.TextRange.Text = responsiblesNames[j];

     

    Thx in advanced

    Thursday, June 18, 2015 2:50 PM

All replies

  • Hi skTA,

    >> Readout datagrid in PowerPoint 2010 and insert datas in new PowerPoint slide

    What do you mean by "Readout datagrid in PowerPoint 2010"? Did the datagrid store in PowerPoint 2010?

    >> I have a performance problem with my application accessed on an active PowerPoint presentation (2010 version).

    What is your application? Did you find the specific operation make your application slow, read the data or insert the data? Based on your code, it seems that you insert TextBox in a loop. Could you share us how much data or TextBox you insert to PowerPoint 2010. It would be helpful if you could share us which code cause this performance issue.

    What is the type of your TextBox, from insert table or from developer to insert a TextBox control?

    If you want to add TextBox from insert table  and set its value with OpenXml, you could use DocumentFormat.OpenXml.Drawing.

    For demo code, I suggest you do as below:

    1. Create an empty PPT document and a PPT document with TextBox;

    2. Use Open XML SDK 2.5 productivity Tool for Microsoft Office

    3. Click the Compare Files, generate the code, and then you could get the code

    For more information about Open XML SDK 2.5 productivity Tool for Microsoft Office, you could refer the link below:

    # Open XML SDK 2.5 for Microsoft Office

    https://www.microsoft.com/en-us/download/details.aspx?id=30425

    Best Regards

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Friday, June 19, 2015 8:33 AM
  • Hi,

    I have a performance problem with my application running on an active PowerPoint presentation (2010 version). There are data from a datagrid be read and be automatically entered to be created PowerPoint slide. Each entry of the DataGrid is written in a separate text box. It is this process takes a long time, you know a technology/solution that can make the program Performant. Program code is written in C#.

    List<Microsoft.Office.Interop.PowerPoint.Shape> ResponsibleTxtbox= new List<Microsoft.Office.Interop.PowerPoint.Shape>(); ResponsibleTxtbox.Add(slide.Shapes.AddTextbox(MsoTextOrientation.msoTextOrientationHorizontal, posLeft, posTop, 0, 0)); ResponsibleTxtbox[j].TextFrame2.WordWrap = MsoTriState.msoFalse; ResponsibleTxtbox[j].TextFrame2.TextRange.Font.Size = mFontSize; ResponsibleTxtbox[j].TextFrame2.TextRange.Font.Name = mFontName; ResponsibleTxtbox[j].Tags.Add("TxtBoxType", "RespTxtBox" + j.ToString()); ResponsibleTxtbox[j].TextFrame2.TextRange.Text = responsiblesNames[j];

    Alternative might OpenXml. Can I edit with OpenXml also open presentations? I have read it would not go. See for help

    Greetings

    • Merged by George123345 Tuesday, June 23, 2015 6:02 AM same topic
    Friday, June 19, 2015 1:36 PM
  • The code you show us is interop, not Open XML SDK. I've replied to your related question concerning PowerPoint Open XML and referred you to the General Office development forum. I'm going to move your question to that forum, as it's more appropriate there for the reasons explained in your other message in the Open XML SDK forum.

    Cindy Meister, VSTO/Word MVP, my blog

    Saturday, June 20, 2015 6:37 PM
    Moderator
  • Thx Edward

    I have a GUI and a datagrid with datas. Now I like to write in an active presentation that datas over Xml to several slides.

    Backgrund where I have seen it was an agenda tool, GUI (addin in pptx), where you can insert datas in a table and out of this table, if you confirm it creates agenda slides with that datas in the current presentation in 1.5-2 sec, very fast. Each row in the table will be a textbox on that new agenda slide. A agenda exist normally of 2 to 10 points, so datas are not to much, one short sentense each point. --> See Pictures

     

    Currently, I did it not use Xml and it takes 4-5 sec, too slow at all. It takes a lot of time to create that text boxes on different agenda slides. Currently the Datagrid (table) is not stored in presentation, just in  the GUI. Now I like to know how it can be done with Xml.

    Greetings




    • Edited by skTA Sunday, June 21, 2015 4:11 PM
    Sunday, June 21, 2015 12:02 PM
  • Hi skTA,

    >> I have a GUI and a datagrid with datas. Now I like to write in an active presentation that datas over Xml to several slides.

    No, ifyou want to write to an active presentation, it is impossible, we could not be able to use OpenXml in an active presentation. OpenXMl is used to operate the pptx file when the pptx file is closed. If you want to interop with pptx file when it is active, you need to use Office automation which you have used.

    In addition, for your original issue, when you use Microsoft.Office.Interop.PowerPoint to work with adding TextBox, it might be slow, it would be helpful if you could share us which code caused your performance issue. For issues about OpenXML, if you still have issue about achieving it with openxml, please keep following the thread below:
    https://social.msdn.microsoft.com/Forums/office/en-US/6cf45a29-5615-4976-9e56-e67f1204e1a1/writing-datas-over-xml-into-an-active-powerpoint-pptx-presentation?forum=oxmlsdk

    Best Regards,

    Edward


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.


    Tuesday, June 23, 2015 9:20 AM