473,608 Members | 2,592 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Problem with Open Save dialog and excel

Hi,

I have an aspx page which generates an excel document and transfers it to
the browser as attachment. Normally, once the document is transferred the
open save dialog prompts to open or save the excel document. When I click
save I can save the excel document or when I click open it directly opens in
excel. This works fine for all but one machine.

On one machine however the dialog prompts to open or save the excel document
(e.g. myexcel.xls) but when I click save, the filename textbox contains the
name of the page (mypage.aspx) instead of the excel document. When I save
now the document, not the excel document but really the page's html is saved
on disk.

All machines are set up with

Windows 2000 SP2
Excel 9.0.3821 SR-1 (Excel 2000)
Internet Explorer 6.0.2800.1106CO

Can somebody help?

Kind regards,
Michael
Feb 15 '06 #1
6 2690
What is the other machines excel version?

"Michael Groeger" <go*********@we b.de>, haber iletisinde şunları
yazdı:un******* *******@tk2msft ngp13.phx.gbl.. .
Hi,

I have an aspx page which generates an excel document and transfers it to
the browser as attachment. Normally, once the document is transferred the
open save dialog prompts to open or save the excel document. When I click
save I can save the excel document or when I click open it directly opens
in
excel. This works fine for all but one machine.

On one machine however the dialog prompts to open or save the excel
document
(e.g. myexcel.xls) but when I click save, the filename textbox contains
the
name of the page (mypage.aspx) instead of the excel document. When I save
now the document, not the excel document but really the page's html is
saved
on disk.

All machines are set up with

Windows 2000 SP2
Excel 9.0.3821 SR-1 (Excel 2000)
Internet Explorer 6.0.2800.1106CO

Can somebody help?

Kind regards,
Michael

Feb 15 '06 #2
They are all the same as stated below.

"Alper OZGUR" <al******@gmail .com> schrieb im Newsbeitrag
news:OF******** ******@TK2MSFTN GP10.phx.gbl...
What is the other machines excel version?

"Michael Groeger" <go*********@we b.de>, haber iletisinde şunları
yazdı:un******* *******@tk2msft ngp13.phx.gbl.. .
Hi,

I have an aspx page which generates an excel document and transfers it to the browser as attachment. Normally, once the document is transferred the open save dialog prompts to open or save the excel document. When I click save I can save the excel document or when I click open it directly opens in
excel. This works fine for all but one machine.

On one machine however the dialog prompts to open or save the excel
document
(e.g. myexcel.xls) but when I click save, the filename textbox contains
the
name of the page (mypage.aspx) instead of the excel document. When I save now the document, not the excel document but really the page's html is
saved
on disk.

All machines are set up with

Windows 2000 SP2
Excel 9.0.3821 SR-1 (Excel 2000)
Internet Explorer 6.0.2800.1106CO

Can somebody help?

Kind regards,
Michael


Feb 15 '06 #3
I had the same problem and changed the code as belows. This had solved my
problem...

I hope it helps...

Response.Clear( )

Response.Charse t = ""

Response.Conten tType = "applicatio n/vnd.ms-excel"

Dim stringWrite As New System.IO.Strin gWriter

Dim htmlWrite As New System.Web.UI.H tmlTextWriter(s tringWrite)

Dim dg As New DataGrid

dg.DataSource = dsExp.Tables(0) ' dsExp is the dataset

dg.DataBind()

dg.GridLines = GridLines.Both

dg.HeaderStyle. Font.Bold = True

dg.DataBind()

Dim Img As New System.Web.UI.W ebControls.Imag e

Img.ImageUrl = "images/reportlogo.jpg"

Img.RenderContr ol(htmlWrite)

dg.RenderContro l(htmlWrite)

Response.Write( "<html><head><M ETA HTTP-EQUIV=""Content-Type""
CONTENT=""text/html; charset=utf-8""></head><body>" & stringWrite.ToS tring &
"</html></body>")

Response.End()

"Michael Groeger" <go*********@we b.de>, haber iletisinde şunları
yazdı:uT******* ******@TK2MSFTN GP11.phx.gbl...
They are all the same as stated below.

"Alper OZGUR" <al******@gmail .com> schrieb im Newsbeitrag
news:OF******** ******@TK2MSFTN GP10.phx.gbl...
What is the other machines excel version?

