Click here to Skip to main content
13,863,229 members
Rate this:
 
Please Sign up or sign in to vote.
See more:
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)
Posted
Updated 11-Feb-19 4:45am
Comments
Maciej Los 11-Feb-19 9:41am
   
No, you don't. You're creating new text file instead a real *.doc file.
Member 14146557 4 days ago
   
Thanks all for yours suggestions.

This is my exact requirements,

1.I want to append some text in a file as first step,
2.And then want to create new page in the same file then will append some other text on that newly created page then will save the file as .doc in run time.

I am using
File.WriteAllText
and String builder to do that (Sample code given above)

Now the problem is can't create a new page in the file using File.Append or File.Write..
Can any one give some code to create a new page using this method?

1 solution

Rate this: bad
 
good
Please Sign up or sign in to vote.

Solution 1

   
Comments
Member 14146557 4 days ago
   
Thanks all for yours suggestions.

This is my exact requirements,

1.I want to append some text in a file as first step,
2.And then want to create new page in the same file then will append some other text on that newly created page then will save the file as .doc in run time.

I am using
File.WriteAllText
and String builder to do that (Sample code given above)

Now the problem is can't create a new page in the file using File.Append or File.Write..
Can any one give some code to create a new page using this method?
Maciej Los 4 days ago
   
Have you read my answer? No, because you still talking about writing to text file instead of doc file! Read my answer again, carefully.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month


Advertise | Privacy | Cookies | Terms of Service
Web05 | 2.8.190214.1 | Last Updated 11 Feb 2019
Copyright © CodeProject, 1999-2019
All Rights Reserved.
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100