I have been using Aspose Word to convert into PDF.
Now I need to 2 tables in the same doc. I assumed that I can create the Merge fields one more time by giving the TableStart and TableEnd fields again. In the code I filled another Dataset and put another ExecuteWithRegions again. But I get an error saying that the table doesnot exist in the Dataset. The following is the code and the commented portion is the second Region. (removed SQL statement to reduce the lines. rgds/
Dim strSQL
Dim myCommand As OracleDataAdapter
Dim DS As DataSet
Dim doc As New Document(Request.MapPath(Request.ApplicationPath) & "\QoutationSamples\LCL_Pathfinder_Word_Template_1.dot")
strSQL = " ..."
myCommand = New OracleDataAdapter(strSQL, myConnection)
DS = New DataSet()
myCommand.Fill(DS, "LCLGUIDE")
If DS.Tables("LCLGUIDE").Rows.Count > 0 Then
doc.MailMerge.ExecuteWithRegions(DS)
End If
DS.Clear()
'myCommand.Dispose()
' ---- second region
'DS.Clear()
'strSQL = "...."
'myCommand.Fill(DS, "LCLGUIDEPOINTS")
'If DS.Tables("LCLGUIDEPOINTS").Rows.Count > 0 Then
It seems that when you call ExecuteWithRegions second time - it searches for "LCLGUIDE" table first as the mergefields for this table still exist in the document. When it is not found in the dataset Aspose.Words breaks.
Try to fill dataset with both tables and call ExecuteWithRegions only once.
Thanx for the help. While I check this I have another issue for you. In the same Word file I sent you if an image is placed in the Header, it is ignored in the PDF. Could pl check on this. I am enclosing the file again with the image in the header.
From what I see the image is not ignored but rather misalligned. It is positioned inline in your template but it is better to set it floating with explicit positioning to avoid positioning problems.
I am sending the corrected template along with PDF made from it.
Also please make sure that you are using the latest versions of Aspose libraries.
I tried but now none of the two tables are shown. No error but the placeholders are only shown. I am using 2 Dataadapters to fill into the same dataset. Here's my code and attched is the word and pdf. Thanx in advance
Dim strSQL1
Dim strSQl2
Dim myCommand1 As OracleDataAdapter
Dim myCommand2 As OracleDataAdapter
Dim DS As DataSet
Dim doc As New Document(Request.MapPath(Request.ApplicationPath) & "\QoutationSamples\LCL_Pathfinder_Word_Template_1.dot")
strSQL1 = "..."
'----
strSQl2 += " .."
myCommand2 = New OracleDataAdapter(strSQl2, myConnection)
DS = New DataSet()
myCommand2.Fill(DS, "LCLGUIDEPOINTS")
'---
myCommand1 = New OracleDataAdapter(strSQL1, myConnection)
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.
Sets consent for personalized advertising.
Cookie Notice
To provide you with the best experience, we use cookies for personalization, analytics, and ads. By using our site, you agree to our cookie policy.
More info
Enables storage, such as cookies, related to analytics.
Enables storage, such as cookies, related to advertising.
Sets consent for sending user data to Google for online advertising purposes.