473,403 Members | 2,359 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

Name in pdf export dialog

I have code in C# to create a pdf file without a Crystal Report Viewer.
Works great except when the user attempts to save the file. In the
"Save a copy ..." dialog box the filename defaults to the aspx page. I
need it to default to a custom report name. How can I specify the new
file name in C# and pass it to the new PDF page?

Thanks,
Gary

Jan 17 '07 #1
3 2454
Hi,

What are you using to generate it but CR ?

In case you are creating a report, exporting it to disk and then serve it
back to the client you will have to modify the headers, I do not remember
right now the correct header that indicate the name of the file being serve,
but a quick search in the archives will get you it.

Btw, when I needed to do this I found the answer in the aspnet NG archive,
so that would be a good stop for you to further info.
--
Ignacio Machin
machin AT laceupsolutions com
<gl****@yahoo.comwrote in message
news:11*********************@38g2000cwa.googlegrou ps.com...
|I have code in C# to create a pdf file without a Crystal Report Viewer.
| Works great except when the user attempts to save the file. In the
| "Save a copy ..." dialog box the filename defaults to the aspx page. I
| need it to default to a custom report name. How can I specify the new
| file name in C# and pass it to the new PDF page?
|
| Thanks,
| Gary
|
Jan 17 '07 #2


<gl****@yahoo.comwrote in message
news:11*********************@38g2000cwa.googlegrou ps.com...
>I have code in C# to create a pdf file without a Crystal Report Viewer.
Works great except when the user attempts to save the file. In the
"Save a copy ..." dialog box the filename defaults to the aspx page. I
need it to default to a custom report name. How can I specify the new
file name in C# and pass it to the new PDF page?

Thanks,
Gary
Try the header content-disposition with a value of
attachment;filename=saveasfilename.pdf

so :

Response.AddHeader(
"content-disposition",
"attachment; filename=\"YourFileNameHere.pdf\""
)
HTH :)

Mythran

Jan 17 '07 #3
Yes! That worked. Thanks.

- Gary
------------------------------------------------------------------------

Mythran wrote:
<gl****@yahoo.comwrote in message
news:11*********************@38g2000cwa.googlegrou ps.com...
I have code in C# to create a pdf file without a Crystal Report Viewer.
Works great except when the user attempts to save the file. In the
"Save a copy ..." dialog box the filename defaults to the aspx page. I
need it to default to a custom report name. How can I specify the new
file name in C# and pass it to the new PDF page?

Thanks,
Gary

Try the header content-disposition with a value of
attachment;filename=saveasfilename.pdf

so :

Response.AddHeader(
"content-disposition",
"attachment; filename=\"YourFileNameHere.pdf\""
)
HTH :)

Mythran
Jan 17 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to...
7
by: Pat | last post by:
I would like to send the Print Preview of a MS Access form to a Snapshot file. The form contains an OLE graph. BACKGROUND A snapshot of a report is possible. If I could I would use a report to...
0
by: crjunk | last post by:
According to the help files: ----- Exporting Reports with the Export Button The Export button is located at the top left corner of the CrystalReportViewer toolbar. When users click the Export...
0
by: Shawn Mehaffie | last post by:
I have the following class that I've wirtten to take a Dataset and automatically export it to either XML, ASCII or Tab delimited file. The reason I wrote it they way I did was that I don't want to...
13
by: Hemant Sipahimalani | last post by:
The following piece of code is being used to export HTML to excel. HttpContext.Current.Response.ContentType = "application/vnd.ms-excel"...
0
by: Michael Fay in SB | last post by:
I built my application with Access 2003 and made a distribution using the Microsoft Office Access 2003 Developer Extensions. (I also install Jet 8 as a follow-on action at the end of the...
2
by: Amirallia | last post by:
Hello Here is nmy code to export a datagrid to csv file : For lLigne = 0 To Me.dg1.Items.Count - 1 For lColonne = 0 To Me.dg1.Items(lLigne).Cells.Count - 2 If...
1
by: sisieko | last post by:
I have an access adp (MS Access 2003) connecting to a SQL 200 server. From the adp a user generates reports and using the built-in access export wizard can export said reports (which are either...
3
by: =?Utf-8?B?TmV3YnJv?= | last post by:
Here's the long story short. At work we have to real-time generate a report(excel format) which involves a number of table joining. So to export into excel contentType 'application/vnd.ms-excel'...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.