"Michael Groeger" <go*********@we b.de>, haber iletisinde şunları
yazdı:un******* *******@tk2msft ngp13.phx.gbl.. .
> Hi,
>
> I have an aspx page which generates an excel document and transfers it to > the browser as attachment. Normally, once the document is transferred the > open save dialog prompts to open or save the excel document. When I click > save I can save the excel document or when I click open it directly opens > in
> excel. This works fine for all but one machine.
>
> On one machine however the dialog prompts to open or save the excel
> document
> (e.g. myexcel.xls) but when I click save, the filename textbox contains
> the
> name of the page (mypage.aspx) instead of the excel document. When I save > now the document, not the excel document but really the page's html is
> saved
> on disk.
>
> All machines are set up with
>
> Windows 2000 SP2
> Excel 9.0.3821 SR-1 (Excel 2000)
> Internet Explorer 6.0.2800.1106CO
>
> Can somebody help?
>
> Kind regards,
> Michael
>
>



Feb 15 '06 #4
I suspect you're missing one of these key lines of code:
Response.Clear( )

Response.Conten tType = "applicatio n/ms-excel"

Response.AddHea der("Content-Disposition", _
"inline;filenam e=test.xls")

I've outlined all the necessary steps to do a proper Excel export here:
http://SteveOrr.net/articles/ExcelExport.aspx

--
I hope this helps,
Steve C. Orr
MCSD, MVP
http://SteveOrr.net

"Michael Groeger" wrote:
Hi,

I have an aspx page which generates an excel document and transfers it to
the browser as attachment. Normally, once the document is transferred the
open save dialog prompts to open or save the excel document. When I click
save I can save the excel document or when I click open it directly opens in
excel. This works fine for all but one machine.

On one machine however the dialog prompts to open or save the excel document
(e.g. myexcel.xls) but when I click save, the filename textbox contains the
name of the page (mypage.aspx) instead of the excel document. When I save
now the document, not the excel document but really the page's html is saved
on disk.

All machines are set up with

Windows 2000 SP2
Excel 9.0.3821 SR-1 (Excel 2000)
Internet Explorer 6.0.2800.1106CO

Can somebody help?

Kind regards,
Michael

Feb 15 '06 #5
Hi Steve,

the excel generation and the transfer to the client is done by a third party
tool (Aspose.Excel). I think the content - type is set to ms-excel, but i am
not quite sure. As the problem happens only on one machine I think it has
something to do with machine settings rather than with coding.

Regards,
Michael

"Steve C. Orr" <St***@Orr.ne t> schrieb im Newsbeitrag
news:84******** *************** ***********@mic rosoft.com...
I suspect you're missing one of these key lines of code:
Response.Clear( )

Response.Conten tType = "applicatio n/ms-excel"

Response.AddHea der("Content-Disposition", _
"inline;filenam e=test.xls")

I've outlined all the necessary steps to do a proper Excel export here:
http://SteveOrr.net/articles/ExcelExport.aspx

--
I hope this helps,
Steve C. Orr
MCSD, MVP
http://SteveOrr.net

"Michael Groeger" wrote:
Hi,

I have an aspx page which generates an excel document and transfers it to the browser as attachment. Normally, once the document is transferred the open save dialog prompts to open or save the excel document. When I click save I can save the excel document or when I click open it directly opens in excel. This works fine for all but one machine.

On one machine however the dialog prompts to open or save the excel document (e.g. myexcel.xls) but when I click save, the filename textbox contains the name of the page (mypage.aspx) instead of the excel document. When I save now the document, not the excel document but really the page's html is saved on disk.

All machines are set up with

Windows 2000 SP2
Excel 9.0.3821 SR-1 (Excel 2000)
Internet Explorer 6.0.2800.1106CO

Can somebody help?

Kind regards,
Michael

Feb 16 '06 #6
That's all done by a third party tool (Aspose.Excel) so I can't do that.
"Alper OZGUR" <al******@gmail .com> schrieb im Newsbeitrag
news:ew******** ******@TK2MSFTN GP15.phx.gbl...
I had the same problem and changed the code as belows. This had solved my
problem...

I hope it helps...

Response.Clear( )

Response.Charse t = ""

Response.Conten tType = "applicatio n/vnd.ms-excel"

Dim stringWrite As New System.IO.Strin gWriter

Dim htmlWrite As New System.Web.UI.H tmlTextWriter(s tringWrite)

Dim dg As New DataGrid

dg.DataSource = dsExp.Tables(0) ' dsExp is the dataset

dg.DataBind()

dg.GridLines = GridLines.Both

dg.HeaderStyle. Font.Bold = True

dg.DataBind()

Dim Img As New System.Web.UI.W ebControls.Imag e

Img.ImageUrl = "images/reportlogo.jpg"

Img.RenderContr ol(htmlWrite)

dg.RenderContro l(htmlWrite)

