Insert Paragraph into Word does not work

I have a .dot Word template and am trying to insert a Paragraph using ASP VBScript. So far I have been successful with:

1) Create a Document and DocumentBuilder object

2) Used the Clone method to load my .dot Word template

3) Scan through the Word template for Bookmarks and insert data from a SQL database

Now I would like to create a simple Paragraph and insert it into the Word template, but have been unsuccessful. The ASP page takes a while to load then nothing happens. The page is blank and there are no error messages generated.

Here is the code I am using to to create and insert a Paragraph:

oBuilder.MoveToMergeField("test")

dim oSection, oBody, oParagraph, oRun

set oDoc.Section = oSection

oDoc.AppendChild(oSection)

set oDoc.Body = oBody

oSection.AppendChild(oBody)

set oDoc.Paragraph = oParagraph

oBody.AppendChild(oParagraph)

oParagraph.LeftIndent = 2

set oDoc.Run = oRun

oRun.Text = "Hello World!"

oParagraph.AppendChild(oRun)

Is this the right way to go about it? I am following the sample code from the API on your website.

Thanks!

I don't know why the resulting page is blank. The given code does not provide sufficient information to make a conclusion. But to insert the paragraph somewhere in the document it is much better to use DocumentBuilder.Writeln() method. It inserts the given string write in the DocumentBuilder current position.

Best regards,