且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用VB .NET在现有word文档中插入空白页?

更新时间:2023-11-07 13:38:58

请先阅读我的评论。



我建议阅读这些文章:

如何从Visual Basic自动化Word。 NET创建新文档 [ ^ ]

使用文档 - Visual Studio | Microsoft Docs [ ^ ]


I have used the below code to create a word document and entered some text on it.

Now i want to insert a blank page after creating the document. Please give code to do that.

What I have tried:

Dim ssstring As String = pDoc.InnerText()
Dim sb As StringBuilder
Dim tmppath As String

sb = New StringBuilder()
sb.Append(pDoc.InnerText)

tmppath = (pObjMgr.GetField(Objects.Global, [Global].ESignFileLocation, 0) & "\Document_") & m_Document.ToString & "_" & DateTime.Now.ToString("yyyyMMddhhmmss") & ".doc"

File.WriteAllText(tmppath, sb.ToString(), Encoding.UTF8)

Please, read my comment first.

I'd suggest to read these articles:
How to automate Word from Visual Basic .NET to create a new document[^]
Work with documents - Visual Studio | Microsoft Docs[^]