Generate dropdownlist in Excel file using ASP

Hi all

I have an ASP page to generate an Excel file
here's how i generate it :

Response.ContentType ="Application/vnd.excel"
Response.AddHeader "Content-Disposition", "attachment; filename=Filename.xls"

And i have another page to upload the modified excel page and add it to the database

What i want to do, is that when i Generate  the Xls file, is that i populate some columns with dropdown list to  be sure that the client won't put anything else in these columns

example, i have 25 records in my generated excel file
and the column i want to validate is B
so, from B1 to B25, there must be a dropdown list with the database value selected

Thx a lot for your help guys

Who is Participating?
You cannot do this with ASP.  All you do by setting the header is push the file out as excel doc.  

You cannot control excel from ASP without creating an instance of Excel application with ASP.  And, for that you need Excel (or libraries) installed on the server.   Then you would build Excel file just like you would in Excel, not by setting header.

So it's totally different than what you are doing.
Here's a good article on using OWC to use some of the more advanced features of Excel.
jalalmegadethAuthor Commented:
@golfDoctor: thx for your answer
Do you have any links please so I can read more about that. I would apreciate it if you have a link that explains how to manipulate an XLS file using libraries (specially what i need is just how to create dropdown lists)

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

"specially what i need is just how to create dropdown lists"

You cannot pick and choose.  you would need to create entire file with instance of Excel application.  So, you wouldn't be able to use the header like you do now, you would need to create the file with Excel instance.

Here are examples of using Excel instance:
jalalmegadethAuthor Commented:
thx a lot

In fact i didn't explain well, what i meant to say by : "specially what i need is just how to create dropdown lists" is that i'm going to change the way that i generate the XLS file

I have read your links and it sounds good, this way gives me much control on the XLS file, so yeah sure i'm gonna use it like this

All i need now is a vbscript (for asp, not to create dropdown lists in some columns

thx a lot
VBA for Excel and VBScript are very similar.  See this for VBA example:

The VBScript would be virtually the same, except you don't declare variable type in DIM.

I don't have an exact example, so hope this helps.
jalalmegadethAuthor Commented:
yup, that helps, it gave me a nice start point

thx a lot golfdoctor
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.