locked
Resize a powerpoint chart using OpenXml SDK2 RRS feed

  • Question

  • Hi,

    I'm new in OpenXml SDK 2. Is there anyway to resize a powerpoint chart in OpenXml SDK2?

    Thanks in Advance,

    Yi

    Friday, February 17, 2012 5:14 PM

Answers

  • Hi Yi,

    Forrest Guo refers you to the following Forum thread where
    there is a code snippet containing the C# code to draw a PowerPoint slide. You
    may follow that as an example

    OpenXML: add image in PowerPoint
    http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/thread/6239fc1e-e0e0-4329-9692-d658c250e9a5

    Specifically in response to your question “Is there any way to
    resize a PowerPoint chart in OpenXml SDK2?” once you have the code to build the
    presentation, slides collection, and one or more slides, within the slide xml
    part find the <p:xfrm.. element and manipulate the attributes of the  <a:off… and the <a:ext elements

    Here are two sets of those elements and attributes from a single slide where the x,
    y, cx, and cy attributes are different, the difference resulting from manually
    resizing a bar chart in Slide1

    Slide1.xml
     <p:xfrm>
         <a:off x:”1752600” y=”2362200”/>
         <a:ext cx=”6096000” cy=”2844800”/>
    </p:xfrm>

    Slide1.xml
     <p:xfrm>
         <a:off x:”1371600” y=”1600200”/>
         <a:ext cx=”6477000” cy=”3606800”/>
    </p:xfrm>

    Please click on the “Mark as Answer” button if this reply
    answers your question.
    Regards,
    Chris Jensen
    Senior Technical Support Lead











    Chris Jensen

    • Proposed as answer by Forrest Guo Wednesday, February 22, 2012 1:18 AM
    • Marked as answer by Forrest Guo Monday, February 27, 2012 2:14 AM
    Tuesday, February 21, 2012 9:23 PM

All replies

  • Hi, Yi

    The question is being investigated, please wait some time.

    Btw, You can look around a relavent task, to insert image to PowerPoint: http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/thread/6239fc1e-e0e0-4329-9692-d658c250e9a5

    Best Regards,


    Forrest Guo | MSDN Community Support | Feedback to us

    Tuesday, February 21, 2012 1:23 PM
  • Hi Yi,

    Forrest Guo refers you to the following Forum thread where
    there is a code snippet containing the C# code to draw a PowerPoint slide. You
    may follow that as an example

    OpenXML: add image in PowerPoint
    http://social.msdn.microsoft.com/Forums/en-US/oxmlsdk/thread/6239fc1e-e0e0-4329-9692-d658c250e9a5

    Specifically in response to your question “Is there any way to
    resize a PowerPoint chart in OpenXml SDK2?” once you have the code to build the
    presentation, slides collection, and one or more slides, within the slide xml
    part find the <p:xfrm.. element and manipulate the attributes of the  <a:off… and the <a:ext elements

    Here are two sets of those elements and attributes from a single slide where the x,
    y, cx, and cy attributes are different, the difference resulting from manually
    resizing a bar chart in Slide1

    Slide1.xml
     <p:xfrm>
         <a:off x:”1752600” y=”2362200”/>
         <a:ext cx=”6096000” cy=”2844800”/>
    </p:xfrm>

    Slide1.xml
     <p:xfrm>
         <a:off x:”1371600” y=”1600200”/>
         <a:ext cx=”6477000” cy=”3606800”/>
    </p:xfrm>

    Please click on the “Mark as Answer” button if this reply
    answers your question.
    Regards,
    Chris Jensen
    Senior Technical Support Lead











    Chris Jensen

    • Proposed as answer by Forrest Guo Wednesday, February 22, 2012 1:18 AM
    • Marked as answer by Forrest Guo Monday, February 27, 2012 2:14 AM
    Tuesday, February 21, 2012 9:23 PM
  • Yi,

    I mark the answer, please check it.

    Regards.


    Forrest Guo | MSDN Community Support | Feedback to us

    Monday, February 27, 2012 2:15 AM
  • Thanks Forrest.

    But this is not what I need. I need the C# code to resize the chart size.

    Regards,

    Yi

    Tuesday, June 19, 2012 2:46 PM
  • Above code is the markup xml of the document. You may also manually set chart size, then reflect code with OpenXml Productivity Tool.  This will generate C# code for the document. You can regenrate document with the code, of course you can change size before run code.

    thanks,


    Forrest Guo | MSDN Community Support | Feedback to manager

    Tuesday, June 19, 2012 3:55 PM