We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Weird problem when creating appended document with different templates

using licensed version
when creating a single document by appending multiple documents using the AppendDoc function it appears to carry over previous template text objects for no real understandable reason??

The templates work ok individually, but when during our merge process we allow users to select more than one template to produce multiple letters and when this happens the problem occurs, as shown in the attached merged document (frmLetterView.doc)
any idea’s??

Thanks for your inquiry. Could you please attach your source documents and provide me code that will allow me to reproduce this problem. I will investigate this problem and provide you more information. Also I would advise you to use the latest version of Aspose.Words.
Best regards.

here is the code we use to loop through a grid and create the letters and append them

its only letting me attach one template file

Private Sub btnPrintNow_Click(ByVal sender As System.Object, ByVal e As System.Web.UI.ImageClickEventArgs) Handles btnPrintNow.Click
Dim grdItem As DataGridItem
Dim objLetter As New clsLetter
Dim myCheckBox As CheckBox
Dim intResult As Integer
Dim intIdentity As Integer
Dim blnShowDoc As Boolean
Dim dstDoc As New Document
Dim srcDoc As Document
Dim strProfession As String
Dim strLetterType As String
Dim strDocName As String
Dim decRecID As Decimal
Dim decPrintID As Decimal
Dim strPath As String
Dim param As String = Me.Request.Params(0)
Dim strProfessionFromDataGrid As String
''license file for Aspose
'Dim license As License = New License
'license.SetLicense("C:\Scheduler V1.0.0.1\SchedulerWeb\bin\Aspose.Word.lic")
If CheckDate() = False Then Exit Sub 'kp 3/11/2006 SCHE1130
If CheckTimeOut_Std() = False Then Exit Try
If grdGrid.Items.Count = 0 Then
ASPNET_MsgBox(Me, "No records to print!")
Exit Sub
End If
Dim myItem As DataGridItem
Dim myBool As Boolean = False
For Each myItem In grdGrid.Items
If CType(myItem.Cells(14).Controls(1), CheckBox).Checked = True Then
myBool = True
Exit For
End If
If myBool = False Then
ASPNET_MsgBox(Me, "No records selected to print")
Exit Sub
End If
decPrintID = objLetter.GetPrintID(Me.VALUE1, Me.VALUE2, CType(Application("strVD"), String))
For Each grdItem In grdGrid.Items
If grdItem.ItemType = ListItemType.Item Or grdItem.ItemType = ListItemType.AlternatingItem Then
myCheckBox = CType(grdItem.Cells(14).Controls(1), CheckBox)
If myCheckBox.Checked = True Then
'print now
blnShowDoc = True
' Dim str As String = CType(grdItem.Cells(14).Controls(0), Label).Text
'create the document
'get required fields for creating the letter
Me.LETTERTYPE = CType(grdItem.Cells(3).Controls(1), Label).Text
Case enumLetterType.enumClient
strLetterType = "CLIENT"
Case enumLetterType.enumEpisode
strLetterType = "EPISODE"
Case enumLetterType.enumAppointment
strLetterType = "APPOINTMENT"
Case enumLetterType.enumBulkAppointment
strLetterType = "BULK"
Me.LETTERTYPE = enumLetterType.enumBulkAppReprint
Case enumLetterType.enumBulkAppointmentNextVisit
strLetterType = "BULK"
Me.LETTERTYPE = enumLetterType.enumBulkNVReprint
Case enumLetterType.enumBulkEpisode
strLetterType = "BULK"
Me.LETTERTYPE = enumLetterType.enumBulkEpiReprint
End Select
strProfession = CStr(CType(grdItem.Cells(17).Controls(1), Label).Text)
strDocName = CType(grdItem.Cells(8).Controls(1), Label).Text
decRecID = CType(grdItem.Cells(1).Controls(1), Label).Text
strPath = strProfession + "/" + strLetterType
srcDoc = fun_Create_Letter(strDocName, strPath, decRecID)
AppendDoc(dstDoc, srcDoc)
'set the properties
With objLetter
.LetterID = CType(grdItem.Cells(0).Controls(1), Label).Text
.TemplateID = CType(grdItem.Cells(2).Controls(1), Label).Text
.ID = CType(grdItem.Cells(1).Controls(1), Label).Text
.GeneratedDate = CStr(Date.MinValue) 'SET TO NULL IN WEBSERVICE
.PrintedDate = CStr(Date.Today)
.PrintedBy = Me.UNUMBER
.Timestamp = CType(grdItem.Cells(13).Controls(1), Label).Text
.PrintID = decPrintID 
.Batch = 0
.Profession = CStr(CType(grdItem.Cells(17).Controls(1), Label).Text)
End With
intResult = objLetter.UpdateLetter(Me.VALUE1, Me.VALUE2, CType(Application("strVD"), String))
'set existing doc to nothing
srcDoc = Nothing
End If
End If
If blnShowDoc = True Then
' strProfessionFromDataGrid = CStr(CType(grdItem.Cells(17).Controls(1), Label).Text)
'protect so doc cannot be edited
'display the resultant doc
dstDoc.Save( _
String.Format("{0}.doc", param), _
SaveFormat.FormatDocument, _
SaveType.OpenInWord, Response)
BindTheGrid(Me.GridSearchMode) 'Usual Search 
ASPNET_MsgBox(Me, "All letter records created successfully")
End If
' BindTheGrid(Me.GridSearchMode)
Catch ex As Exception
ASPNET_MsgBox(Me, "Unable to print selected letters : " & ex.Message)
End Try
End Sub
''**********************ASPOSE FUNCTIONS/SUBS*******************
Private Function App_Path() As String
Return System.AppDomain.CurrentDomain.BaseDirectory()
Catch ex As Exception
Throw ex
End Try
End Function
Private Function OpenDoc(ByVal fileName As String) As Document
Dim myDoc As Document
Return New Document(String.Format("{0}\{1}", curPath, fileName))
Catch ex As Exception
Throw ex
End Try
End Function
Private Sub AppendDoc(ByVal dstDoc As Document, ByVal srcDoc As Document)
While srcDoc.Sections.Count > 0
Dim section As Section = srcDoc.Sections(0)
'The section must first be removed before it can be inserted into a document.
End While
Catch ex As Exception
Throw ex
End Try
End Sub
Private Function fun_Create_Letter(ByVal strDocName As String, ByVal strPath As String, ByVal decID As Decimal) As Document
'Open the template document
Me.curPath = App_Path() + "Templates/" + strPath ' Directory for doc's
Dim doc As Document = OpenDoc(strDocName)
Dim intResult As Integer
Dim dsResults As New DataSet
If objLetter Is Nothing Then
objLetter = New clsLetter
End If
objLetter.ID = decID
intResult = objLetter.SelectLetterData(Me.VALUE1, Me.VALUE2, _
CType(Application("strVD"), String), Me.LETTERTYPE, dsResults)
If intResult > 0 Then 
'Perform the mail merge - with a DATA-TABLE!!!!
'This is useful if you want to delete any MERGEFIELD records that might
'be left at the end of the table.
Return doc
End If
Catch ex As Exception
Throw ex
End Try
End Function

2nd template

3rd and final template
upgrading to the new version would mean a new license!! the company would rather find a fix rather than pay for the new license

Thank you for additional information. I think that problem occurs because one of your documents contains floating textbox. Try using inline textbox or table cell instead floating textbox.
Our licensing model permits you free upgrades within one year to any new versions or fixes that come out during this time. Please open the license file and take the expiration date from it. Add one year. You can find and download any version issued before this date from this list:
Best regards.

the inline textbox does not appear to work either, i now get a wee box and no text as shown per attached doc
so i went and downloaded a new version per instruction…

expiry date in lic file is 20060315

so add a year, thats 15/Mar/2007

so i downloaded version (12/Mar/2007), run it and i get a license error saying the subscription in this release allows free upgrades until 15/mar/2006

You can try using a table cell instead textbox. Could you please create sample application that will allow me to reproduce this problem?
Also note that 15/mar/2006 is expiration date of your license.
Best regards.