473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Generating XLS files from ASP

Hi All,
I'm generating XLS files from ASP(.Net) code using the usual code
chunks ...

Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-Disposition", "attachment; filename=""" &

NomeFile & """")
Response.Flush()
Response.write("<table border=""1"" .....
......
......
Response.end

It all works fine since I'm able to Open/Save the file with Excel 2000. But
.....
....... when I run the code on a box where only an Excel Viewer 2003 is
installed (rather then the full product) I cannot open it, and Viewer aborts
with the following Message : "Cannot Open files of this type".
Choosing to save save the file to reopen it laterleads to the same error.

Moreover, the generated XLS file looks to be really small ....(1Kb) and
after opening and resaving it from Excel program as a xls Workbook it becomes
larger (14Kb). At this point the viewer can open it.. ...

All this let me think that the generated file is not a "real" xls file ....
while viewer can only open this kind of files ... (also tried to use freeware
viewer but I got the same behaviour .....)

Any help is appreciated .... Thanks in advance Daniele Balducci
Jul 22 '05 #1
5 5202
daniele.balducci wrote:
Hi All,
I'm generating XLS files from ASP(.Net) code using the usual


There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-knowledgeable person here who
can answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.aspnet.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #2
Hi Bob ,
thanks for your quick answer .... I'll repost to that discussion
group now.
Anyway it's not a .net specific problem ... it also happens on pure ASP code
.... (please note the .net in parhentesis on my original append) ... Thanks
Daniele

"Bob Barrows [MVP]" wrote:
daniele.balducci wrote:
Hi All,
I'm generating XLS files from ASP(.Net) code using the usual


There was no way for you to know it, but this is a classic asp newsgroup.
While you may be lucky enough to find a dotnet-knowledgeable person here who
can answer your question, you can eliminate the luck factor by posting your
question to a group where those dotnet-knowledgeable people hang out. I
suggest microsoft.public.dotnet.framework.aspnet.

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Jul 22 '05 #3
daniele.balducci wrote:
Hi All,
I'm generating XLS files from ASP(.Net) code using the usual
code chunks ...

Response.ContentType = "application/vnd.ms-excel"
Response.AppendHeader("Content-Disposition", "attachment;
filename=""" &

NomeFile & """")
Response.Flush()
Response.write("<table border=""1"" .....
.....
.....
Response.end

It all works fine since I'm able to Open/Save the file with Excel
2000. But ....
...... when I run the code on a box where only an Excel Viewer 2003 is
installed (rather then the full product)
You mean the client machine only has the viewer installed? If so, this is a
client-side browser issue, not ASP.
I cannot open it, and Viewer
aborts with the following Message : "Cannot Open files of this type".
IIRC (hopefully someone will jump in and correct me if necessary),
"application/vnd.ms-excel" requires Excel, not the viewer.
Choosing to save save the file to reopen it laterleads to the same
error.
I don't understand this step.

Moreover, the generated XLS file looks to be really small ....(1Kb)
and after opening and resaving it from Excel program as a xls
Workbook it becomes larger (14Kb). At this point the viewer can open
it.. ...

All this let me think that the generated file is not a "real" xls
file .... while viewer can only open this kind of files ... (also
tried to use freeware viewer but I got the same behaviour .....)


You might try an Excel newsgroup to see if there is any difference

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 22 '05 #4
"Bob Barrows [MVP]" wrote in message
news:e9**************@TK2MSFTNGP10.phx.gbl...
: daniele.balducci wrote:
: > Choosing to save save the file to reopen it laterleads to the same
: > error.
:
: I don't understand this step.

I think she's saying that she initially wants to call the associated app to
open the file, when prompted with open/save to file and even if she saves to
file first and then tries to open it with the viewer, possibly called via
Explorer, the same error occurs, "Can not open files of this type."

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #5
"daniele.balducci" wrote in message
news:52**********************************@microsof t.com...
: Hi All,
: I'm generating XLS files from ASP(.Net) code using the usual code
: chunks ...
:
: Response.ContentType = "application/vnd.ms-excel"
: Response.AppendHeader("Content-Disposition", "attachment; filename=""" &
:
: NomeFile & """")
: Response.Flush()
: Response.write("<table border=""1"" .....
: .....
: .....
: Response.end
:
: It all works fine since I'm able to Open/Save the file with Excel 2000.
But
: ....
: ...... when I run the code on a box where only an Excel Viewer 2003 is
: installed (rather then the full product) I cannot open it, and Viewer
aborts
: with the following Message : "Cannot Open files of this type".
: Choosing to save save the file to reopen it laterleads to the same error.
:
: Moreover, the generated XLS file looks to be really small ....(1Kb) and
: after opening and resaving it from Excel program as a xls Workbook it
becomes
: larger (14Kb). At this point the viewer can open it.. ...
:
: All this let me think that the generated file is not a "real" xls file
.....
: while viewer can only open this kind of files ... (also tried to use
freeware
: viewer but I got the same behaviour .....)

You could try a different MIME type.

application/msexcel
application/x-msexcel
application/x-ms-excel
application/vnd.ms-excel
application/x-excel
application/x-dos_ms_excel
application/xls
application/x-xls
zz-application/zz-winassoc-xls

--
Roland Hall
/* This information is distributed in the hope that it will be useful, but
without any warranty; without even the implied warranty of merchantability
or fitness for a particular purpose. */
Technet Script Center - http://www.microsoft.com/technet/scriptcenter/
WSH 5.6 Documentation - http://msdn.microsoft.com/downloads/list/webdev.asp
MSDN Library - http://msdn.microsoft.com/library/default.asp
Jul 22 '05 #6

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

Similar topics

0
by: Dan Gass | last post by:
The difflib.py module and the diff.py tools script in Python 2.4 alpha 3 now support generating side by side (with intra line differences) in HTML format. I have found this useful for performing...
6
by: poisondart | last post by:
Is there a way to dynamically generate temporary files (such as an html, xml or text file) in Python? I'm not sure if I'm explaining myself clearly as I've no clue how to describe this...
2
by: google.groups.tr | last post by:
I have an Access 97 database that has a routine to generate a unique report as a PDF file and email it to one person, and loops about 300 times. Each instance through the loop uses a registry...
3
by: daniele.balducci | last post by:
Hi All, I'm generating XLS files from ASP(.Net) code using the usual code chunks ... Response.ContentType = "application/vnd.ms-excel" Response.AppendHeader("Content-Disposition", "attachment;...
1
by: Ryan Ginstrom | last post by:
I have been maintaining a body of documentation in plain HTML files. I would now like to automate the generation of the HTML files. Maintaining the HTML files now is tedious and error prone,...
1
by: Xah Lee | last post by:
The following is a program to generate thumbnail images for a website. Useful, if you want to do that. It is used to generate the thumbnails for my “Banners, Damsels, and Mores” project...
7
by: Nathan Sokalski | last post by:
I am an ASP.NET developer, and Visual Studio 2005 seems to have stopped declaring the controls that I add in the *.designer.vb files, therefore forcing me to manually add them before I can use them...
1
by: Nathan Sokalski | last post by:
Visual Studio 2005 recently stopped generating the *.designer.vb files for my *.aspx and *.ascx files. I am using Service Pack 1, and do not believe I did anything differently than normal prior to...
1
by: Nathan Sokalski | last post by:
Visual Studio 2005 unexpectedly stopped generating the *.designer.vb files for *.aspx and *.ascx files. After a few days of frustration trying to fix this, I noticed that it had the following...
1
by: csharpula csharp | last post by:
Hello, I need to generate cs files from XSD files. I would like to do it automatically. What is the best way to do it? Is it better be done with PreBuild inside VS (before compilation) or to...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
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...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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

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