使用vb.net将一个或多个文档文件添加到新文档 [英] adding one or more document files to a new document using vb.net
本文介绍了使用vb.net将一个或多个文档文件添加到新文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
这里在下面的编码中添加一段用vb.net编码创建的新文档,但我需要在新创建的文档中合并一个文档文件,请指导我编码......... ..
here in the below coding a paragraph is added to new document created with vb.net coding, but i need to merge a document file in the newly created document, kindly guide me the coding...........
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim oMissing As Object = System.Reflection.Missing.Value
Dim oEndOfDoc As Object = "\endofdoc"
' \endofdoc is a predefined bookmark
'Start Word and create a new document.
Dim oWord As Word._Application
Dim oDoc As Word._Document
oWord = New Word.Application()
oWord.Visible = True
oDoc = oWord.Documents.Add(oMissing, oMissing, oMissing, oMissing)
'Insert a paragraph at the beginning of the document.
Dim oPara1 As Word.Paragraph
oPara1 = oDoc.Content.Paragraphs.Add(oMissing)
oPara1.Range.Text = "Heading 1"
oPara1.Range.Font.Bold = 1
oPara1.Format.SpaceAfter = 24
'24 pt spacing after paragraph.
oPara1.Range.InsertParagraphAfter()
推荐答案
查看以下链接。
它将帮助您了解如何拆分或组合使用Vb.Net的两个文件
如何拆分或合并两个文件
这里 [ ^ ]是单词合并的好例子。
check 这个 [ ^ ]。
here[^] is nice example of word merge.
check this[^] also.
而不是使用Word Automation,请查看 OpenXML开发人员 [ ^ ]如何使用OpenXML SDK。
Instead of using Word Automation, check on OpenXML Developer[^] how to do it with OpenXML SDK.
这篇关于使用vb.net将一个或多个文档文件添加到新文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文