如何拆分word文档如何将一个word文档中某页其中的一段拆分为
下面是按页拆分word文档的程序,请参考:Option ExplicitDim oWord As Word.ApplicationDim oDoc As Word.DocumentDim oNewDoc As Word.DocumentDim oRange As Word.RangeDim iPageNumber As IntegerDim iCount As IntegerDim strTestDir As StringDim strTestFile As StringPrivate Sub Command1_Click() Command1.Visible = False Dim lCurrentStart As Long Dim lCurrentEnd As Long Dim lDocumentEnd As Long Dim lOutputCount As Long lOutputCount = 0 'Launch Word and make it visible Set oWord = CreateObject("Word.Application") oWord.Visible = True 'Open the test document Set oDoc = oWord.Documents.Open(FileName:="C:\ThreePageDocument.doc") 'Find the beginning end of the document oDoc.Select lCurrentStart = oWord.Selection.Start lCurrentEnd = lCurrentStart lDocumentEnd = oWord.Selection.End 'Move the insertion point to the beginning of the document oWord.Selection.Collapse wdCollapseStart Do While (lCurrentEnd < lDocumentEnd) 'Move the insertion pointer to the bottom of this page oWord.Browser.Target = wdBrowsePage oWord.Browser.Next lCurrentEnd = oWord.Selection.End 'On the last page, the start and end will be the same If (lCurrentStart = lCurrentEnd) Then lCurrentEnd = lDocumentEnd End If 'Capture the Range of the current page Set oRange = oDoc.Range(lCurrentStart, lCurrentEnd) 'Create a new document and copy the range to it Set oNewDoc = oWord.Documents.Add oRange.Copy oNewDoc.Range(0, 0).Paste 'Release the Range so we don't leak references Set oRange = Nothing 'Save the new document and close it oNewDoc.SaveAs FileName:="C:\Result" & lOutputCount & ".doc" ' You can save as another FileFormat. If so, change the ' file extension accordingly. oNewDoc.Close Set oNewDoc = Nothing 'Increment the output counter so we don't overwrite this file later lOutputCount = lOutputCount + 1 'Reset the current start position lCurrentStart = oWord.Selection.End LoopEnd Sub
word里“书籍拆页”是什么意思,打印出来的效果是什么样的
展开全部 你没说你的Word文件是什么样的,如果word是由图形、图片、表格、文字等各种元素组成的,并且有复杂的格式设置(图表组合、页面设置等等),你若简单地各页复制另存,就会造成版面变化甚至内容丢失。
要想保持各页面中内容和排版不变,你可以在每页的最后插入分节符(也就是在下一页的第一个字符前插入分节符),然后将文件另存为新文件,在新文件中找出要保留的页面,将其余的页都删掉。
重复以上操作以保存每一页文件。
如果文件页数很多,上述方法很繁琐,你可以采用软件转化的方法,简单介绍如下:1、先把word转换为pdf文件;2、用工具把pdf文件按每页拆分成多个独立的PDF文件(有很多工具,如pdfspme_win就很好);3、用转化工具把拆分的pdf文件在转回word文件(有很多工具,如SolidConverterPDF),这样目的就达到了。
至于word与pdf如何转化,方法很多,此处略掉,你可以百度一下。
你要问为什么要转化到pdf再转回来,因为只有转到pdf才能保证你的各个页面排版不会变化,通过这样的方法你可以得到与原始word文件完全一致的单页文件。
当然你也可以借助于office中的虚拟打印机同样可以达到目的。
如何将一个word文档按页拆分成多个文档
展开全部 1、在Word里面打开那个需要分割的文档(假设它的文件名叫做“原始文档.doc”);键入ALT+F11打开VBA编辑器,选择菜单“插入-模块”;粘贴下面的代码:Option ExplicitSub SplitPagesAsDocuments()Dim oSrcDoc As Document, oNewDoc As DocumentDim strSrcName As String, strNewName As String Dim oRange As Range Dim nIndex As Integer Dim fso As Object Set fso = CreateObject("Scripting.FileSystemObject") Set oSrcDoc = ActiveDocument Set oRange = oSrcDoc.Content oRange.Collapse wdCollapseStart oRange.Select For nIndex = 1 To ActiveDocument.Content.Information(wdNumberOfPagesInDocument) oSrcDoc.Bookmarks("\page").Range.Copy oSrcDoc.Windows(1).Activate Application.Browser.Target = wdBrowsePage Application.Browser.Next strSrcName = oSrcDoc.FullName strNewName = fso.BuildPath(fso.GetParentFolderName(strSrcName), _ fso.GetBaseName(strSrcName) & "_" & nIndex & "." & fso.GetExtensionName(strSrcName)) Set oNewDoc = Documents.Add Selection.Paste oNewDoc.SaveAs strNewName oNewDoc.Close False Next Set oNewDoc = Nothing Set oRange = Nothing Set oSrcDoc = Nothing Set fso = Nothing MsgBox "结束!"End Sub键入F5运行,看到“完成!”结束。
2、检查当前文档所在路径下是否生成若干名为“原始文档_n.doc”(n代表其对应原始文档中的第几页)的文档,检查它们的内容是否就对应于原始文档每个页面的内容。
如文档中有分节符分解后的文档会出现空白页,如要分解后不出现空白页,需要把文档中的分节符删除。
消除分节符的方法:注意事项分节符若全部替换,要注意替换后文档可能会出现排版混乱,这则需要自己手动排版了。
如何将一个word多页文档拆分为多个单页文档保存
1、在Word里面打开那个需要分割的文档(假设它的文件名叫做“原始文档.doc”);键入ALT+F11打开VBA编辑器,选择菜单“插入-模块”;粘贴下面的代码:Option ExplicitSub SplitPagesAsDocuments()Dim oSrcDoc As Document, oNewDoc As DocumentDim strSrcName As String, strNewName As StringDim oRange As RangeDim nIndex As IntegerDim fso As ObjectSet fso = CreateObject("Scripting.FileSystemObject")Set oSrcDoc = ActiveDocumentSet oRange = oSrcDoc.ContentoRange.Collapse wdCollapseStartoRange.SelectFor nIndex = 1 To ActiveDocument.Content.Information(wdNumberOfPagesInDocument)oSrcDoc.Bookmarks("\page").Range.CopyoSrcDoc.Windows(1).ActivateApplication.Browser.Target = wdBrowsePageApplication.Browser.NextstrSrcName = oSrcDoc.FullNamestrNewName = fso.BuildPath(fso.GetParentFolderName(strSrcName), _fso.GetBaseName(strSrcName) & "_" & nIndex & "." & fso.GetExtensionName(strSrcName))
如何将word文档按页码拆分
展开全部 1、在Word里面打开那个需要分割的文档(假设它的文件名叫做“原始文档.doc”);键入ALT+F11打开VBA编辑器,选择菜单“插入-模块”;粘贴下面的代码:Option ExplicitSub SplitPagesAsDocuments()Dim oSrcDoc As Document, oNewDoc As DocumentDim strSrcName As String, strNewName As String Dim oRange As Range Dim nIndex As Integer Dim fso As Object Set fso = CreateObject("Scripting.FileSystemObject") Set oSrcDoc = ActiveDocument Set oRange = oSrcDoc.Content oRange.Collapse wdCollapseStart oRange.Select For nIndex = 1 To ActiveDocument.Content.Information(wdNumberOfPagesInDocument) oSrcDoc.Bookmarks("\page").Range.Copy oSrcDoc.Windows(1).Activate Application.Browser.Target = wdBrowsePage Application.Browser.Next strSrcName = oSrcDoc.FullName strNewName = fso.BuildPath(fso.GetParentFolderName(strSrcName), _ fso.GetBaseName(strSrcName) & "_" & nIndex & "." & fso.GetExtensionName(strSrcName)) Set oNewDoc = Documents.Add Selection.Paste oNewDoc.SaveAs strNewName oNewDoc.Close False Next Set oNewDoc = Nothing Set oRange = Nothing Set oSrcDoc = Nothing Set fso = Nothing MsgBox "结束!"End Sub键入F5运行,看到“完成!”结束。
2、检查当前文档所在路径下是否生成若干名为“原始文档_n.doc”(n代表其对应原始文档中的第几页)的文档,检查它们的内容是否就对应于原始文档每个页面的内容。
如文档中有分节符分解后的文档会出现空白页,如要分解后不出现空白页,需要把文档中的分节符删除。
消除分节符的方法:注意事项分节符若全部替换,要注意替换后文档可能会出现排版混乱,这则需要自己手动排版了。