Add a reference to CrystalDecisions in your solution and try this. The
problem is that you have to convert it to binary instead of HTML.
MemoryStream oStream=null;
oStream = (MemoryStream)
cryReport.ExportToStream(
CrystalDecisions.Shared.ExportFormatType.PortableDocFormat);
Response.Clear();
Response.Buffer= true;
Response.ContentType = "application/pdf";
Response.BinaryWrite(oStream.ToArray());
Response.End();
oStream.Close();
On 8/31/05, Krunal Chaklasia <[EMAIL PROTECTED]> wrote:
>
> Hi, Ryan
>
> I have tried below code, which successfuly saves myfile.pdf file, but when
> i am trying to open that myfile.pdf file, its gives me error that "you
> can't open. This pdf file is not decoded correctly".
>
> This is code i have tried, Please look at this if you get any idea,
>
>
> Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles Button2.Click
>
> Response.Clear()
>
> Response.AddHeader("content-disposition", "attachment;filename=myfile.pdf
> ")
>
> Response.Charset = ""
>
> Response.Cache.SetCacheability(HttpCacheability.NoCache)
>
> Response.ContentType = "application/pdf"
>
> Dim stringWrite As New System.IO.StringWriter
>
> Dim htmlWrite As New HtmlTextWriter(stringWrite)
>
> myDataGrid.RenderControl(htmlWrite)
>
> Response.Write(stringWrite.ToString())
>
> Response.End()
>
> End Sub
>
>
>
> Regards,
> Krunal
>
>
> Ryan Olshan <[EMAIL PROTECTED]> wrote:
> What if you change the stream type to *application/pdf*?
> Ryan
>
> On 8/31/05, Krunal Chaklasia wrote:
> >
> > Hello GroupMembers,
> >
> > I want to export datagrid to PDF file, i got success export to Excel
> file
> > but didn't find any solutions to export to PDF File.
> >
> > Anybody have any idea, then please reply me. Anytype of help will useful
>
> > for me.
> >
> > Thank You,
> >
> > Regards,
> > Krunal Chaklasia
> >
> >
> >
> >
> >
> > __________________________________________________
> > Do You Yahoo!?
> > Tired of spam? Yahoo! Mail has the best spam protection around
> > http://mail.yahoo.com
> >
> > [Non-text portions of this message have been removed]
> >
> >
> >
> > SPONSORED LINKS
> > Basic programming language Computer
> > programming languages Programming
> > languages Java
> > programming language The
> > history of computer programming language
> > ------------------------------
> > YAHOO! GROUPS LINKS
> >
> >
> > - Visit your group "AspNetAnyQuestionIsOk"
> > on the web.
> > - To unsubscribe from this group, send an email to:
> > [EMAIL PROTECTED]
> > - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> > Service .
> >
> >
> > ------------------------------
> >
>
>
>
> --
> Thank you,
> Ryan Olshan
>
> TeraNet Systems
> http://www.teranetsystems.com
>
> --------Internet E-Mail Confidentiality Statement--------
> The content of and attachment(s) to this electronic transmission contains
> information from TeraNet Systems and is intended for the use of the
> person,
> firm or entity to which it is directed herein, and may contain information
>
> that is private, confidential, exempt from disclosure under applicable
> law,
> and/or proprietary to TeraNet Systems and is protected by law. If you are
> not the intended recipient, or the employee or agent responsible for
> delivering this message to the intended recipient, any dissemination,
> distribution or copying of this communication is strictly prohibited. If
> you
> have received this message in error, please notify the sender,
> [EMAIL PROTECTED], immediately by reply e-mail and delete the
> original
> message and any attachment(s) without reading or saving in any matter.
> Thank
> you for your cooperation.
>
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
>
> ---------------------------------
> Start your day with Yahoo! - make it your home page
>
> [Non-text portions of this message have been removed]
>
>
>
> SPONSORED LINKS
> Basic programming
> language<http://groups.yahoo.com/gads?t=ms&k=Basic+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=clJRDppRYABhs6xUhzokKw>
> Computer
> programming
> languages<http://groups.yahoo.com/gads?t=ms&k=Computer+programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=RiWZhYTiihJ1rWfeFgB2sg>
> Programming
> languages<http://groups.yahoo.com/gads?t=ms&k=Programming+languages&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=2BgLsjKfGvxPndstKBMU9g>
> Java
> programming
> language<http://groups.yahoo.com/gads?t=ms&k=Java+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=4wWSX5WKx7BCK9SrMVdrxQ>
> The
> history of computer programming
> language<http://groups.yahoo.com/gads?t=ms&k=The+history+of+computer+programming+language&w1=Basic+programming+language&w2=Computer+programming+languages&w3=Programming+languages&w4=Java+programming+language&w5=The+history+of+computer+programming+language&c=5&s=176&.sig=iNvYp6cfd9HwtDhK1iV-rg>
>
> ------------------------------
> YAHOO! GROUPS LINKS
>
>
> - Visit your group
> "AspNetAnyQuestionIsOk<http://groups.yahoo.com/group/AspNetAnyQuestionIsOk>"
> on the web.
> - To unsubscribe from this group, send an email to:
> [EMAIL PROTECTED]<[EMAIL PROTECTED]>
> - Your use of Yahoo! Groups is subject to the Yahoo! Terms of
> Service <http://docs.yahoo.com/info/terms/>.
>
>
> ------------------------------
>
--
Thank you,
Ryan Olshan
<asp:Web Programmer, Owner />
TeraNet Systems
http://www.teranetsystems.com
--------Internet E-Mail Confidentiality Statement--------
The content of and attachment(s) to this electronic transmission contains
information from TeraNet Systems and is intended for the use of the person,
firm or entity to which it is directed herein, and may contain information
that is private, confidential, exempt from disclosure under applicable law,
and/or proprietary to TeraNet Systems and is protected by law. If you are
not the intended recipient, or the employee or agent responsible for
delivering this message to the intended recipient, any dissemination,
distribution or copying of this communication is strictly prohibited. If you
have received this message in error, please notify the sender,
[EMAIL PROTECTED], immediately by reply e-mail and delete the original
message and any attachment(s) without reading or saving in any matter. Thank
you for your cooperation.
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/