Create an Empty Slide.
Home › Forums › PresentationML › Create an Empty Slide.
- This topic has 2 replies, 2 voices, and was last updated 9 years, 11 months ago by
princrai.
-
AuthorPosts
-
March 24, 2016 at 12:12 am #3256
Eric White
KeymasterPresentationBuilder 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
March 24, 2016 at 5:31 pm #3271princrai
ParticipantHi 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 -
AuthorPosts
- You must be logged in to reply to this topic.