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.

Trying to Stream DocIO MailMerge to Client

Thread ID:

Created:

Updated:

Platform:

Replies:

105178 Sep 14,2012 03:01 PM Sep 17,2012 02:45 AM ASP.NET Web Forms (Classic) 1
loading
Tags: DocIO
Timothy Ventura
Asked On September 14, 2012 03:01 PM

I need to stream DocIO to the client as an attachment.  Was trying to use this method:

doc.Save("certificate.doc", FormatType.Doc, HttpContext.Current.Response, HttpContentDisposition.Attachment)

but it causes an aborted thread error because it's being called from within an update panel.

Now trying to use the other overload and save to memorystream instead and the good 'ol Response.BinaryWrite(bytes) a byte array method, but it's not working.  Below is what I have, but it isn't working, although I have used this method in the past with other products with no problems.  Any help would be greatly appreciated.

 

Dim Certificates As New System.IO.MemoryStream
doc.MailMerge.ExecuteNestedGroup(_ds, _commands)
doc.Save(Certificates, FormatType.Doc)
Dim bytes = New Byte(CType(Certificates.Length, Integer)) {}
Certificates.Read(bytes, 0, CInt(Certificates.Length))

      HttpContext.Current.Response.Buffer = True
      HttpContext.Current.Response.Charset = ""
      HttpContext.Current.Response.Cache.SetCacheability(HttpCacheability.NoCache)
      HttpContext.Current.Response.ContentType = "application/ms-word"
      HttpContext.Current.Response.AddHeader("content-disposition", "attachment;filenname=certificates.doc")
      HttpContext.Current.Response.BinaryWrite(bytes)
      HttpContext.Current.Response.Flush()
      HttpContext.Current.Response.End()


Ramkumar M [Syncfusion]
Replied On September 17, 2012 02:45 AM

Hi Timothy,

Thank you for your interest in Syncfusion products.

We have created a sample to meet your requirement of stream document to client side while called from updated panel. Please find the sample from the below link and let us know if this helps you.

Sample Link:

http://www.syncfusion.com/downloads/Support/DirectTrac/98785/Sample54764073.zip

In this Sample:

We have used PostBackTrigger Class defines a control inside a UpdatePanel control as a postback control. For more information on PostBackTrigger Class please refer the below link

http://msdn.microsoft.com/en-us/library/system.web.ui.postbacktrigger.aspx

Please let us know if you have any questions.

 Regards

Ramkumar


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.

;