Response.Write( "<html><head><M ETA HTTP-EQUIV=""Content-Type""
CONTENT=""text/html; charset=utf-8""></head><body>" & stringWrite.ToS tring & "</html></body>")

Response.End()

"Michael Groeger" <go*********@we b.de>, haber iletisinde şunları
yazdı:uT******* ******@TK2MSFTN GP11.phx.gbl...
They are all the same as stated below.

"Alper OZGUR" <al******@gmail .com> schrieb im Newsbeitrag
news:OF******** ******@TK2MSFTN GP10.phx.gbl...
What is the other machines excel version?

"Michael Groeger" <go*********@we b.de>, haber iletisinde şunları
yazdı:un******* *******@tk2msft ngp13.phx.gbl.. .
> Hi,
>
> I have an aspx page which generates an excel document and transfers it
to
> the browser as attachment. Normally, once the document is transferred

the
> open save dialog prompts to open or save the excel document. When I

click
> save I can save the excel document or when I click open it directly

opens
> in
> excel. This works fine for all but one machine.
>
> On one machine however the dialog prompts to open or save the excel
> document
> (e.g. myexcel.xls) but when I click save, the filename textbox

contains > the
> name of the page (mypage.aspx) instead of the excel document. When I

save
> now the document, not the excel document but really the page's html is > saved
> on disk.
>
> All machines are set up with
>
> Windows 2000 SP2
> Excel 9.0.3821 SR-1 (Excel 2000)
> Internet Explorer 6.0.2800.1106CO
>
> Can somebody help?
>
> Kind regards,
> Michael
>
>



Feb 16 '06 #7

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

Similar topics

0
3757
by: eddie wang | last post by:
Excel open automatically without giving a dialog box option to Open/Save/Cancel using filesys.createTextFile. How to pop up the dialog box option to Open/Save/Cancel? Thanks.
4
5093
by: John | last post by:
Hi, I generate a report in a comma delimited file and give it a name like MyReport.csv . I then set a Hyperlink control to point tp the file HyperLink1.text = "Download" Hyperlink1.NavigateUrl = "MyReport.csv" When the user clicks the HyperLink I would always like to
0
1173
by: Ramjee Tanguturi | last post by:
Hi, I face this peculiar problem. I have an export to excel functionality in my ASP.NET application. I set the Response.ContentType and Content Disposition properties of the page as Page.Response.ContentType="application/vnd.ms-excel"; Page.Response.AddHeader("Content-Disposition", "filename=Results.xls");
2
2471
by: Steve Chatham | last post by:
I use the following code: Private Sub RbtnExport_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RbtnExport.SelectedIndexChanged Dim sFile As String = Session("User") & "-Customer List-" & Today() sFile = sFile.Replace("/", "") RbtnExport.Visible = False Select Case RbtnExport.SelectedItem.Value Case "Excel" Response.ContentType = "application/x-msexcel"
4
3671
by: Dorte | last post by:
Hi, I am using the code below to stream a CSV file with the response object. Dim FileName As String = "Test.csv" With Web.HttpContext.Current.Response Web.HttpContext.Current.Response.AddHeader("content-disposition", "attachment; filename=" & FileName) .Charset = ""
1
3695
by: Bon | last post by:
Hello all I create a form with three buttons in MS Access 2000. They are Open Excel Template, Save Draft and Save Final. When I click the Open Excel Template button, the Excel template will be opened. Inside the Excel template, I have assigned a draft watermark to the Print icon. When the Print icon is clicked, the draft watermark and print dialog box is shown. After the user print/edit data in the Excel template, s/he has to click
0
1704
by: Jonathan | last post by:
Hi everyone, I'm having an issue with my Excel streaming. I run my procedure and if I "Save As" when the dialog opens and then open the file I generate, it's perfect. Also, if I choose "Open" when Excel is already running, it's perfect. If I click "Open" but Excel isn't running, I get an error message: 'C:\...snip...\Temporary Internet Files\Content.IE5\CPW1639P\export090220061230 .xls' could not be found. Check the spelling of the file...
0
1355
by: chandan | last post by:
Hi, I have written an application for exporting grid data to excel using asp.net and c#.After writting the data in excel I save it in a folder inside my application.After that I invoke the file download dialog it prompt with open/save/cancel button.This dialog takes the path of saved excel file that was inside my application.When I clik on the open button It opens the two copy of same excel file? I am not able to fine why it opens two...
1
2428
navanova
by: navanova | last post by:
Greetings, I have a problem of opening ms word and excel files on my computer. The files are there for a long time. I use to open and modify them. Suddenly, when i try to open the word files, a dialog box appears that says "There was an error opening the file". when i try to open the excel files, a dialog box appears that says "File format not valid". I have tried to create a new word and excel files, save them and when i try to open these...
0
8057
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8491
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8470
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8142
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6010
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5475
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
3959
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
2472
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
1327
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.