none
Adding a note to a slide using Open XML SDK RRS feed

  • Question

  • Looking for some pseudocode for adding a note to a slide using the Open XML SDK. There are a handful of parts involved, and it would be helpful to see a code sample or snippet.
    Tuesday, September 22, 2009 8:34 PM

All replies

  • I would recommend taking advantage of the Open XML Diff and Open XML Reflector tool that ship with the SDK. These tools can help you figure out how to add notes to a slide.

    In any case, what you will need to do is add a notes part to the slide and then add your notes in that specific part.
    Zeyad Rajabi (MS)
    Thursday, September 24, 2009 12:17 AM
  • Just curious if you have had any luck with this.  we keep running into issue with this also.  has anyone had any luck adding notes to a PPTX file and if so any suggestions on steps to take would be great or some code examples?
    Friday, February 25, 2011 4:55 PM
  • hi Tom,

    I have work on how to generate PPT report using OpenXml recently. And some of my code may be helpful to you.

    I used a PPTX as a template and there are lots of placeholder(it's called text box in pptx, the text in the text box is the same with the text box name) in the template so that i could insert the  note into the place i need.

    here is the code how to replace the text int the text box

       public void ReplaceTextInPlaceholder(string placeholderName,string newValue)
            {
                List<Shape> shapes = FindAllSpecifiedShapes(_slide,placeholderName);
                foreach (var shape in shapes)
                {
                    foreach (var paragraph in shape.TextBody.Descendants<A.Paragraph>())
                    {
                        foreach (var text in paragraph.Descendants<A.Text>())
                        {
                            text.Text = text.Text.Replace(placeholderName,newValue);
                        }
                    }
                }
            }

    and the code how to find locate the placeholder

      protected List<Shape> FindAllSpecifiedShapes(Slide slide,string placeholderName)
            {
                var shapes = from shape in slide.Descendants<Shape>()
                             where IsSpecifiedShape(shape, placeholderName)
                             select shape;
                return new List<Shape>(shapes);
            }
    

    If anything not clear please feel free to let me know. 


    Luther

    • Proposed as answer by Zhihua Lu Monday, June 11, 2012 1:07 AM
    Friday, June 8, 2012 9:11 AM