ASP implementation display spreadsheet data in the Web (iii) Create spreadsheet lists and name ranges

Source: Internet
Author: User
Tags ranges
In addition to the technique of "reading Excel data to form HTML tables," You might be interested in learning how to implement a list of spreadsheet and name-range Drop-down menus using a program.
In addition to the contents of the cell, you can know more information with ADO--on top, we've discussed using it to get a list of field names.
Call the OpenSchema method to get a special set of records that currently open the database (also applicable to the electronic Data Book), where the spreadsheet and name range for the current electronic data book are retrieved from the routines discussed here. In the operation of the database, the information of all tables can be obtained by passing to the ADO a adschematablesas command parameter.
Set oschemars = Oconn.openschema (adSchemaTables)
The above call returns a recordset information, and for file Theworkbook.xls, the result is:
TABLE_NAME Table_type
employees$ SYSTEM TABLE
listofproducts$ SYSTEM TABLE
suppliers$ SYSTEM TABLE
A_duplicate_name TABLE
Alphabetical_list_of_products TABLE
Employees TABLE
Listofproducts$a_duplicate_name TABLE
Product_totals TABLE
The spreadsheet in the Electronic Data Workbook (worksheets) is treated as a system table and the name range is treated as a common table compared to the recordset. Usually, the nameless range can be used! ) is not reported by the recordset.
With this information in hand, creating a field drop-down menu is the work of separating the two table types and using the appropriate tags. For example, you can perform the following html/asp code snippet to create a drop-down menu of worksheet lists:
< select Name= "Xlsheet" >
<%
voptions = "< option ></option >"
Do as not oschemars.eof
If oschemars ("table_type") = "SYSTEM TABLE" Then
Voptions = voptions & "< option >" & _
Server.HTMLEncode (Oschemars ("table_name")) & _
"</option >
End If
Oschemars.movenext
Loop
Response.Write Voptions
% >
</select >
The actual readx1.asp code may be more complex, because the display of the previous option is processed, and the client's JavaScript script is used to check the legality of the input.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.