PowerPoint: How to change footer in slide on shape stores in master RRS feed

  • Question

  • Hi.

    like to set the footer text on a slide. I can set it with the following code, but it appears not at the location defined in the master. I am quite new to OpenXML, perhaps somebody can give me a hint.

    Actually using the following function to create shape with Placeholder like Title or Footer. But the shapes appears at the same location and not in the footer, SubTitle,... positions defined in the master.

     slidePart.Slide.CommonSlideData.ShapeTree.AppendChild(GenerateTitleShape(Slide.Title, PlaceholderValues.Title));
                            slidePart.Slide.CommonSlideData.ShapeTree.AppendChild(GenerateTitleShape(Slide.SubTitle, PlaceholderValues.SubTitle));
                            slidePart.Slide.CommonSlideData.ShapeTree.AppendChild(GenerateTitleShape(Slide.Title, PlaceholderValues.Footer));

    private Shape GenerateTitleShape(string title, PlaceholderValues type ) { _DrawingObjectId++; Shape titleShape = new Shape(); titleShape.NonVisualShapeProperties = new NonVisualShapeProperties (new NonVisualDrawingProperties() { Id = _DrawingObjectId, Name = "Title" }, new NonVisualShapeDrawingProperties(new a.ShapeLocks() { NoGrouping = true }), new ApplicationNonVisualDrawingProperties(new PlaceholderShape() { Type = type })); titleShape.ShapeProperties = new ShapeProperties(); // Specify the text of the title shape. titleShape.TextBody = new TextBody(new a.BodyProperties(),new a.ListStyle()); titleShape.TextBody.Append(new a.Paragraph(new a.Run(new a.Text(title)))); return titleShape; }

    Wednesday, July 9, 2014 8:17 PM


  • Hi,

    I suggest you setting the footer manully like fingure below:

    Then we can use OpenXML SDK Productifity tools to compare the difference between it changing before and changing after:

    Then you can View Package code to refer to the code.

    >>Actually using the following function to create shape with Placeholder like Title or Footer. <<

    It is a little difference between insert text into title and footer. To insert text into title we need to loop the shapes on the slide and determin whether the shape is a title shape. You can refer to code below:

    private static bool IsTitleShape(Shape shape)
        var placeholderShape = shape.NonVisualShapeProperties.ApplicationNonVisualDrawingProperties.GetFirstChild<PlaceholderShape>();
        if (placeholderShape != null && placeholderShape.Type != null && placeholderShape.Type.HasValue)
            switch ((PlaceholderValues)placeholderShape.Type)
                // Any title shape.
                case PlaceholderValues.Title:
                // A centered title.
                case PlaceholderValues.CenteredTitle:
                    return true;
                    return false;
        return false;

    Links below may be also helpful:
    How to: Get the titles of all the slides in a presentation (Open XML SDK)

    Presentations (Open XML SDK)

    Best regards


    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.

    Thursday, July 10, 2014 6:50 AM