We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Mail Merge - multiple Master/Child records

Thread ID:

Created:

Updated:

Platform:

Replies:

47700 Aug 10,2006 05:47 AM Aug 14,2006 09:27 PM ASP.NET Web Forms (Classic) 3
loading
Tags: DocIO
James Organ
Asked On August 10, 2006 05:47 AM

Hello

I am trying to use this to perform a Mail Merge. It similar to the Invoice sample, but has multiple entries (Master / Child relationship).
I cannot get the thing to work in anyway shape or form.
Do you have any samples that show how to do this?

Regards
James

Administrator [Syncfusion]
Replied On August 10, 2006 08:02 PM

Hi James,

Thank you for your interest in Syncfusion Essential DocIO.

1. I am not sure if I understand your requirement is correct. However I have created a sample which gets the sales invoice records from Northwind table and store it into the single master document. Could you please take a look for the attached sample and let me know if it meets your need.

2. Currently we do not have a support for drawing shapes and forms. However we are working with these features and I will update you as soon as the features gets implemented.

Thanks,
Prabhu.



>Hello

I am trying to use this to perform a Mail Merge. It similar to the Invoice sample, but has multiple entries (Master / Child relationship).
I cannot get the thing to work in anyway shape or form.
Do you have any samples that show how to do this?

Regards
James

Sales_Invoice.zip

James Organ
Replied On August 12, 2006 03:59 AM

Hello Prabhu

Thanks for the response. I believe you sample is on the right track, however I can''t an error when it runs. The error occurs on the MasterDoc.Save command and the error displayed is: An unhandled exception of type ''System.NullReferenceException'' occurred in syncfusion.docio.base.dll

Additional information: Object reference not set to an instance of an object.

I have replicated your code in my vb.net web application. The application is reading through the records. When it gets to the Save command (masterDoc.Save("Business Unit.doc", FormatType.Doc, Response, HttpContentDisposition.InBrowser)) I get the same error with the additional information that may help:
Stack Trace:


[NullReferenceException: Object reference not set to an instance of an object.]
Syncfusion.DocIO.DLS.DLSWordRWAdapter.WriteParagraphStyle(IWordWriterBase writer, IParagraph paragraph)
Syncfusion.DocIO.DLS.DLSWordRWAdapter.WriteParagraphProperties(IWParagraph paragraph)
Syncfusion.DocIO.WordRWAdapterBase.WriteParagraph(IWParagraph paragraph)
Syncfusion.DocIO.DLS.DLSWordRWAdapter.WriteParagraphs(IParagraphCollection collection, Boolean isTableBody)
Syncfusion.DocIO.DLS.DLSWordRWAdapter.WriteTable(IWTable table)
Syncfusion.DocIO.WordRWAdapterBase.WriteParagraph(IWParagraph paragraph)
Syncfusion.DocIO.DLS.DLSWordRWAdapter.WriteParagraphs(IParagraphCollection collection, Boolean isTableBody)
Syncfusion.DocIO.WordRWAdapterBase.WriteBody(WordDocument document)
Syncfusion.DocIO.DLS.DLSWordRWAdapter.WriteBody(WordDocument document)
Syncfusion.DocIO.WordRWAdapterBase.Write(WordDocument document, IWordWriter writer)
Syncfusion.DocIO.DLS.DLSWordRWAdapter.Write(WordWriter writer, WordDocument wordDoc)
Syncfusion.DocIO.DLS.WordDocument.Save(Stream stream, FormatType formatType)
Syncfusion.DocIO.DLS.WordDocument.Save(String fileName, FormatType formatType, HttpResponse response, HttpContentDisposition contentDisposition)
ComplianceNet.rptBusinessActivity.Page_Load(Object sender, EventArgs e) in c:\demo.cu-knowhow.com.au\Compliance.Net\rptBusinessActivity.aspx.vb:64
System.Web.UI.Control.OnLoad(EventArgs e) +67
System.Web.UI.Control.LoadRecursive() +35
System.Web.UI.Page.ProcessRequestMain() +731

The full code for my app (except the data retrieval) is:
Imports System.Text
Imports Syncfusion.DLS
Imports Syncfusion.DocIO
Imports Syncfusion.DocIO.DLS
Imports System.Collections
Imports System.IO
Imports System.ComponentModel
Imports System.Drawing

Public Class rptBusinessActivity
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

''This call is required by the Web Form Designer.
Private Sub InitializeComponent()

End Sub
Protected WithEvents phMenu As System.Web.UI.WebControls.PlaceHolder

''NOTE: The following placeholder declaration is required by the Web Form Designer.
''Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
''CODEGEN: This method call is required by the Web Form Designer
''Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Dim ds As DataSet
Dim db As New compliance
Dim pRow As DataRow
Dim x As Integer

Dim masterDoc As WordDocument
Dim doc As WordDocument


Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

Session("PageURL") = Request.RawUrl.ToString

ds = db.BusinessReportList(CInt(Convert.ToString(Session("code"))))
masterDoc = New WordDocument

x = 0
For x = 0 To ds.Tables("process").Rows.Count - 1
doc = New WordDocument
doc.Open(Server.MapPath("reports/BusinessUnit.doc"), FormatType.Doc)
pRow = ds.Tables("process").Rows(x)
doc.MailMerge.ExecuteGroup(db.BusinessReportProcessDetails(Trim(pRow.Item(0))))
doc.MailMerge.ExecuteGroup(db.BusinessReportControls(Trim(pRow.Item(0))))
AppendDoc(doc)
x += 1
Next

masterDoc.Save("Business Unit.doc", FormatType.Doc, Response, HttpContentDisposition.InBrowser)
End Sub
Private Sub AppendDoc(ByVal dstDoc As WordDocument)
Dim secs As IWSectionCollection = dstDoc.Sections
Dim sec As IWSection
For Each sec In secs
masterDoc.Sections.Add(sec.Clone(masterDoc))
dstDoc.LastSection.BreakCode = sec.BreakCode
Next
End Sub

End Class

>Hi James,

Thank you for your interest in Syncfusion Essential DocIO.

1. I am not sure if I understand your requirement is correct. However I have created a sample which gets the sales invoice records from Northwind table and store it into the single master document. Could you please take a look for the attached sample and let me know if it meets your need.

2. Currently we do not have a support for drawing shapes and forms. However we are working with these features and I will update you as soon as the features gets implemented.

Thanks,
Prabhu.



>Hello

I am trying to use this to perform a Mail Merge. It similar to the Invoice sample, but has multiple entries (Master / Child relationship).
I cannot get the thing to work in anyway shape or form.
Do you have any samples that show how to do this?

Regards
James

Sales_Invoice.zip

Prabhu P [Syncfusion]
Replied On August 14, 2006 09:27 PM

Hi James,

Sorry for delay in getting back to you.

Thanks for the code snippet. I was not able to reproduce this issue. I put together a small web sample to reproduce this issue. I have compiled this sample in v4.2.0.37. It works fine for me.

Could you please try to run the attached sample and let me know if the problem is still persisting.

Thanks,
Prabhu.



Mailmerge_Invoice_VB.zip

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;