/// <summary> /// Clone an existing slide (make a copy) /// </summary> /// <param name="presentation">PPT.Presentation object instance</param> /// <param name="slide">PPT.Slide instance that is to be cloned</param> /// <param name="destination">Destination for the cloned slide</param> /// <param name="locationIndex">Optional index for the new slide (slide.Index)</param> /// <returns></returns> public PPT.SlideRange CloneSlide( PPT.Presentation presentation, PPT.Slide slide, Locations.Location destination, int locationIndex = 0) { PPT.SlideRange dupeSlide = slide.Duplicate(); switch (destination) { case Locations.Location.First: dupeSlide.MoveTo(1); break; case Locations.Location.Last: dupeSlide.MoveTo((presentation.Slides.Count)); break; case Locations.Location.Custom: dupeSlide.MoveTo(locationIndex); break; } return(dupeSlide); }
private SlideRange AppendTemplateSlide() { var slide = TemplateSlide.Duplicate(); slide.MoveTo(WorkingPPT.Slides.Count); return(slide); }
public void AppendChapter(Bible bible, int chapter, int paraNum, IEnumerable <string> chapterContent, CancellationToken token) { var isFirst = true; foreach (var paragraph in chapterContent) { token.ThrowIfCancellationRequested(); var slide = templateSlide.Duplicate(); slide.MoveTo(workingPPT.Slides.Count); foreach (var textShape in slide.Shapes.Cast <PowerPoint.Shape>() .Where(i => i.HasTextFrame == MsoTriState.msoTrue) .Select(i => i.TextFrame.TextRange)) { var text = textShape.Text; text = AddSuffix(text, "CHAP", everyChapter || isFirst, chapter + ""); text = AddSuffix(text, "STITLE", everyShortTitle || isFirst, bible.shortTitle); text = AddSuffix(text, "TITLE", everyLongTitle || isFirst, bible.longTitle); text = text.Replace("[PARA]", paraNum + ""); text = text.Replace("[BODY]", paragraph); textShape.Text = text; } isFirst = false; paraNum++; } }
public void duplicateSlide(int sileIndex) { PowerPoint.Slide slide = getSilde(sileIndex); if (slide == null) { return; } slide.Duplicate(); }
public void AppendChapter(IEnumerable <IEnumerable <Verse> > eachVerses, Book book, Chapter chapter, CancellationToken token) { isFirstVerseOfChapter = true; foreach (var eachVerse in eachVerses) { token.ThrowIfCancellationRequested(); var mainVerse = eachVerse.FirstOrDefault(i => i != null); if (mainVerse == null) { continue; } var slide = TemplateSlide.Duplicate(); slide.MoveTo(WorkingPPT.Slides.Count); foreach (var textShape in slide.Shapes.Cast <PowerPoint.Shape>() .Where(i => i.HasTextFrame == MsoTriState.msoTrue) .Select(i => i.TextFrame.TextRange)) { var text = textShape.Text; text = AddSuffix(text, "CHAP", $"{chapter.Number}", Job.TemplateChapterNumberOption); text = AddSuffix(text, "STITLE", book.Abbreviation, Job.TemplateBookAbbrOption); text = AddSuffix(text, "TITLE", book.Name, Job.TemplateBookNameOption); //text = text.Replace("[CPAS]", $"{startVerseNumber}"); //text = text.Replace("[CPAE]", $"{endVerseNumber}"); text = text.Replace("[PARA]", $"{mainVerse.Number}"); text = text.Replace("[BODY]", eachVerse.First()?.Text); var verseEnumerator = eachVerse.GetEnumerator(); for (var i = 1; i <= 9; i++) { var verse = verseEnumerator.MoveNext() ? verseEnumerator.Current : null; text = text.Replace($"[BODY{i}]", verse?.Text); } textShape.Text = text; } isFirstVerseOfChapter = false; } }