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