本文介绍了如何删除最后一页中的页脚的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨我需要删除文档最后一页上的页脚。





hi i need to remove page footer on the last page of document.


Dim sfd As New SaveFileDialog
       With sfd
           .AddExtension = True
           .DefaultExt = ".doc"
           .Filter = "Word Document Files (*.doc)|*.doc"
           .FilterIndex = 1
           .InitialDirectory = My.Computer.FileSystem.SpecialDirectories.MyDocuments
           .Title = "Select The Location To Save This Word File"
           .ValidateNames = True
       End With

       If sfd.ShowDialog() = DialogResult.OK Then
           Try
               Dim svLocation As String = sfd.FileName

               rtbcomplete.SaveFile(svLocation)

               'opening the doc file to add header and footer

               Dim objApp As Word.Application
               Dim objDoc As Word.Document
               objApp = New Word.Application()
               objDoc = objApp.Documents.Open(svLocation)

               For Each section As Word.Section In objDoc.Sections
                   Dim footerRange As Word.Range = section.Footers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range
                   footerRange.InlineShapes.AddPicture("E:\Storage\Signed\f.jpg")
                   Dim headerRange As Word.Range = section.Headers(Word.WdHeaderFooterIndex.wdHeaderFooterPrimary).Range
                   headerRange.InlineShapes.AddPicture("E:\Storage\Signed\h.jpg")
               Next


               objDoc.Save()
               objDoc.Close()

           Catch ex As Exception
               MessageBox.Show(ex.Message)
           End Try
       End If

推荐答案

这篇关于如何删除最后一页中的页脚的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-27 16:16