Problem with Open Save dialog and excel

Discussion in 'ASP .Net' started by Michael Groeger, Feb 15, 2006.

  1. 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
    Michael Groeger, Feb 15, 2006
    #1
    1. Advertising

  2. Michael Groeger

    Alper OZGUR Guest

    What is the other machines excel version?

    "Michael Groeger" <>, haber iletisinde þunlarý
    yazdý:...
    > 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
    >
    >
    Alper OZGUR, Feb 15, 2006
    #2
    1. Advertising

  3. They are all the same as stated below.

    "Alper OZGUR" <> schrieb im Newsbeitrag
    news:OF$...
    > What is the other machines excel version?
    >
    > "Michael Groeger" <>, haber iletisinde þunlarý
    > yazdý:...
    > > 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
    > >
    > >

    >
    >
    Michael Groeger, Feb 15, 2006
    #3
  4. Michael Groeger

    Alper OZGUR Guest

    I had the same problem and changed the code as belows. This had solved my
    problem...

    I hope it helps...

    Response.Clear()

    Response.Charset = ""

    Response.ContentType = "application/vnd.ms-excel"

    Dim stringWrite As New System.IO.StringWriter

    Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)

    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.WebControls.Image

    Img.ImageUrl = "images/reportlogo.jpg"

    Img.RenderControl(htmlWrite)

    dg.RenderControl(htmlWrite)

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

    Response.End()

    "Michael Groeger" <>, haber iletisinde þunlarý
    yazdý:...
    > They are all the same as stated below.
    >
    > "Alper OZGUR" <> schrieb im Newsbeitrag
    > news:OF$...
    >> What is the other machines excel version?
    >>
    >> "Michael Groeger" <>, haber iletisinde þunlarý
    >> yazdý:...
    >> > 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
    >> >
    >> >

    >>
    >>

    >
    >
    Alper OZGUR, Feb 15, 2006
    #4
  5. I suspect you're missing one of these key lines of code:
    Response.Clear()

    Response.ContentType = "application/ms-excel"

    Response.AddHeader("Content-Disposition", _
    "inline;filename=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
    >
    >
    >
    =?Utf-8?B?U3RldmUgQy4gT3Jy?=, Feb 15, 2006
    #5
  6. 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" <> schrieb im Newsbeitrag
    news:...
    > I suspect you're missing one of these key lines of code:
    > Response.Clear()
    >
    > Response.ContentType = "application/ms-excel"
    >
    > Response.AddHeader("Content-Disposition", _
    > "inline;filename=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
    > >
    > >
    > >
    Michael Groeger, Feb 16, 2006
    #6
  7. That's all done by a third party tool (Aspose.Excel) so I can't do that.


    "Alper OZGUR" <> schrieb im Newsbeitrag
    news:...
    > I had the same problem and changed the code as belows. This had solved my
    > problem...
    >
    > I hope it helps...
    >
    > Response.Clear()
    >
    > Response.Charset = ""
    >
    > Response.ContentType = "application/vnd.ms-excel"
    >
    > Dim stringWrite As New System.IO.StringWriter
    >
    > Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWrite)
    >
    > 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.WebControls.Image
    >
    > Img.ImageUrl = "images/reportlogo.jpg"
    >
    > Img.RenderControl(htmlWrite)
    >
    > dg.RenderControl(htmlWrite)
    >
    > Response.Write("<html><head><META HTTP-EQUIV=""Content-Type""
    > CONTENT=""text/html; charset=utf-8""></head><body>" & stringWrite.ToString

    &
    > "</html></body>")
    >
    > Response.End()
    >
    > "Michael Groeger" <>, haber iletisinde þunlarý
    > yazdý:...
    > > They are all the same as stated below.
    > >
    > > "Alper OZGUR" <> schrieb im Newsbeitrag
    > > news:OF$...
    > >> What is the other machines excel version?
    > >>
    > >> "Michael Groeger" <>, haber iletisinde þunlarý
    > >> yazdý:...
    > >> > 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
    > >> >
    > >> >
    > >>
    > >>

    > >
    > >

    >
    >
    Michael Groeger, Feb 16, 2006
    #7
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Steve West

    open/save dialog cgi problem

    Steve West, Oct 4, 2005, in forum: HTML
    Replies:
    1
    Views:
    491
    Neredbojias
    Oct 4, 2005
  2. BusyBoy
    Replies:
    2
    Views:
    600
    =?Utf-8?B?TGVvbiBNYXluZQ==?=
    Oct 31, 2006
  3. hell2heaven
    Replies:
    0
    Views:
    413
    hell2heaven
    Oct 26, 2008
  4. eddie wang
    Replies:
    0
    Views:
    405
    eddie wang
    Oct 3, 2003
  5. Shalom
    Replies:
    3
    Views:
    164
    s_m_b
    May 29, 2008
Loading...

Share This Page