Ability to edit and change Master Slide? #208
Replies: 6 comments
-
Hello. Thank you for feedback😊 Your requirements are clear, and, yes, that can be achieved programmatically. Unfortunately, ShapeCrawler does not have yet so rich APIs for manipulating Slide Master (Master) and Slide Layout (Layout) slides. Currently, the most ShapeCrawler's APIs support reading of properties of that presentation layers. As you might know, you should deep manipulate not only Master, but also Layout. It is being far more complicated if you are not going to just prepare template for future presentations, you edit existing production presentation with real user slides (Slide). In this case, for example, before moving Master shape to a new place, you should check whether it referenced (placeholders) by Layout or Slide. All such references should be re-mapped. |
Beta Was this translation helpful? Give feedback.
-
Hi @adamshakhabov, I've somehow more/less managed to achieve what I wanted to do. My process:
As result, I've got a PowerPoint file with only 1 Master Slide with the corrected merged slides. However, there is only 1 issue left. There are many unused/unlinked Slide Layouts in the pptx file. Is there any way you might know how to remove unused/unlinked Slide Layouts? This is to reduce the size of the pptx file. Thank you so much once again! 🤗 |
Beta Was this translation helpful? Give feedback.
-
Beta Was this translation helpful? Give feedback.
-
Hi @adamshakhabov , |
Beta Was this translation helpful? Give feedback.
-
Done: using var presentation = PresentationDocument.Open(@"remove-extra-layouts.pptx", true);
var usedSlidePart = presentation.PresentationPart!.SlideParts.First();
var usedSlideMaster = usedSlidePart.SlideLayoutPart!.SlideMasterPart;
var layoutIdList = usedSlideMaster!.SlideMaster!.SlideLayoutIdList!.OfType<SlideLayoutId>();
foreach (var layoutPart in usedSlideMaster.SlideLayoutParts)
{
if (usedSlidePart.SlideLayoutPart == layoutPart)
{
continue;
}
var removingRelIdValue = usedSlideMaster.GetIdOfPart(layoutPart);
var removingLayoutId = layoutIdList.First(layoutId => layoutId.RelationshipId == removingRelIdValue);
removingLayoutId.Remove();
usedSlideMaster.DeletePart(layoutPart);
} |
Beta Was this translation helpful? Give feedback.
-
Hi @adamshakhabov, |
Beta Was this translation helpful? Give feedback.
-
Hi there,
Thank you so much for this library. I'm having a use case where:
I hope the use case is understandable. (If not, do let me know). Can ShapeCrawler help me achieve this?
And if not, can I know if this use-case is achievable programmatically or not.
Thank you :)
Beta Was this translation helpful? Give feedback.
All reactions