none
Apply a template to a new presentation in vb.net RRS feed

  • Question

  • Hi,


    I have created a vb.net application in which I am creating powerpoint slides using templates.

    Template is nothing but existing powerpoint slide with some background theme and footer.

    So, I have to use that pattern to new powerpoint file.

    Kindly suggest some vb.net code to use same footer as in existing powerpoint file.

    Thanks & Regards,

    Saurav Sinha

    • Moved by Stanly Fan Tuesday, October 16, 2018 7:22 AM Office related
    Monday, October 15, 2018 5:43 PM

All replies

  • Hi,

    According to your description, your issue is more related about Office apps. And this forum is discussing and asking questions about the Windows Form and ClickOnce, I will move this thread to corresponding forum: Office PowerPoint Forum for dedicated information.

    Thank you for your understanding.

    Regards,

    Stanly


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Tuesday, October 16, 2018 6:24 AM
  • I have tried below code -

    Private sub Create_PowerpointFile()

            Dim ppt As PowerPoint.Presentation = Nothing
            Dim layout As PowerPoint.CustomLayout = Nothing

            ppt = OpenNewPPT("D:\Presentation1.pptx")

            layout = ppt.Slides(1).CustomLayout
            layout.HeadersFooters.Footer.Visible = MsoTriState.msoCTrue
            ppt.Slides.AddSlide(1, layout)
            ppt.Slides.AddSlide(2, layout)

             If Not layout Is Nothing Then Marshal.ReleaseComObject(layout)
             If Not ppt Is Nothing Then Marshal.ReleaseComObject(ppt)

    End Sub


    Private Function OpenNewPPT(filePath As String) As PowerPoint.Presentation

            Dim newPPT As PowerPoint.Presentation = Nothing
            Dim pptApplication As Application = New Application()
            Dim ppts As PowerPoint.Presentations = pptApplication.Presentations

            newPPT = ppts.Open(filePath, _
                Microsoft.Office.Core.MsoTriState.msoFalse, _
                Microsoft.Office.Core.MsoTriState.msoTrue, _
                Microsoft.Office.Core.MsoTriState.msoTrue)
            Marshal.FinalReleaseComObject(ppts)
            Return newPPT
    End Function

    In this code "Presentation1.pptx" is a template/existing file. I have to use same theme with footer while creating new powerpoint file.

    Kindly suggest me some vb.net code to use same footer text from existing file.

    Thanks & Regards,

    Saurav Sinha

    Tuesday, October 16, 2018 8:56 AM
  • Hi Saurav,

    >>vb.net code to use same footer as in existing PowerPoint file.

    This example sets the text for the footer on the slide master in the active presentation and the footer to appear on the title slide.

    With Application.ActivePresentation.SlideMaster.HeadersFooters
    
        .Footer.Text = "Introduction"
    
        .DisplayOnTitleSlide = True
    
    End With

    For more information, please see the following links:

    HeadersFooters.Footer Property (PowerPoint)

    Add footer into a PowerPoint document

    PowerPoint Headers and Footers

    Hopefully it helps you.  Please feel free to ask any questions.

    Best Regards,

    Lina


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Tuesday, October 16, 2018 9:25 AM
  • Hi Saurav,

    Thanks for your asking. Please remember to mark the replies(Include your solution) as answers if they helped and please help us close the thread.

     

    Thank you for understanding. If you have any question, or update, please feel free to let us know.

     

    I wish you a happy life!

     

    Best Regards,

     

    Lina


    MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread.

    Thursday, October 18, 2018 3:01 AM