Create an Empty Slide.

Home Forums PresentationML Create an Empty Slide.

This topic contains 2 replies, has 2 voices, and was last updated by  princrai 8 years, 9 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3249

    princrai
    Participant

    Hi,

    I was trying to reuse the Presentation builder to shred objects(like smartart,chart,images) and create a new ppt documents by embedding these objects individually to these document. For this I tried to modify the AppendSlide Code to first create a empty slide and then insert these object. Currently I can see that you are creating the slide by calling newSlide.PutXDocument(slide.GetXDocument()); which copies all the references of all the objects in the newSlide too. But what I want is to create a empty slide. Can it be possible to create a empty slide.

    Thanks,
    Prince

    #3256

    Eric White
    Keymaster

    PresentationBuilder was not designed to work at the sub-slide level. Code from within PresentationBuilder could certainly be re-used, but I haven’t done any analysis on that problem.

    In general, when I need to insert a new slide (or any specific slide) I create a presentation that contains a single blank slide (or any specific slide) and then use PresentationBuilder to pull that slide into the generated presentation.

    Because PresentationBuilder is a stable platform that you can use to shred and combine presentations, and your use case is somewhat different, where you want to pull specific DrawingML objects from one slide to another, I recommend that instead of modifying PresentationBuilder, you create a new module (perhaps call it PresentationContentMover or some such). I don’t recommend attempting to combine this functionality with the functionality of PresentationBuilder.

    With this new module, perhaps the way to approach it is that you pass two open presentations to it, find the source object, find the slide in the destination, specify the location in the slide, and then move the content. You could certainly reuse some of the code around moving related content in PresentationBuilder.

    Before I released PresentationBuilder, it put it through extensive, comprehensive testing to make sure that a) it will not crash, b) it always produces a valid Open XML presentation, and c) it does the right thing. We should be hesitant to add new functionality to this module, and instead, create a new one.

    Cheers, Eric

    #3271

    princrai
    Participant

    Hi Eric,

    Looks like there is a small bug in the PresentBuilder Code. In the CopyMasterSlide function we are modifying the original Document master ids by below two lines.
    entry.Attribute(R.id).SetValue(newMaster.GetIdOfPart(newLayout));
    entry.SetAttributeValue(NoNamespace.smallid, newID.ToString());

    To fix this issue I just create independent copy of sourceMaster. Something like this.
    XDocument sourceMaster1 = sourceMasterPart.GetXDocument();
    XDocument sourceMaster = new XDocument(sourceMaster1);

    Can you check once if it is really a bug. Maybe this is not caught because we are calling this only once for each document. But in my case when I was calling it again and again for each object I found this issue.

    Thanks,
    Prince

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

You must be logged in to reply to this topic.