By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,759 Members | 1,236 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,759 IT Pros & Developers. It's quick & easy.

doubt anyone knows the solution to this!

P: n/a
working on a difficult problem, using crystal reports and when the report is
exported for the file save it uses the name of the webform that the control
is on, like default.aspx, but without the aspx. Anyway just wondering if
there is a way to dymanically change the name of the form, for example to put
the current date in it like (report022007).
--
Paul G
Software engineer.
Feb 5 '07 #1
Share this Question
Share on Google+
5 Replies


P: n/a
hi paul,
yes but you're talking to the entire internet so someone is bound to have
found the problem before :)

in your case, i am guessing that you are exporting a crystal report to PDF
and sending it to the HttpResponse on the fly, with 'inline' instead of
'attachment', so that it will open in the browser window rather than forced
download.
if this is true, then have a read of this discussion, which has an
explanation and workaround for the way browsers embed PDF documents.
http://groups.google.com/group/micro...1d4263?lnk=gst

let me know if this doesn't match your situation, and post some code too so
we can see if there is something else you might be doing wrong.

good luck
tim

"Paul" <Pa**@discussions.microsoft.comwrote in message
news:FA**********************************@microsof t.com...
working on a difficult problem, using crystal reports and when the report
is
exported for the file save it uses the name of the webform that the
control
is on, like default.aspx, but without the aspx. Anyway just wondering if
there is a way to dymanically change the name of the form, for example to
put
the current date in it like (report022007).
--
Paul G
Software engineer.
Feb 6 '07 #2

P: n/a
Hi Tim, thanks for the response. What you have assumed is correct, what I am
trying to do. I will take a look at the reference you provided, thanks.
--
Paul G
Software engineer.
"Tim Mackey" wrote:
hi paul,
yes but you're talking to the entire internet so someone is bound to have
found the problem before :)

in your case, i am guessing that you are exporting a crystal report to PDF
and sending it to the HttpResponse on the fly, with 'inline' instead of
'attachment', so that it will open in the browser window rather than forced
download.
if this is true, then have a read of this discussion, which has an
explanation and workaround for the way browsers embed PDF documents.
http://groups.google.com/group/micro...1d4263?lnk=gst

let me know if this doesn't match your situation, and post some code too so
we can see if there is something else you might be doing wrong.

good luck
tim

"Paul" <Pa**@discussions.microsoft.comwrote in message
news:FA**********************************@microsof t.com...
working on a difficult problem, using crystal reports and when the report
is
exported for the file save it uses the name of the webform that the
control
is on, like default.aspx, but without the aspx. Anyway just wondering if
there is a way to dymanically change the name of the form, for example to
put
the current date in it like (report022007).
--
Paul G
Software engineer.
Feb 6 '07 #3

P: n/a
Hi Tim, just had a quick question. Do you think I should try what is below,
also not quite sure how to
do this since, do you have to write code to save it to the server. Plus the
response redirect have to
occure in the export button callback, which I do not think we can access since
it is a crystal report form that comes up.
Suggestion__ save the PDF file to a temp
folder within the web site, and just do a Response.Redirect to the pdf file.
it displays inline, and it will retain the correct filename. i run a script
every night on the server to clear out the temp folder
Thanks again, Paul.
--
Paul G
Software engineer.
"Tim Mackey" wrote:
hi paul,
yes but you're talking to the entire internet so someone is bound to have
found the problem before :)

in your case, i am guessing that you are exporting a crystal report to PDF
and sending it to the HttpResponse on the fly, with 'inline' instead of
'attachment', so that it will open in the browser window rather than forced
download.
if this is true, then have a read of this discussion, which has an
explanation and workaround for the way browsers embed PDF documents.
http://groups.google.com/group/micro...1d4263?lnk=gst

let me know if this doesn't match your situation, and post some code too so
we can see if there is something else you might be doing wrong.

good luck
tim

"Paul" <Pa**@discussions.microsoft.comwrote in message
news:FA**********************************@microsof t.com...
working on a difficult problem, using crystal reports and when the report
is
exported for the file save it uses the name of the webform that the
control
is on, like default.aspx, but without the aspx. Anyway just wondering if
there is a way to dymanically change the name of the form, for example to
put
the current date in it like (report022007).
--
Paul G
Software engineer.
Feb 6 '07 #4

P: n/a
hi paul,
i guess you're using the crystal report viewer web control. in my case i
was writing the code in a regular Button_Click event handler so i had no
trouble with that. i haven't used the CR viewer web control so i'm not sure
what's possible.

here is the code i used anyway:
crUnassigned_Audits rpt = new crUnassigned_Audits();
.... databind the report ...
string RelPath = String.Format("../Tmp/Unassigned_Audits_{0}.pdf",
Guid.NewGuid().Value);
rpt.ExportToDisk(ExportFormatType.PortableDocForma t,
Server.MapPath(RelPath));
rpt.Close();
Response.Redirect(RelPath, true);

