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

Free Support Forum - aspose.com

document.MailMerge.ExecuteWithRegions

EXECUTION HALT 'document.MailMerge.ExecuteWithRegions' when call with large data

While enumerator.MoveNext

Dim dataTable As System.Data.DataTable = enumerator.Value

If Not Me.OutputType = OutputType.EXCEL Then

document.MailMerge.ExecuteWithRegions(dataTable)

End If

'Added by Arvind for EXCEL

If Me.OutputType = OutputType.EXCEL Then

designer.SetDataSource(dataTable)

designer.SetDataSource(Me.StaticFieldsList)

End If

'end

End While

Hi,

At least I need the document template to reproduce the issue, please attach it. Also, could you please provide more details of the error? Is there any exception thrown?

i am not getting any exception by ExceuteWithRegions Method halt …when my dataTable coantaina large data…about 60,000 records or more than 3000

this is my function and exccution halt at document.MailMerge.ExecuteWithRegions(dataTable) .

kindly give me reply as soon as possible

Public Overrides Sub GenerateDocument()

If Me.TemplatePath Is Nothing OrElse _

Me.TemplatePath.Trim.Equals("") Then

Throw New Exception("Template path not set.")

End If

' set license

Dim licenseFile As String = ConfigurationSettings.AppSettings("AsposeLicenseFile")

If (Not licenseFile Is Nothing) AndAlso (Not String.Empty.Equals(licenseFile)) Then

If Not Me.HttpContext Is Nothing Then

' called from webui; map virtual path to physical path

licenseFile = Me.HttpContext.Server.MapPath(Me.HttpContext.Request.ApplicationPath & licenseFile)

End If

Dim asposeWordLicense As New Aspose.Word.License

asposeWordLicense.SetLicense(licenseFile)

Dim asposePdfLicense As New Aspose.Pdf.License

asposePdfLicense.SetLicense(licenseFile)

'Added by Arvind for EXCEL

Dim asposeExcelLicense As New Aspose.Excel.License

asposeExcelLicense.SetLicense(licenseFile)

'End

End If

' added by arun puthran on 19-oct-2005; try catch for ObjectDisposedException error

' Create new document from the Template

Dim document As Aspose.Word.Document

'Added by Arvind for Excel

Dim designer As ExcelDesigner

Try

If Not Me.OutputType = OutputType.EXCEL Then

document = New Aspose.Word.Document(Me.TemplatePath)

End If

'Added by Arvind for EXCEL

If Me.OutputType = OutputType.EXCEL Then

designer = New ExcelDesigner

Dim designerFile As String = Me.TemplatePath

designer.Open(designerFile)

End If

''End

Catch ex As System.ObjectDisposedException

' ignore ObjectDisposedException error

End Try

' set repetitive fields

If Me.Relation Is Nothing AndAlso _

(Me.Relations Is Nothing OrElse Me.Relations.Count = 0) Then

' No master- child relation

Dim enumerator As IDictionaryEnumerator = Me.DocumentTableList.GetEnumerator()

While enumerator.MoveNext

Dim dataTable As System.Data.DataTable = enumerator.Value

If Not Me.OutputType = OutputType.EXCEL Then

document.MailMerge.ExecuteWithRegions(dataTable) // Exceution halt at this point

End If

'Added by Arvind for EXCEL

If Me.OutputType = OutputType.EXCEL Then

designer.SetDataSource(dataTable)

designer.SetDataSource(Me.StaticFieldsList)

End If

'end

End While

ElseIf (Not Me.Relations Is Nothing) AndAlso (Me.Relations.Count > 1) Then

If Not Me.OutputType = OutputType.EXCEL Then

Dim dstDoc As Aspose.Word.Document = document.Clone()

dstDoc.Sections.Clear()

Me.IsFirstPage = True

For Each relation As DataRelation In Me.Relations

ProcessRelation(relation, document, dstDoc)

Next

InsertHeader(dstDoc)

document = dstDoc

End If

'Added by Arvind for EXCEL

If Me.OutputType = OutputType.EXCEL Then

ProcessExcelRelations(Me.Relation, designer)

End If

'End

ElseIf Not Me.Relation Is Nothing Then

If Not Me.OutputType = OutputType.EXCEL Then

Dim dstDoc As Aspose.Word.Document = document.Clone()

dstDoc.Sections.Clear()

ProcessRelation(Me.Relation, document, dstDoc)

InsertHeader(dstDoc)

document = dstDoc

End If

If Me.OutputType = OutputType.EXCEL Then

ProcessExcelRelation(Me.Relation, designer)

End If

End If

' set static fields

If Not Me.StaticFieldsList Is Nothing Then

If Not Me.OutputType = OutputType.EXCEL Then

If document.Sections.Count.Equals(0) Then

Throw New Exception(Constants.NoRecordsFound)

End If

document.MailMerge.Execute(Me.StaticFieldsList)

End If

End If

Select Case Me.SaveType

Case SaveType.Save

If Not Me.OutputType = OutputType.EXCEL Then

Save(document, Me.OutputType)

End If

'Added by Arvind for Excel

If Me.OutputType = OutputType.EXCEL Then

SaveExcel(designer)

End If

'end

Case SaveType.Browser

If Not Me.OutputType = OutputType.EXCEL Then

SendToBrowser(document, Me.OutputType)

End If

'Added by Arvind for Excel

If Me.OutputType = OutputType.EXCEL Then

SaveExcel(designer)

End If

'end

Case SaveType.SaveAndBrowser

If Not Me.OutputType = OutputType.EXCEL Then

Save(document, Me.OutputType)

SendToBrowser(document, Me.OutputType)

End If

'Added by Arvind for Excel

If Me.OutputType = OutputType.EXCEL Then

SaveExcel(designer)

End If

'end

End Select

End Sub

Please attach your template to test.

By the way, based on the namespace names, you are using very old versions of the components, aren’t you? Please upgrade to the latest versions and tell me if it helps.

Hi
Luca,


Thanks for your inquiry. Could you please attach your input Word documents here for testing? I will investigate the issue on my side and provide you more information.

Best Regards,

Hi,


Thanks for your inquiry. I was unable to reproduce any such issue on my side. Yes, it could be that you might silently be ignoring (via try catch blocks) an OutOfMemoryException. You can check if your output document is having size of 0 bytes. If this is found to be the case, I would simply recommend you to limit number of records in your data source.

If we can help you with anything else, please feel free to ask.

Best Regards,