Number was less than the array's lower bound in the first dimension. Parameter name: srcIndex

Can someone tell me what I did wrong?
Here’s what I did:

Dim doc As Aspose.Words.Document = word.Open(cDocFileIn)
'Fill the fields in the document with user data.
Dim Confirm As DataTable
Confirm = GetDt("Select * from confirm order by bookid")
doc.MailMerge.Execute(Confirm)
doc.MailMerge.DeleteFields()
doc.Save(cDocFileOut)
Dim rend As Aspose.Words.Viewer.DocumentRenderer
rend = New Aspose.Words.Viewer.DocumentRenderer(cDocFileOut)
rend.PrinterSettings.PrinterName = "PrintToFile"
rend.PrinterSettings.PrintToFile = True
rend.Print()

Richard

Please provide a stack trace of the exception.
Also, please attach the initial document and the document saved after MailMerge. We need these to be able to reproduce the problem.
Best regards,

The stacktrace:

? ex.StackTrace
" at System.Array.Copy(Array sourceArray, Int32 sourceIndex, Array destinationArray, Int32 destinationIndex, Int32 length)
at Aspose.Words.Viewer.DocumentRenderer.᪼(Int32 Ԛ, Int32 ५)
at Aspose.Words.Viewer.DocumentRenderer.Print()
at i_book.Confirm.UltraWebMenu1_MenuItemClicked(Object sender, WebMenuItemEventArgs e) in C:\Inetpub\wwwroot\i-book\Confirm.aspx.vb:line 165"

Don’t know how to attach the documents, but send it to sales@aspose.com

When you edit the post look at the several tabs at the top of the page, under Reply to an Existing Message text. To attach documents choose Options tab. The file attachment can be done there.
Sales team will probably forward the document to me but it can take some time before it will happen. So it is better to attach the document here. Please note that all attachments in the forum are private and are accessible only to the author of the post or Aspose staff members. So you don’t need to worry about confidentiality.
Best regards,

The attachments (confirm.doc is the iniated doc)

Thanks for providing additional info. We will try to fix this error as soon as possible so that it could be included in the next release which will be published in a few weeks.
Please note that normally we don’t fix errors in Aspose.Words.Viewer beta as it is no longer supported and not recommended for use in the production environment. We are working on entirely different implementation of the rendering engine now. More on that here:

<A href="

In this particular case, however, the error looks like it can be fixed without major code update so we will attempt to fix it.

Best regards,

Miklovan,
I’m looking forward to it and i certainly hope it will take less than a few weeks :wink:
Richard

We are happy to tell you that the new Rendering Engine has replaced the “old Viewer Beta”. The Rendering Engine can print, save as images or draw onto .NET Graphics object any document page.

Please see Aspose.Words documentation to learn more about new features.

Saving to image

In additional, new Rendering engine allows you to convert Word document to PDF directly (without using Aspose.Pdf).

Saving to Pdf

The latest version of Aspose.Words is available for download from downloads section or from NuGet