Re: stream Excel to browser- Framework 2.0

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hello Rick,

Thank you for the prompt reply. I have received your email. According to
the picture "ReportPage_ShowAsHtml.JPG", Excel is showing the html source
of a web page. Would you help to check what web page is that for? Is it the
page where you click on the download button? (But it is strange that I
cannot find the button's html tag according to the screen shot.) In the
meantime, can you access the csv file located on the server? Would you help
to open it directly on server and see whether the csv's content is correct?
Is it possible that the csv file on the server has been overwritten
unexpectedly?

In order to test whether a csv file could be shown correctly in the
browser, I did the following test on a Window 2003 Server system, with .NET
2.0, Visual Studio 2005, and Office 2003 Enterprise (SP2). I have attached
the complete test web project and the test csv file to this reply. (You
could download the attachment with Outlook Express or Windows Mail). The
test project worked as expected in my side.

In the test project, I created a simple VB.NET web application with Visual
Studio 2005. There is only on button <asp:Button ID="Button1"
runat="server" Onclick="Button1_Click" Text="Download" /> in the
Default.aspx page. In Button1_Click event handler, I paste your code there:
Dim resp As HttpResponse
Dim reportfilenamehere As String = "Book1.csv"
resp = Page.Response
resp.Clear()
resp.ContentType = "application/vnd.ms-excel"
resp.AppendHeader("Content-Disposition", "attachment;filename=" &
reportfilenamehere)
resp.WriteFile(reportfilenamehere)
resp.Flush()
resp.End()
Book1.csv is located in the same directory as Default.aspx, and it only
contains two lines of data:
1,1,1,1
2,2,2,2
When I run the project and clicks on the "download" button, the csv is
downloaded and shown correctly. I also tested to publish the web
application to another Windows 2003 server system, then visit the site, I
am still not able to reproduce the issue in my side. Would you please check
the points I mentioned in the beginning of the reply and let me know the
result? I am looking forward to your reply.

I understand that we didn't make much progress on this issue so far. It's
mainly because it's not reproducible in my side and yours and it is not
convenient to do the tests directly. Although troubleshooting such issues
in newsgroup might not be the best channel, I will try my best to help.

Sincerely,
Jialiang Ge (jialge@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

=================================================
When responding to posts, please "Reply to Group" via your newsreader
so that others may learn and benefit from your issue.
=================================================
This posting is provided "AS IS" with no warranties, and confers no rights.

.



Relevant Pages

  • Re: stream Excel to browser- Framework 2.0
    ... to open it directly on server and see whether the csv's content is correct? ... Is it possible that the csv file on the server has been overwritten ... could download the attachment with Outlook Express or Windows Mail). ... In the test project, I created a simple VB.NET web application with Visual ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: LWP getting special (multibyte) characters from webpages
    ... I am writing Perl scripts that go to webpages, download certain content, ... and then create a CSV file with the relevant data. ... the server; decoded_content turns it into Perl's internal Unicode ...
    (perl.beginners)
  • How to Download Secure Statement
    ... The data is all held server side. ... However, I want it so that the users can export the data in a csv file, much ... like you can download a statement from online banking. ... Is there any way to directly generate a file from an asp script. ...
    (microsoft.public.inetserver.asp.general)
  • Re: Client side Javascript to download data into a csv format
    ... The simplest option is to perhaps create the csv on the server, ... the client to go to a download page and save the csv file themselves. ... server side is the way to go. ...
    (comp.lang.javascript)
  • Re: Problem Updating New Messages from NTTP News Server OE
    ... > as far as I know and he doesn't have a server in his setup. ... download the answer to a problem he had posted in the Outlook group and I had seen the answer almost immediately on July 1. ... sure how taking the check out of the download headers boxes would have helped. ... pane 3) Get headers at a time 4) No check in mark all messages as read when exiting newsgroup ...
    (microsoft.public.windows.inetexplorer.ie6_outlookexpress)