Howie
December 8, 2006, 21:21:08
Hello,
I loaded sp1 for version 13 and now it strips out the images in the document when I do a mail merge. The two image types that I am using are jpegs and png files. I then choose to embedded the image in the document and it error out with the document is corrupt. I found problem either the header or in the body of the document. It did not do this in the version 13 with no service packs. I removed the textcontrol software and then rebooted and then reloaded version 13 without the service pack. I ran it against the same file and it works without problems.
Howie
Björn Meyer
December 11, 2006, 13:49:45
Howie
May I ask you what you are doing in detail? Which format do you use to save the document? How do you insert the images?
Thanks.
Howie
December 14, 2006, 19:49:37
This is the template side code to add the image.
Dim NewImage As New TXTextControl.Image
TextControl1.Images.Add(NewImage, TXTextControl.HorizontalAlignment.Left, -1, TXTextControl.ImageInsertionMode.DisplaceText)
This is the field code for inserting the templates
Dim newField As New TXTextControl.TextField
newField.Name = DatabaseTables.SelectedItem + "." + ListDatabaseFields.SelectedItem
newField.Text = "[" + DatabaseTables.SelectedItem + "." + ListDatabaseFields.SelectedItem + "]"
newField.DoubledInputPosition = True
newField.ShowActivated = True
newField.Editable = False
TextControl1.TextFields.Add(newField)
TextControl1.Selection.Start = newField.Start + newField.Length
This is the server side merge code in a sub called MergeWord. I have many dataclasses in this project, but you can see how I am doing this.
Private Sub MergeWord(ByVal strFilePath As String)
Dim oClaimsDAC As Claims
Dim oActivityDAC As Activity
Dim oAdjustersDAC As Adjusters
Dim oCausesDAC As Causes
Dim oContactDAC As Contact
Dim oExpertDAC As Expert
Dim oIns_coDAC As Ins_co
Dim oOfficeDac As Office
Dim lClaimsAdjusterID As Integer
Dim lClaimsCausesID As Integer
Dim lClaimsContactID As Integer
Dim lClaimsInsCoID As Integer
Dim intOfficeCode As Integer
Dim strInscoExpertCode As String
Try
Dim ServerTextControl1 As New TXTextControl.ServerTextControl
ServerTextControl1.Create()
Try
' load template
ServerTextControl1.Load(strFilePath, TXTextControl.StreamType.InternalFormat)
Catch exp As Exception
WriteToDB(exp.Message & " ")
Throw New Exception(exp.Message)
End Try
ServerTextControl1.Save(mstrDocumentPath & "Temp\" & mstrSessionID & ".rga", TXTextControl.StreamType.InternalFormat)
'Now addin the specifics to the file
Dim strField As String
Dim dsClaims As DataSet
oClaimsDAC = New Claims
With oClaimsDAC
.ConnectionString = mstrConnectString
.SelectFilter = ClaimsDC.SelectFilters.All
.WhereFilter = ClaimsDC.WhereFilters.PrimaryKey
.ClaimId = mintClaimID
.LoadByPK(mintClaimID)
lClaimsAdjusterID = .AdjusterId
lClaimsCausesID = .CauseId
lClaimsContactID = .ContId
lClaimsInsCoID = .CompId
dsClaims = .DataSet
' merge fields using database values
For Each field As TXTextControl.TextField In ServerTextControl1.TextFields
'Check Field Name to see if the field is in this table. If it is, then check to see if it is in
' the document.
If CheckField("Claims", field) Then
'Get Field Name
strField = GetFieldName(field)
'Check if field is in Document and if it is add replace its value
If dsClaims.Tables.Item(0).Columns.Contains(strField) Then
field.Text = dsClaims.Tables.Item(0).Rows(0).Item(strField).ToS tring
End If
End If
Next
End With
Dim dsCauses As DataSet
oCausesDAC = New Causes
With oCausesDAC
.ConnectionString = mstrConnectString
.SelectFilter = CausesDC.SelectFilters.All
.WhereFilter = CausesDC.WhereFilters.PrimaryKey
.CauseId = lClaimsCausesID
.LoadByPK(lClaimsCausesID)
dsCauses = .DataSet
' merge fields using database values
For Each field As TXTextControl.TextField In ServerTextControl1.TextFields
'Check Field Name to see if the field is in this table. If it is, then check to see if it is in
' the document.
If CheckField("Causes", field) Then
'Get Field Name
strField = GetFieldName(field)
'Check if field is in Document and if it is add replace its value
If dsCauses.Tables.Item(0).Columns.Contains(strField) Then
field.Text = dsCauses.Tables.Item(0).Rows(0).Item(strField).ToS tring
End If
End If
Next
End With
Dim dsIns_co As DataSet
oIns_coDAC = New Ins_co
With oIns_coDAC
.ConnectionString = mstrConnectString
.SelectFilter = Ins_coDC.SelectFilters.All
.WhereFilter = Ins_coDC.WhereFilters.PrimaryKey
.CompId = lClaimsInsCoID
.LoadByPK(lClaimsInsCoID)
strInscoExpertCode = .ExpertCode.ToString
dsIns_co = .DataSet
' merge fields using database values
For Each field As TXTextControl.TextField In ServerTextControl1.TextFields
'Check Field Name to see if the field is in this table. If it is, then check to see if it is in
' the document.
If CheckField("Ins_co", field) Then
'Get Field Name
strField = GetFieldName(field)
'Check if field is in Document and if it is add replace its value
If dsIns_co.Tables.Item(0).Columns.Contains(strField) Then
field.Text = dsIns_co.Tables.Item(0).Rows(0).Item(strField).ToS tring
End If
End If
Next
End With
' save doc
ServerTextControl1.Save(mstrDocumentPath & "Temp\" & mstrSessionID & ".rga", TXTextControl.StreamType.InternalFormat)
ServerTextControl1.Dispose()
Catch exp As Exception
WriteToDB(exp.Message)
Throw New Exception(exp.Message)
End Try
End Sub
Howie