Getting stream for SlideLayoutPart of a slide.

Home Forums PresentationML Getting stream for SlideLayoutPart of a slide.

This topic contains 1 reply, has 2 voices, and was last updated by  Eric White 8 years, 8 months ago.

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #3324

    princrai
    Participant

    Hi Eric,
    I am creating a empty slide with one blank slide and in that I create a layout part using the below fucntion.
    private static SlideLayoutPart CreateSlideLayoutPart(SlidePart slidePart)
    {
    SlideLayoutPart slideLayoutPart1 = slidePart.AddNewPart<SlideLayoutPart>(“rId1”);
    Presentation.SlideLayout slideLayout = new Presentation.SlideLayout(
    new Presentation.CommonSlideData(new Presentation.ShapeTree(
    new Presentation.NonVisualGroupShapeProperties(
    new Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)1U, Name = “” },
    new Presentation.NonVisualGroupShapeDrawingProperties(),
    new Presentation.ApplicationNonVisualDrawingProperties()),
    new Presentation.GroupShapeProperties(new TransformGroup()),
    new Presentation.Shape(
    new Presentation.NonVisualShapeProperties(
    new Presentation.NonVisualDrawingProperties() { Id = (UInt32Value)2U, Name = “” },
    new Presentation.NonVisualShapeDrawingProperties(new ShapeLocks() { NoGrouping = true }),
    new Presentation.ApplicationNonVisualDrawingProperties(new Presentation.PlaceholderShape())),
    new Presentation.ShapeProperties(),
    new Presentation.TextBody(
    new BodyProperties(),
    new ListStyle(),
    new Paragraph(new EndParagraphRunProperties()))))),
    new Presentation.ColorMapOverride(new MasterColorMapping()));
    slideLayoutPart1.SlideLayout = slideLayout;
    return slideLayoutPart1;
    }

    But when I do slideLayoutPart1.GetStream() it gives empty stream. and hence when I try to integrate with powerpointbuilder for my features and try to use slideLayoutPart1.GetXDocument() it is empty. Can you suggest how can I make sure slideLayoutPart1.GetXDocument() works correct. One way is I create a string and feed that string to slideLayoutPart1. But can there is any easy way I can leverage the above function and also get the stream .

    Thanks,
    Prince

    #3328

    Eric White
    Keymaster

    Hi,

    I have never tried to create a slide from scratch. Instead, my approach is to create a one-slide presentation with the slide as I desire it, and then integrate the slide using PresentationBuilder, and then if necessary modify the slide after PresentationBuilder is done with it.

    When you create a part, it is initially empty, but you can get the XDocument, then modify it. Following is the code to create a new comments part, and the initialize the XDocument.

        mainPart.AddNewPart<WordprocessingCommentsPart>();
    

    newComments = mainPart.WordprocessingCommentsPart.GetXDocument();

        newComments.Declaration.Standalone = "yes";
    

    newComments.Declaration.Encoding = “UTF-8”;

        newComments.Add(new XElement(W.comments, NamespaceAttributes));
    

    commentNumber = 1;

    -Eric

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.