Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (1 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 3: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 14-Feb-19 7:54am    
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

 
Share this answer
 
Comments
Member 14146557 14-Feb-19 7:54am    
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 14-Feb-19 13:52pm    
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)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900