Protected Function InsertPptSlide(ByVal mySlide As PptSlide, _ ByVal slideIndex As Integer) _ As PowerPoint.Slide Dim ppPresSource As PowerPoint.Presentation Dim sldSource As PowerPoint.Slide 'Slide to be copy Dim sldInserted As PowerPoint.Slide 'slide once copied in the output presentation Dim sldBlankSlide As PowerPoint.Slide log.Debug("Entering InsertPptSlide()") ppPresSource = _colSourcePres.GetPresentation(mySlide.PptFileName, _presentation) sldSource = ppPresSource.Slides(mySlide.SlideIndex) If mySlide.TemplateChange Then 'Add a blank template first to be able to apply the template before we copy the real slide 'We need to apply the template before we copy the real slide, 'otherwise a distortion may appear on the slide 'like font getting reduced in table '(This is to fix the problem detected on July 31, 2003 by NACM) sldBlankSlide = _presentation.Slides.Add(slideIndex, ppLayoutBlank) 'Apply template to the slide sldBlankSlide.Design = sldSource.Design 'because we added this blank slide, 'our slide must be inserted at the position (intIndexSlide + 1) slideIndex = slideIndex + 1 End If 'Copy from source, paste in destination sldSource.Copy() _presentation.Slides.Paste(slideIndex) 'Get a reference on the inserted slide sldInserted = _presentation.Slides(slideIndex) If mySlide.TemplateChange Then 'Delete the blank slide that we used to apply the template sldBlankSlide.Delete() End If sldInserted.ColorScheme = sldSource.ColorScheme sldInserted.DisplayMasterShapes = sldSource.DisplayMasterShapes 'Copy the background CopyBackground(sldSource, sldInserted) 'Hyperlinks If _hyperlinkSupport And mySlide.HyperLinks.Count > 0 Then AssignHyperLinks(mySlide, sldInserted) End If 'add UID sldInserted.Tags.Add("UID", mySlide.UID) 'Headers and Footers CopySlideHeadersAndFooters(sldInserted, sldSource) CopySlideFormatting(sldSource, sldInserted) 'Has Table? If _usesTemplate Then Select Case sldInserted.Shapes.Range.HasTable() Case msoTrue, msoCTrue, msoTriStateMixed mySlide.HasTable = True Case Else mySlide.HasTable = False End Select End If log.Debug("Exiting InsertPptSlide()") Return sldInserted End Function
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)