如何使用VB .NET在现有word文档中插入空白页? [英] How to insert a blank page in existing word document using VB .NET?

查看:367
本文介绍了如何使用VB .NET在现有word文档中插入空白页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用下面的代码创建一个word文档并在其上输入了一些文本。



现在我想在创建文档后插入一个空白页面。请给出代码。



我尝试过:



 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)

解决方案

< blockquote>请先阅读我的评论。



我建议阅读这些文章:

如何从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[^]


这篇关于如何使用VB .NET在现有word文档中插入空白页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