Export to Excel (Default File Type - Excel)

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Hemant Sipahimalani

    Export to Excel (Default File Type - Excel)

    The following piece of code is being used to export HTML to excel.

    HttpContext.Cur rent.Response.C ontentType = "applicatio n/vnd.ms-excel"
    HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
    "attachment;fil ename=ABC.xls")
    HttpContext.Cur rent.Response.W rite(strHTML)
    HttpContext.Cur rent.Response.E nd()

    However when the user tries to save it the Default File Type is Web
    Page(*.htm; *.html)
    How do we change the Default File Type to Excel
  • Steve C. Orr [MVP, MCSD]

    #2
    Re: Export to Excel (Default File Type - Excel)

    Try putting a Response.Clear( ) line at the beggining of your code block.

    --
    I hope this helps,
    Steve C. Orr, MCSD, MVP



    "Hemant Sipahimalani" <Hemant Sipahimalani@di scussions.micro soft.com> wrote
    in message news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...[color=blue]
    > The following piece of code is being used to export HTML to excel.
    >
    > HttpContext.Cur rent.Response.C ontentType = "applicatio n/vnd.ms-excel"
    > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
    > "attachment;fil ename=ABC.xls")
    > HttpContext.Cur rent.Response.W rite(strHTML)
    > HttpContext.Cur rent.Response.E nd()
    >
    > However when the user tries to save it the Default File Type is Web
    > Page(*.htm; *.html)
    > How do we change the Default File Type to Excel[/color]


    Comment

    • Hemant Sipahimalani

      #3
      Re: Export to Excel (Default File Type - Excel)

      Steve,
      Thank you for the prompt reply. Response.Clear does not help though.
      Listing out the full piece of code for better clarity.

      Dim strFileName As String
      Dim strHTML As String
      Dim strAddInfo As String

      HttpContext.Cur rent.Response.C lear()
      HttpContext.Cur rent.Response.C ontentType = "applicatio n/vnd.ms-excel"
      strReportName = "EXPORT REPORT"
      strFileName = "ABC.xls"
      strAddInfo = "Additional Info"
      strHTML = GetGHTML() 'This is responsible for getting report in HTML format
      HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
      "attachment;fil ename=" & strFileName)
      HttpContext.Cur rent.Response.C harset = ""
      HttpContext.Cur rent.Response.W rite("<h4>" & strReportName & "</h4>")
      HttpContext.Cur rent.Response.W rite(strAddInfo )
      HttpContext.Cur rent.Response.W rite("<br><br>" )
      HttpContext.Cur rent.Response.W rite(strHTML)
      HttpContext.Cur rent.Response.E nd()
      Hemant
      "Steve C. Orr [MVP, MCSD]" wrote:
      [color=blue]
      > Try putting a Response.Clear( ) line at the beggining of your code block.
      >
      > --
      > I hope this helps,
      > Steve C. Orr, MCSD, MVP
      > http://SteveOrr.net
      >
      >
      > "Hemant Sipahimalani" <Hemant Sipahimalani@di scussions.micro soft.com> wrote
      > in message news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...[color=green]
      > > The following piece of code is being used to export HTML to excel.
      > >
      > > HttpContext.Cur rent.Response.C ontentType = "applicatio n/vnd.ms-excel"
      > > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
      > > "attachment;fil ename=ABC.xls")
      > > HttpContext.Cur rent.Response.W rite(strHTML)
      > > HttpContext.Cur rent.Response.E nd()
      > >
      > > However when the user tries to save it the Default File Type is Web
      > > Page(*.htm; *.html)
      > > How do we change the Default File Type to Excel[/color]
      >
      >
      >[/color]

      Comment

      • Jeff Dillon

        #4
        Re: Export to Excel (Default File Type - Excel)

        We have used this code:

        objHttpContext. Response.Clear( )
        objHttpContext. Response.Buffer = True
        objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
        objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
        objHttpContext. Response.AddHea der("Content-disposition",
        "attachment;fil ename=export.xl s")
        objHttpContext. Response.Charse t = ""

        "Hemant Sipahimalani" <Hemant Sipahimalani@di scussions.micro soft.com> wrote
        in message news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...[color=blue]
        > The following piece of code is being used to export HTML to excel.
        >
        > HttpContext.Cur rent.Response.C ontentType = "applicatio n/vnd.ms-excel"
        > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
        > "attachment;fil ename=ABC.xls")
        > HttpContext.Cur rent.Response.W rite(strHTML)
        > HttpContext.Cur rent.Response.E nd()
        >
        > However when the user tries to save it the Default File Type is Web
        > Page(*.htm; *.html)
        > How do we change the Default File Type to Excel[/color]


        Comment

        • Hemant Sipahimalani

          #5
          Re: Export to Excel (Default File Type - Excel)

          Thanks Jeff ,
          but this still does not show the default File Type as xls when the user
          tries to save the file.
          Hemant
          "Jeff Dillon" wrote:
          [color=blue]
          > We have used this code:
          >
          > objHttpContext. Response.Clear( )
          > objHttpContext. Response.Buffer = True
          > objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
          > objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
          > objHttpContext. Response.AddHea der("Content-disposition",
          > "attachment;fil ename=export.xl s")
          > objHttpContext. Response.Charse t = ""
          >
          > "Hemant Sipahimalani" <Hemant Sipahimalani@di scussions.micro soft.com> wrote
          > in message news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...[color=green]
          > > The following piece of code is being used to export HTML to excel.
          > >
          > > HttpContext.Cur rent.Response.C ontentType = "applicatio n/vnd.ms-excel"
          > > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
          > > "attachment;fil ename=ABC.xls")
          > > HttpContext.Cur rent.Response.W rite(strHTML)
          > > HttpContext.Cur rent.Response.E nd()
          > >
          > > However when the user tries to save it the Default File Type is Web
          > > Page(*.htm; *.html)
          > > How do we change the Default File Type to Excel[/color]
          >
          >
          >[/color]

          Comment

          • Jeff Dillon

            #6
            Re: Export to Excel (Default File Type - Excel)

            Well, it does for us, for every browser in the company

            Jeff
            "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com > wrote
            in message news:8B0AFB73-21B3-42E6-B9A7-87B38E1207A9@mi crosoft.com...[color=blue]
            > Thanks Jeff ,
            > but this still does not show the default File Type as xls when the user
            > tries to save the file.
            > Hemant
            > "Jeff Dillon" wrote:
            >[color=green]
            >> We have used this code:
            >>
            >> objHttpContext. Response.Clear( )
            >> objHttpContext. Response.Buffer = True
            >> objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
            >> objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
            >> objHttpContext. Response.AddHea der("Content-disposition",
            >> "attachment;fil ename=export.xl s")
            >> objHttpContext. Response.Charse t = ""
            >>
            >> "Hemant Sipahimalani" <Hemant Sipahimalani@di scussions.micro soft.com>
            >> wrote
            >> in message news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...[color=darkred]
            >> > The following piece of code is being used to export HTML to excel.
            >> >
            >> > HttpContext.Cur rent.Response.C ontentType = "applicatio n/vnd.ms-excel"
            >> > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
            >> > "attachment;fil ename=ABC.xls")
            >> > HttpContext.Cur rent.Response.W rite(strHTML)
            >> > HttpContext.Cur rent.Response.E nd()
            >> >
            >> > However when the user tries to save it the Default File Type is Web
            >> > Page(*.htm; *.html)
            >> > How do we change the Default File Type to Excel[/color]
            >>
            >>
            >>[/color][/color]


            Comment

            • Jeff Dillon

              #7
              Re: Export to Excel (Default File Type - Excel)

              Put this all by itself in test.aspx:

              <%

              Response.Clear( )
              Response.Buffer = True
              Response.Conten tType = "applicatio n/vnd.ms-excel"
              Response.AddHea der("Content-disposition", "attachment;fil ename=export.xl s")
              Response.Charse t = ""
              Response.Write( "Hello world")
              Response.End()

              %>

              "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com > wrote
              in message news:8B0AFB73-21B3-42E6-B9A7-87B38E1207A9@mi crosoft.com...[color=blue]
              > Thanks Jeff ,
              > but this still does not show the default File Type as xls when the user
              > tries to save the file.
              > Hemant
              > "Jeff Dillon" wrote:
              >[color=green]
              >> We have used this code:
              >>
              >> objHttpContext. Response.Clear( )
              >> objHttpContext. Response.Buffer = True
              >> objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
              >> objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
              >> objHttpContext. Response.AddHea der("Content-disposition",
              >> "attachment;fil ename=export.xl s")
              >> objHttpContext. Response.Charse t = ""
              >>
              >> "Hemant Sipahimalani" <Hemant Sipahimalani@di scussions.micro soft.com>
              >> wrote
              >> in message news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...[color=darkred]
              >> > The following piece of code is being used to export HTML to excel.
              >> >
              >> > HttpContext.Cur rent.Response.C ontentType = "applicatio n/vnd.ms-excel"
              >> > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
              >> > "attachment;fil ename=ABC.xls")
              >> > HttpContext.Cur rent.Response.W rite(strHTML)
              >> > HttpContext.Cur rent.Response.E nd()
              >> >
              >> > However when the user tries to save it the Default File Type is Web
              >> > Page(*.htm; *.html)
              >> > How do we change the Default File Type to Excel[/color]
              >>
              >>
              >>[/color][/color]


              Comment

              • Hemant Sipahimalani

                #8
                Re: Export to Excel (Default File Type - Excel)

                Jeff,
                You are correct. The piece of code that you have written does show the
                Exported file as "Text (tab delimited) (*.txt) " in the "Save as type"
                dropdown when the user tries to save the excel file.
                However in my case the data is in tabular format as opposed to "Hello
                World".
                The data that I am trying to export is similar to

                strHTML = "<table><tr><td >1</td><td>2</td><td>3</td></tr></table>"

                HttpContext.Cur rent.Response.C lear()
                HttpContext.Cur rent.Response.B uffer = True
                HttpContext.Cur rent.Response.C ontentType = "applicatio n/vnd.ms-excel"
                HttpContext.Cur rent.Response.A ddHeader("Conte nt-disposition",
                "attachment;fil ename=export.xl s")
                HttpContext.Cur rent.Response.C harset = ""
                HttpContext.Cur rent.Response.W rite(strHTML)
                HttpContext.Cur rent.Response.E nd()

                In this case when the user tries to save the exported excel the "Save as
                Type" drop down shows the type as a "Web Page". This is something that I am
                trying to avoid.

                Thanks,
                Hemant


                "Jeff Dillon" wrote:
                [color=blue]
                > Put this all by itself in test.aspx:
                >
                > <%
                >
                > Response.Clear( )
                > Response.Buffer = True
                > Response.Conten tType = "applicatio n/vnd.ms-excel"
                > Response.AddHea der("Content-disposition", "attachment;fil ename=export.xl s")
                > Response.Charse t = ""
                > Response.Write( "Hello world")
                > Response.End()
                >
                > %>
                >
                > "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com > wrote
                > in message news:8B0AFB73-21B3-42E6-B9A7-87B38E1207A9@mi crosoft.com...[color=green]
                > > Thanks Jeff ,
                > > but this still does not show the default File Type as xls when the user
                > > tries to save the file.
                > > Hemant
                > > "Jeff Dillon" wrote:
                > >[color=darkred]
                > >> We have used this code:
                > >>
                > >> objHttpContext. Response.Clear( )
                > >> objHttpContext. Response.Buffer = True
                > >> objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
                > >> objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
                > >> objHttpContext. Response.AddHea der("Content-disposition",
                > >> "attachment;fil ename=export.xl s")
                > >> objHttpContext. Response.Charse t = ""
                > >>
                > >> "Hemant Sipahimalani" <Hemant Sipahimalani@di scussions.micro soft.com>
                > >> wrote
                > >> in message news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...
                > >> > The following piece of code is being used to export HTML to excel.
                > >> >
                > >> > HttpContext.Cur rent.Response.C ontentType = "applicatio n/vnd.ms-excel"
                > >> > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
                > >> > "attachment;fil ename=ABC.xls")
                > >> > HttpContext.Cur rent.Response.W rite(strHTML)
                > >> > HttpContext.Cur rent.Response.E nd()
                > >> >
                > >> > However when the user tries to save it the Default File Type is Web
                > >> > Page(*.htm; *.html)
                > >> > How do we change the Default File Type to Excel
                > >>
                > >>
                > >>[/color][/color]
                >
                >
                >[/color]

                Comment

                • Jeff Dillon

                  #9
                  Re: Export to Excel (Default File Type - Excel)

                  On ALL our machines, my code shows Save As Excel Sheet in the Save As dialog
                  popup.

                  Do you have Excel installed on your client machines?? Which is a requirement
                  of course, to save in that format.

                  Jeff

                  "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com > wrote
                  in message news:E926C9C0-B95A-4D9D-9070-62261393E930@mi crosoft.com...[color=blue]
                  > Jeff,
                  > You are correct. The piece of code that you have written does show the
                  > Exported file as "Text (tab delimited) (*.txt) " in the "Save as type"
                  > dropdown when the user tries to save the excel file.
                  > However in my case the data is in tabular format as opposed to "Hello
                  > World".
                  > The data that I am trying to export is similar to
                  >
                  > strHTML = "<table><tr><td >1</td><td>2</td><td>3</td></tr></table>"
                  >
                  > HttpContext.Cur rent.Response.C lear()
                  > HttpContext.Cur rent.Response.B uffer = True
                  > HttpContext.Cur rent.Response.C ontentType =
                  > "applicatio n/vnd.ms-excel"
                  > HttpContext.Cur rent.Response.A ddHeader("Conte nt-disposition",
                  > "attachment;fil ename=export.xl s")
                  > HttpContext.Cur rent.Response.C harset = ""
                  > HttpContext.Cur rent.Response.W rite(strHTML)
                  > HttpContext.Cur rent.Response.E nd()
                  >
                  > In this case when the user tries to save the exported excel the "Save as
                  > Type" drop down shows the type as a "Web Page". This is something that I
                  > am
                  > trying to avoid.
                  >
                  > Thanks,
                  > Hemant
                  >
                  >
                  > "Jeff Dillon" wrote:
                  >[color=green]
                  >> Put this all by itself in test.aspx:
                  >>
                  >> <%
                  >>
                  >> Response.Clear( )
                  >> Response.Buffer = True
                  >> Response.Conten tType = "applicatio n/vnd.ms-excel"
                  >> Response.AddHea der("Content-disposition",
                  >> "attachment;fil ename=export.xl s")
                  >> Response.Charse t = ""
                  >> Response.Write( "Hello world")
                  >> Response.End()
                  >>
                  >> %>
                  >>
                  >> "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com >
                  >> wrote
                  >> in message news:8B0AFB73-21B3-42E6-B9A7-87B38E1207A9@mi crosoft.com...[color=darkred]
                  >> > Thanks Jeff ,
                  >> > but this still does not show the default File Type as xls when the
                  >> > user
                  >> > tries to save the file.
                  >> > Hemant
                  >> > "Jeff Dillon" wrote:
                  >> >
                  >> >> We have used this code:
                  >> >>
                  >> >> objHttpContext. Response.Clear( )
                  >> >> objHttpContext. Response.Buffer = True
                  >> >> objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
                  >> >> objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
                  >> >> objHttpContext. Response.AddHea der("Content-disposition",
                  >> >> "attachment;fil ename=export.xl s")
                  >> >> objHttpContext. Response.Charse t = ""
                  >> >>
                  >> >> "Hemant Sipahimalani" <Hemant Sipahimalani@di scussions.micro soft.com>
                  >> >> wrote
                  >> >> in message news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...
                  >> >> > The following piece of code is being used to export HTML to excel.
                  >> >> >
                  >> >> > HttpContext.Cur rent.Response.C ontentType =
                  >> >> > "applicatio n/vnd.ms-excel"
                  >> >> > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
                  >> >> > "attachment;fil ename=ABC.xls")
                  >> >> > HttpContext.Cur rent.Response.W rite(strHTML)
                  >> >> > HttpContext.Cur rent.Response.E nd()
                  >> >> >
                  >> >> > However when the user tries to save it the Default File Type is Web
                  >> >> > Page(*.htm; *.html)
                  >> >> > How do we change the Default File Type to Excel
                  >> >>
                  >> >>
                  >> >>[/color]
                  >>
                  >>
                  >>[/color][/color]


                  Comment

                  • Hemant Sipahimalani

                    #10
                    Re: Export to Excel (Default File Type - Excel)

                    Jeff,
                    I have the following versions installed on my machine.
                    1. Excel - Microsoft Excel 2003 (11.5612.5606)
                    2. IE - 6.0.2900.2180 , SP2
                    Thanks,
                    Hemant

                    "Jeff Dillon" wrote:
                    [color=blue]
                    > On ALL our machines, my code shows Save As Excel Sheet in the Save As dialog
                    > popup.
                    >
                    > Do you have Excel installed on your client machines?? Which is a requirement
                    > of course, to save in that format.
                    >
                    > Jeff
                    >
                    > "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com > wrote
                    > in message news:E926C9C0-B95A-4D9D-9070-62261393E930@mi crosoft.com...[color=green]
                    > > Jeff,
                    > > You are correct. The piece of code that you have written does show the
                    > > Exported file as "Text (tab delimited) (*.txt) " in the "Save as type"
                    > > dropdown when the user tries to save the excel file.
                    > > However in my case the data is in tabular format as opposed to "Hello
                    > > World".
                    > > The data that I am trying to export is similar to
                    > >
                    > > strHTML = "<table><tr><td >1</td><td>2</td><td>3</td></tr></table>"
                    > >
                    > > HttpContext.Cur rent.Response.C lear()
                    > > HttpContext.Cur rent.Response.B uffer = True
                    > > HttpContext.Cur rent.Response.C ontentType =
                    > > "applicatio n/vnd.ms-excel"
                    > > HttpContext.Cur rent.Response.A ddHeader("Conte nt-disposition",
                    > > "attachment;fil ename=export.xl s")
                    > > HttpContext.Cur rent.Response.C harset = ""
                    > > HttpContext.Cur rent.Response.W rite(strHTML)
                    > > HttpContext.Cur rent.Response.E nd()
                    > >
                    > > In this case when the user tries to save the exported excel the "Save as
                    > > Type" drop down shows the type as a "Web Page". This is something that I
                    > > am
                    > > trying to avoid.
                    > >
                    > > Thanks,
                    > > Hemant
                    > >
                    > >
                    > > "Jeff Dillon" wrote:
                    > >[color=darkred]
                    > >> Put this all by itself in test.aspx:
                    > >>
                    > >> <%
                    > >>
                    > >> Response.Clear( )
                    > >> Response.Buffer = True
                    > >> Response.Conten tType = "applicatio n/vnd.ms-excel"
                    > >> Response.AddHea der("Content-disposition",
                    > >> "attachment;fil ename=export.xl s")
                    > >> Response.Charse t = ""
                    > >> Response.Write( "Hello world")
                    > >> Response.End()
                    > >>
                    > >> %>
                    > >>
                    > >> "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com >
                    > >> wrote
                    > >> in message news:8B0AFB73-21B3-42E6-B9A7-87B38E1207A9@mi crosoft.com...
                    > >> > Thanks Jeff ,
                    > >> > but this still does not show the default File Type as xls when the
                    > >> > user
                    > >> > tries to save the file.
                    > >> > Hemant
                    > >> > "Jeff Dillon" wrote:
                    > >> >
                    > >> >> We have used this code:
                    > >> >>
                    > >> >> objHttpContext. Response.Clear( )
                    > >> >> objHttpContext. Response.Buffer = True
                    > >> >> objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
                    > >> >> objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
                    > >> >> objHttpContext. Response.AddHea der("Content-disposition",
                    > >> >> "attachment;fil ename=export.xl s")
                    > >> >> objHttpContext. Response.Charse t = ""
                    > >> >>
                    > >> >> "Hemant Sipahimalani" <Hemant Sipahimalani@di scussions.micro soft.com>
                    > >> >> wrote
                    > >> >> in message news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...
                    > >> >> > The following piece of code is being used to export HTML to excel.
                    > >> >> >
                    > >> >> > HttpContext.Cur rent.Response.C ontentType =
                    > >> >> > "applicatio n/vnd.ms-excel"
                    > >> >> > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
                    > >> >> > "attachment;fil ename=ABC.xls")
                    > >> >> > HttpContext.Cur rent.Response.W rite(strHTML)
                    > >> >> > HttpContext.Cur rent.Response.E nd()
                    > >> >> >
                    > >> >> > However when the user tries to save it the Default File Type is Web
                    > >> >> > Page(*.htm; *.html)
                    > >> >> > How do we change the Default File Type to Excel
                    > >> >>
                    > >> >>
                    > >> >>
                    > >>
                    > >>
                    > >>[/color][/color]
                    >
                    >
                    >[/color]

                    Comment

                    • Jeff Dillon

                      #11
                      Re: Export to Excel (Default File Type - Excel)

                      I'm wondering if it's a mime type setting on your server..

                      Jeff

                      "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com > wrote
                      in message news:4270C9D1-CC5F-44F2-999D-157EB918A504@mi crosoft.com...[color=blue]
                      > Jeff,
                      > I have the following versions installed on my machine.
                      > 1. Excel - Microsoft Excel 2003 (11.5612.5606)
                      > 2. IE - 6.0.2900.2180 , SP2
                      > Thanks,
                      > Hemant
                      >
                      > "Jeff Dillon" wrote:
                      >[color=green]
                      >> On ALL our machines, my code shows Save As Excel Sheet in the Save As
                      >> dialog
                      >> popup.
                      >>
                      >> Do you have Excel installed on your client machines?? Which is a
                      >> requirement
                      >> of course, to save in that format.
                      >>
                      >> Jeff
                      >>
                      >> "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com >
                      >> wrote
                      >> in message news:E926C9C0-B95A-4D9D-9070-62261393E930@mi crosoft.com...[color=darkred]
                      >> > Jeff,
                      >> > You are correct. The piece of code that you have written does show
                      >> > the
                      >> > Exported file as "Text (tab delimited) (*.txt) " in the "Save as type"
                      >> > dropdown when the user tries to save the excel file.
                      >> > However in my case the data is in tabular format as opposed to
                      >> > "Hello
                      >> > World".
                      >> > The data that I am trying to export is similar to
                      >> >
                      >> > strHTML = "<table><tr><td >1</td><td>2</td><td>3</td></tr></table>"
                      >> >
                      >> > HttpContext.Cur rent.Response.C lear()
                      >> > HttpContext.Cur rent.Response.B uffer = True
                      >> > HttpContext.Cur rent.Response.C ontentType =
                      >> > "applicatio n/vnd.ms-excel"
                      >> > HttpContext.Cur rent.Response.A ddHeader("Conte nt-disposition",
                      >> > "attachment;fil ename=export.xl s")
                      >> > HttpContext.Cur rent.Response.C harset = ""
                      >> > HttpContext.Cur rent.Response.W rite(strHTML)
                      >> > HttpContext.Cur rent.Response.E nd()
                      >> >
                      >> > In this case when the user tries to save the exported excel the "Save
                      >> > as
                      >> > Type" drop down shows the type as a "Web Page". This is something that
                      >> > I
                      >> > am
                      >> > trying to avoid.
                      >> >
                      >> > Thanks,
                      >> > Hemant
                      >> >
                      >> >
                      >> > "Jeff Dillon" wrote:
                      >> >
                      >> >> Put this all by itself in test.aspx:
                      >> >>
                      >> >> <%
                      >> >>
                      >> >> Response.Clear( )
                      >> >> Response.Buffer = True
                      >> >> Response.Conten tType = "applicatio n/vnd.ms-excel"
                      >> >> Response.AddHea der("Content-disposition",
                      >> >> "attachment;fil ename=export.xl s")
                      >> >> Response.Charse t = ""
                      >> >> Response.Write( "Hello world")
                      >> >> Response.End()
                      >> >>
                      >> >> %>
                      >> >>
                      >> >> "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com >
                      >> >> wrote
                      >> >> in message news:8B0AFB73-21B3-42E6-B9A7-87B38E1207A9@mi crosoft.com...
                      >> >> > Thanks Jeff ,
                      >> >> > but this still does not show the default File Type as xls when
                      >> >> > the
                      >> >> > user
                      >> >> > tries to save the file.
                      >> >> > Hemant
                      >> >> > "Jeff Dillon" wrote:
                      >> >> >
                      >> >> >> We have used this code:
                      >> >> >>
                      >> >> >> objHttpContext. Response.Clear( )
                      >> >> >> objHttpContext. Response.Buffer = True
                      >> >> >> objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
                      >> >> >> objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
                      >> >> >> objHttpContext. Response.AddHea der("Content-disposition",
                      >> >> >> "attachment;fil ename=export.xl s")
                      >> >> >> objHttpContext. Response.Charse t = ""
                      >> >> >>
                      >> >> >> "Hemant Sipahimalani" <Hemant
                      >> >> >> Sipahimalani@di scussions.micro soft.com>
                      >> >> >> wrote
                      >> >> >> in message
                      >> >> >> news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...
                      >> >> >> > The following piece of code is being used to export HTML to
                      >> >> >> > excel.
                      >> >> >> >
                      >> >> >> > HttpContext.Cur rent.Response.C ontentType =
                      >> >> >> > "applicatio n/vnd.ms-excel"
                      >> >> >> > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
                      >> >> >> > "attachment;fil ename=ABC.xls")
                      >> >> >> > HttpContext.Cur rent.Response.W rite(strHTML)
                      >> >> >> > HttpContext.Cur rent.Response.E nd()
                      >> >> >> >
                      >> >> >> > However when the user tries to save it the Default File Type is
                      >> >> >> > Web
                      >> >> >> > Page(*.htm; *.html)
                      >> >> >> > How do we change the Default File Type to Excel
                      >> >> >>
                      >> >> >>
                      >> >> >>
                      >> >>
                      >> >>
                      >> >>[/color]
                      >>
                      >>
                      >>[/color][/color]


                      Comment

                      • Hemant Sipahimalani

                        #12
                        Re: Export to Excel (Default File Type - Excel)

                        Jeff,
                        MIME settings are set up to open a file with xls in Excel sheet. This is
                        exactly what the code does. It is only when you try to save the file, the
                        "Save as Type" is a "Web Page" as opposed to "xls".
                        Is it possible to send across the link to the test report on your
                        application across to me? Curious to see how it works against my Test bed.
                        Thanks,
                        Hemant


                        "Jeff Dillon" wrote:
                        [color=blue]
                        > I'm wondering if it's a mime type setting on your server..
                        >
                        > Jeff
                        >
                        > "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com > wrote
                        > in message news:4270C9D1-CC5F-44F2-999D-157EB918A504@mi crosoft.com...[color=green]
                        > > Jeff,
                        > > I have the following versions installed on my machine.
                        > > 1. Excel - Microsoft Excel 2003 (11.5612.5606)
                        > > 2. IE - 6.0.2900.2180 , SP2
                        > > Thanks,
                        > > Hemant
                        > >
                        > > "Jeff Dillon" wrote:
                        > >[color=darkred]
                        > >> On ALL our machines, my code shows Save As Excel Sheet in the Save As
                        > >> dialog
                        > >> popup.
                        > >>
                        > >> Do you have Excel installed on your client machines?? Which is a
                        > >> requirement
                        > >> of course, to save in that format.
                        > >>
                        > >> Jeff
                        > >>
                        > >> "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com >
                        > >> wrote
                        > >> in message news:E926C9C0-B95A-4D9D-9070-62261393E930@mi crosoft.com...
                        > >> > Jeff,
                        > >> > You are correct. The piece of code that you have written does show
                        > >> > the
                        > >> > Exported file as "Text (tab delimited) (*.txt) " in the "Save as type"
                        > >> > dropdown when the user tries to save the excel file.
                        > >> > However in my case the data is in tabular format as opposed to
                        > >> > "Hello
                        > >> > World".
                        > >> > The data that I am trying to export is similar to
                        > >> >
                        > >> > strHTML = "<table><tr><td >1</td><td>2</td><td>3</td></tr></table>"
                        > >> >
                        > >> > HttpContext.Cur rent.Response.C lear()
                        > >> > HttpContext.Cur rent.Response.B uffer = True
                        > >> > HttpContext.Cur rent.Response.C ontentType =
                        > >> > "applicatio n/vnd.ms-excel"
                        > >> > HttpContext.Cur rent.Response.A ddHeader("Conte nt-disposition",
                        > >> > "attachment;fil ename=export.xl s")
                        > >> > HttpContext.Cur rent.Response.C harset = ""
                        > >> > HttpContext.Cur rent.Response.W rite(strHTML)
                        > >> > HttpContext.Cur rent.Response.E nd()
                        > >> >
                        > >> > In this case when the user tries to save the exported excel the "Save
                        > >> > as
                        > >> > Type" drop down shows the type as a "Web Page". This is something that
                        > >> > I
                        > >> > am
                        > >> > trying to avoid.
                        > >> >
                        > >> > Thanks,
                        > >> > Hemant
                        > >> >
                        > >> >
                        > >> > "Jeff Dillon" wrote:
                        > >> >
                        > >> >> Put this all by itself in test.aspx:
                        > >> >>
                        > >> >> <%
                        > >> >>
                        > >> >> Response.Clear( )
                        > >> >> Response.Buffer = True
                        > >> >> Response.Conten tType = "applicatio n/vnd.ms-excel"
                        > >> >> Response.AddHea der("Content-disposition",
                        > >> >> "attachment;fil ename=export.xl s")
                        > >> >> Response.Charse t = ""
                        > >> >> Response.Write( "Hello world")
                        > >> >> Response.End()
                        > >> >>
                        > >> >> %>
                        > >> >>
                        > >> >> "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com >
                        > >> >> wrote
                        > >> >> in message news:8B0AFB73-21B3-42E6-B9A7-87B38E1207A9@mi crosoft.com...
                        > >> >> > Thanks Jeff ,
                        > >> >> > but this still does not show the default File Type as xls when
                        > >> >> > the
                        > >> >> > user
                        > >> >> > tries to save the file.
                        > >> >> > Hemant
                        > >> >> > "Jeff Dillon" wrote:
                        > >> >> >
                        > >> >> >> We have used this code:
                        > >> >> >>
                        > >> >> >> objHttpContext. Response.Clear( )
                        > >> >> >> objHttpContext. Response.Buffer = True
                        > >> >> >> objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
                        > >> >> >> objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
                        > >> >> >> objHttpContext. Response.AddHea der("Content-disposition",
                        > >> >> >> "attachment;fil ename=export.xl s")
                        > >> >> >> objHttpContext. Response.Charse t = ""
                        > >> >> >>
                        > >> >> >> "Hemant Sipahimalani" <Hemant
                        > >> >> >> Sipahimalani@di scussions.micro soft.com>
                        > >> >> >> wrote
                        > >> >> >> in message
                        > >> >> >> news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...
                        > >> >> >> > The following piece of code is being used to export HTML to
                        > >> >> >> > excel.
                        > >> >> >> >
                        > >> >> >> > HttpContext.Cur rent.Response.C ontentType =
                        > >> >> >> > "applicatio n/vnd.ms-excel"
                        > >> >> >> > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
                        > >> >> >> > "attachment;fil ename=ABC.xls")
                        > >> >> >> > HttpContext.Cur rent.Response.W rite(strHTML)
                        > >> >> >> > HttpContext.Cur rent.Response.E nd()
                        > >> >> >> >
                        > >> >> >> > However when the user tries to save it the Default File Type is
                        > >> >> >> > Web
                        > >> >> >> > Page(*.htm; *.html)
                        > >> >> >> > How do we change the Default File Type to Excel
                        > >> >> >>
                        > >> >> >>
                        > >> >> >>
                        > >> >>
                        > >> >>
                        > >> >>
                        > >>
                        > >>
                        > >>[/color][/color]
                        >
                        >
                        >[/color]

                        Comment

                        • HARI PRASD BARU

                          #13
                          Re: Export to Excel (Default File Type - Excel)

                          Hemant,
                          We also having same issue with Export to Excel, tried all possible code
                          solutions but didn't worked out,
                          Curious to know if you would have got solution as you also facing same issue.
                          Plz let me know if have any solution..

                          "Hemant Sipahimalani" wrote:
                          [color=blue]
                          > Jeff,
                          > MIME settings are set up to open a file with xls in Excel sheet. This is
                          > exactly what the code does. It is only when you try to save the file, the
                          > "Save as Type" is a "Web Page" as opposed to "xls".
                          > Is it possible to send across the link to the test report on your
                          > application across to me? Curious to see how it works against my Test bed.
                          > Thanks,
                          > Hemant
                          >
                          >
                          > "Jeff Dillon" wrote:
                          >[color=green]
                          > > I'm wondering if it's a mime type setting on your server..
                          > >
                          > > Jeff
                          > >
                          > > "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com > wrote
                          > > in message news:4270C9D1-CC5F-44F2-999D-157EB918A504@mi crosoft.com...[color=darkred]
                          > > > Jeff,
                          > > > I have the following versions installed on my machine.
                          > > > 1. Excel - Microsoft Excel 2003 (11.5612.5606)
                          > > > 2. IE - 6.0.2900.2180 , SP2
                          > > > Thanks,
                          > > > Hemant
                          > > >
                          > > > "Jeff Dillon" wrote:
                          > > >
                          > > >> On ALL our machines, my code shows Save As Excel Sheet in the Save As
                          > > >> dialog
                          > > >> popup.
                          > > >>
                          > > >> Do you have Excel installed on your client machines?? Which is a
                          > > >> requirement
                          > > >> of course, to save in that format.
                          > > >>
                          > > >> Jeff
                          > > >>
                          > > >> "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com >
                          > > >> wrote
                          > > >> in message news:E926C9C0-B95A-4D9D-9070-62261393E930@mi crosoft.com...
                          > > >> > Jeff,
                          > > >> > You are correct. The piece of code that you have written does show
                          > > >> > the
                          > > >> > Exported file as "Text (tab delimited) (*.txt) " in the "Save as type"
                          > > >> > dropdown when the user tries to save the excel file.
                          > > >> > However in my case the data is in tabular format as opposed to
                          > > >> > "Hello
                          > > >> > World".
                          > > >> > The data that I am trying to export is similar to
                          > > >> >
                          > > >> > strHTML = "<table><tr><td >1</td><td>2</td><td>3</td></tr></table>"
                          > > >> >
                          > > >> > HttpContext.Cur rent.Response.C lear()
                          > > >> > HttpContext.Cur rent.Response.B uffer = True
                          > > >> > HttpContext.Cur rent.Response.C ontentType =
                          > > >> > "applicatio n/vnd.ms-excel"
                          > > >> > HttpContext.Cur rent.Response.A ddHeader("Conte nt-disposition",
                          > > >> > "attachment;fil ename=export.xl s")
                          > > >> > HttpContext.Cur rent.Response.C harset = ""
                          > > >> > HttpContext.Cur rent.Response.W rite(strHTML)
                          > > >> > HttpContext.Cur rent.Response.E nd()
                          > > >> >
                          > > >> > In this case when the user tries to save the exported excel the "Save
                          > > >> > as
                          > > >> > Type" drop down shows the type as a "Web Page". This is something that
                          > > >> > I
                          > > >> > am
                          > > >> > trying to avoid.
                          > > >> >
                          > > >> > Thanks,
                          > > >> > Hemant
                          > > >> >
                          > > >> >
                          > > >> > "Jeff Dillon" wrote:
                          > > >> >
                          > > >> >> Put this all by itself in test.aspx:
                          > > >> >>
                          > > >> >> <%
                          > > >> >>
                          > > >> >> Response.Clear( )
                          > > >> >> Response.Buffer = True
                          > > >> >> Response.Conten tType = "applicatio n/vnd.ms-excel"
                          > > >> >> Response.AddHea der("Content-disposition",
                          > > >> >> "attachment;fil ename=export.xl s")
                          > > >> >> Response.Charse t = ""
                          > > >> >> Response.Write( "Hello world")
                          > > >> >> Response.End()
                          > > >> >>
                          > > >> >> %>
                          > > >> >>
                          > > >> >> "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com >
                          > > >> >> wrote
                          > > >> >> in message news:8B0AFB73-21B3-42E6-B9A7-87B38E1207A9@mi crosoft.com...
                          > > >> >> > Thanks Jeff ,
                          > > >> >> > but this still does not show the default File Type as xls when
                          > > >> >> > the
                          > > >> >> > user
                          > > >> >> > tries to save the file.
                          > > >> >> > Hemant
                          > > >> >> > "Jeff Dillon" wrote:
                          > > >> >> >
                          > > >> >> >> We have used this code:
                          > > >> >> >>
                          > > >> >> >> objHttpContext. Response.Clear( )
                          > > >> >> >> objHttpContext. Response.Buffer = True
                          > > >> >> >> objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
                          > > >> >> >> objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
                          > > >> >> >> objHttpContext. Response.AddHea der("Content-disposition",
                          > > >> >> >> "attachment;fil ename=export.xl s")
                          > > >> >> >> objHttpContext. Response.Charse t = ""
                          > > >> >> >>
                          > > >> >> >> "Hemant Sipahimalani" <Hemant
                          > > >> >> >> Sipahimalani@di scussions.micro soft.com>
                          > > >> >> >> wrote
                          > > >> >> >> in message
                          > > >> >> >> news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...
                          > > >> >> >> > The following piece of code is being used to export HTML to
                          > > >> >> >> > excel.
                          > > >> >> >> >
                          > > >> >> >> > HttpContext.Cur rent.Response.C ontentType =
                          > > >> >> >> > "applicatio n/vnd.ms-excel"
                          > > >> >> >> > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
                          > > >> >> >> > "attachment;fil ename=ABC.xls")
                          > > >> >> >> > HttpContext.Cur rent.Response.W rite(strHTML)
                          > > >> >> >> > HttpContext.Cur rent.Response.E nd()
                          > > >> >> >> >
                          > > >> >> >> > However when the user tries to save it the Default File Type is
                          > > >> >> >> > Web
                          > > >> >> >> > Page(*.htm; *.html)
                          > > >> >> >> > How do we change the Default File Type to Excel
                          > > >> >> >>
                          > > >> >> >>
                          > > >> >> >>
                          > > >> >>
                          > > >> >>
                          > > >> >>
                          > > >>
                          > > >>
                          > > >>[/color]
                          > >
                          > >
                          > >[/color][/color]

                          Comment

                          • Hemant Sipahimalani

                            #14
                            Re: Export to Excel (Default File Type - Excel)

                            Hari,
                            There is no solution that I could find out. The workaround for this is to
                            use the Excel Object and create an excel on the server itself, which will
                            have to be ultimately downloaded on the client. But this method has it's own
                            limitations.
                            Regards,
                            Hemant


                            "HARI PRASD BARU" wrote:
                            [color=blue]
                            > Hemant,
                            > We also having same issue with Export to Excel, tried all possible code
                            > solutions but didn't worked out,
                            > Curious to know if you would have got solution as you also facing same issue.
                            > Plz let me know if have any solution..
                            >
                            > "Hemant Sipahimalani" wrote:
                            >[color=green]
                            > > Jeff,
                            > > MIME settings are set up to open a file with xls in Excel sheet. This is
                            > > exactly what the code does. It is only when you try to save the file, the
                            > > "Save as Type" is a "Web Page" as opposed to "xls".
                            > > Is it possible to send across the link to the test report on your
                            > > application across to me? Curious to see how it works against my Test bed.
                            > > Thanks,
                            > > Hemant
                            > >
                            > >
                            > > "Jeff Dillon" wrote:
                            > >[color=darkred]
                            > > > I'm wondering if it's a mime type setting on your server..
                            > > >
                            > > > Jeff
                            > > >
                            > > > "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com > wrote
                            > > > in message news:4270C9D1-CC5F-44F2-999D-157EB918A504@mi crosoft.com...
                            > > > > Jeff,
                            > > > > I have the following versions installed on my machine.
                            > > > > 1. Excel - Microsoft Excel 2003 (11.5612.5606)
                            > > > > 2. IE - 6.0.2900.2180 , SP2
                            > > > > Thanks,
                            > > > > Hemant
                            > > > >
                            > > > > "Jeff Dillon" wrote:
                            > > > >
                            > > > >> On ALL our machines, my code shows Save As Excel Sheet in the Save As
                            > > > >> dialog
                            > > > >> popup.
                            > > > >>
                            > > > >> Do you have Excel installed on your client machines?? Which is a
                            > > > >> requirement
                            > > > >> of course, to save in that format.
                            > > > >>
                            > > > >> Jeff
                            > > > >>
                            > > > >> "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com >
                            > > > >> wrote
                            > > > >> in message news:E926C9C0-B95A-4D9D-9070-62261393E930@mi crosoft.com...
                            > > > >> > Jeff,
                            > > > >> > You are correct. The piece of code that you have written does show
                            > > > >> > the
                            > > > >> > Exported file as "Text (tab delimited) (*.txt) " in the "Save as type"
                            > > > >> > dropdown when the user tries to save the excel file.
                            > > > >> > However in my case the data is in tabular format as opposed to
                            > > > >> > "Hello
                            > > > >> > World".
                            > > > >> > The data that I am trying to export is similar to
                            > > > >> >
                            > > > >> > strHTML = "<table><tr><td >1</td><td>2</td><td>3</td></tr></table>"
                            > > > >> >
                            > > > >> > HttpContext.Cur rent.Response.C lear()
                            > > > >> > HttpContext.Cur rent.Response.B uffer = True
                            > > > >> > HttpContext.Cur rent.Response.C ontentType =
                            > > > >> > "applicatio n/vnd.ms-excel"
                            > > > >> > HttpContext.Cur rent.Response.A ddHeader("Conte nt-disposition",
                            > > > >> > "attachment;fil ename=export.xl s")
                            > > > >> > HttpContext.Cur rent.Response.C harset = ""
                            > > > >> > HttpContext.Cur rent.Response.W rite(strHTML)
                            > > > >> > HttpContext.Cur rent.Response.E nd()
                            > > > >> >
                            > > > >> > In this case when the user tries to save the exported excel the "Save
                            > > > >> > as
                            > > > >> > Type" drop down shows the type as a "Web Page". This is something that
                            > > > >> > I
                            > > > >> > am
                            > > > >> > trying to avoid.
                            > > > >> >
                            > > > >> > Thanks,
                            > > > >> > Hemant
                            > > > >> >
                            > > > >> >
                            > > > >> > "Jeff Dillon" wrote:
                            > > > >> >
                            > > > >> >> Put this all by itself in test.aspx:
                            > > > >> >>
                            > > > >> >> <%
                            > > > >> >>
                            > > > >> >> Response.Clear( )
                            > > > >> >> Response.Buffer = True
                            > > > >> >> Response.Conten tType = "applicatio n/vnd.ms-excel"
                            > > > >> >> Response.AddHea der("Content-disposition",
                            > > > >> >> "attachment;fil ename=export.xl s")
                            > > > >> >> Response.Charse t = ""
                            > > > >> >> Response.Write( "Hello world")
                            > > > >> >> Response.End()
                            > > > >> >>
                            > > > >> >> %>
                            > > > >> >>
                            > > > >> >> "Hemant Sipahimalani" <HemantSipahima lani@discussion s.microsoft.com >
                            > > > >> >> wrote
                            > > > >> >> in message news:8B0AFB73-21B3-42E6-B9A7-87B38E1207A9@mi crosoft.com...
                            > > > >> >> > Thanks Jeff ,
                            > > > >> >> > but this still does not show the default File Type as xls when
                            > > > >> >> > the
                            > > > >> >> > user
                            > > > >> >> > tries to save the file.
                            > > > >> >> > Hemant
                            > > > >> >> > "Jeff Dillon" wrote:
                            > > > >> >> >
                            > > > >> >> >> We have used this code:
                            > > > >> >> >>
                            > > > >> >> >> objHttpContext. Response.Clear( )
                            > > > >> >> >> objHttpContext. Response.Buffer = True
                            > > > >> >> >> objHttpContext. Response.Conten tEncoding = System.Text.Enc oding.UTF8
                            > > > >> >> >> objHttpContext. Response.Conten tType = "applicatio n/vnd.ms-excel"
                            > > > >> >> >> objHttpContext. Response.AddHea der("Content-disposition",
                            > > > >> >> >> "attachment;fil ename=export.xl s")
                            > > > >> >> >> objHttpContext. Response.Charse t = ""
                            > > > >> >> >>
                            > > > >> >> >> "Hemant Sipahimalani" <Hemant
                            > > > >> >> >> Sipahimalani@di scussions.micro soft.com>
                            > > > >> >> >> wrote
                            > > > >> >> >> in message
                            > > > >> >> >> news:C0FC2030-600D-4D1D-88FB-C06FFF0EE101@mi crosoft.com...
                            > > > >> >> >> > The following piece of code is being used to export HTML to
                            > > > >> >> >> > excel.
                            > > > >> >> >> >
                            > > > >> >> >> > HttpContext.Cur rent.Response.C ontentType =
                            > > > >> >> >> > "applicatio n/vnd.ms-excel"
                            > > > >> >> >> > HttpContext.Cur rent.Response.A ddHeader("conte nt-disposition",
                            > > > >> >> >> > "attachment;fil ename=ABC.xls")
                            > > > >> >> >> > HttpContext.Cur rent.Response.W rite(strHTML)
                            > > > >> >> >> > HttpContext.Cur rent.Response.E nd()
                            > > > >> >> >> >
                            > > > >> >> >> > However when the user tries to save it the Default File Type is
                            > > > >> >> >> > Web
                            > > > >> >> >> > Page(*.htm; *.html)
                            > > > >> >> >> > How do we change the Default File Type to Excel
                            > > > >> >> >>
                            > > > >> >> >>
                            > > > >> >> >>
                            > > > >> >>
                            > > > >> >>
                            > > > >> >>
                            > > > >>
                            > > > >>
                            > > > >>
                            > > >
                            > > >
                            > > >[/color][/color][/color]

                            Comment

                            Working...