Link to home
Start Free TrialLog in
Avatar of jalalmegadeth
jalalmegadeth

asked on

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

ASKER CERTIFIED SOLUTION
Avatar of golfDoctor
golfDoctor

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jalalmegadeth
jalalmegadeth

ASKER

@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)


thx
"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:
http://www.visualbasicscript.com/m_32435/tm.htm 
http://www.codeproject.com/useritems/Excel_Automation.asp
@golfDoctor:
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 asp.net) to create dropdown lists in some columns


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

https://www.experts-exchange.com/questions/22093020/Excel-VBA-add-a-dropdown-menu.html

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.
yup, that helps, it gave me a nice start point

thx a lot golfdoctor