hope it helps. you may be able to override the export button click event
handler, if you wrote a new control based on the CR control, then you could
use the code above to redirect the user to the report, and keep the file
name for saving etc.

tim

"Paul" <Pa**@discussions.microsoft.comwrote in message
news:29**********************************@microsof t.com...
Hi Tim, just had a quick question. Do you think I should try what is
below,
also not quite sure how to
do this since, do you have to write code to save it to the server. Plus
the
response redirect have to
occure in the export button callback, which I do not think we can access
since
it is a crystal report form that comes up.
Suggestion__ save the PDF file to a temp
folder within the web site, and just do a Response.Redirect to the pdf
file.
it displays inline, and it will retain the correct filename. i run a
script
every night on the server to clear out the temp folder
Thanks again, Paul.
--
Paul G
Software engineer.
"Tim Mackey" wrote:
>hi paul,
yes but you're talking to the entire internet so someone is bound to have
found the problem before :)

in your case, i am guessing that you are exporting a crystal report to
PDF
and sending it to the HttpResponse on the fly, with 'inline' instead of
'attachment', so that it will open in the browser window rather than
forced
download.
if this is true, then have a read of this discussion, which has an
explanation and workaround for the way browsers embed PDF documents.
http://groups.google.com/group/micro...1d4263?lnk=gst

let me know if this doesn't match your situation, and post some code too
so
we can see if there is something else you might be doing wrong.

good luck
tim

"Paul" <Pa**@discussions.microsoft.comwrote in message
news:FA**********************************@microso ft.com...
working on a difficult problem, using crystal reports and when the
report
is
exported for the file save it uses the name of the webform that the
control
is on, like default.aspx, but without the aspx. Anyway just wondering
if
there is a way to dymanically change the name of the form, for example
to
put
the current date in it like (report022007).
--
Paul G
Software engineer.
Feb 6 '07 #5

P: n/a
Hi Tim thanks for the additional information. I thought that you had to use
the crystal
report viewer web control to display a crystal report on a webform
but looks like that may not be the case. I will try something
like what you have provided when I get time.
--
Paul G
Software engineer.
"Tim Mackey" wrote:
hi paul,
i guess you're using the crystal report viewer web control. in my case i
was writing the code in a regular Button_Click event handler so i had no
trouble with that. i haven't used the CR viewer web control so i'm not sure
what's possible.

here is the code i used anyway:
crUnassigned_Audits rpt = new crUnassigned_Audits();
... databind the report ...
string RelPath = String.Format("../Tmp/Unassigned_Audits_{0}.pdf",
Guid.NewGuid().Value);
rpt.ExportToDisk(ExportFormatType.PortableDocForma t,
Server.MapPath(RelPath));
rpt.Close();
Response.Redirect(RelPath, true);

hope it helps. you may be able to override the export button click event
handler, if you wrote a new control based on the CR control, then you could
use the code above to redirect the user to the report, and keep the file
name for saving etc.

tim

"Paul" <Pa**@discussions.microsoft.comwrote in message
news:29**********************************@microsof t.com...
Hi Tim, just had a quick question. Do you think I should try what is
below,
also not quite sure how to
do this since, do you have to write code to save it to the server. Plus
the
response redirect have to
occure in the export button callback, which I do not think we can access
since
it is a crystal report form that comes up.
Suggestion__ save the PDF file to a temp
folder within the web site, and just do a Response.Redirect to the pdf
file.
it displays inline, and it will retain the correct filename. i run a
script
every night on the server to clear out the temp folder
Thanks again, Paul.
--
Paul G
Software engineer.
"Tim Mackey" wrote:
hi paul,
yes but you're talking to the entire internet so someone is bound to have
found the problem before :)

in your case, i am guessing that you are exporting a crystal report to
PDF
and sending it to the HttpResponse on the fly, with 'inline' instead of
'attachment', so that it will open in the browser window rather than
forced
download.
if this is true, then have a read of this discussion, which has an
explanation and workaround for the way browsers embed PDF documents.
http://groups.google.com/group/micro...1d4263?lnk=gst

let me know if this doesn't match your situation, and post some code too
so
we can see if there is something else you might be doing wrong.

good luck
tim

"Paul" <Pa**@discussions.microsoft.comwrote in message
news:FA**********************************@microsof t.com...
working on a difficult problem, using crystal reports and when the
report
is
exported for the file save it uses the name of the webform that the
control
is on, like default.aspx, but without the aspx. Anyway just wondering
if
there is a way to dymanically change the name of the form, for example
to
put
the current date in it like (report022007).
--
Paul G
Software engineer.
Feb 7 '07 #6

This discussion thread is closed

Replies have been disabled for this discussion.