ASP: Excel numeric format export and automatic width adaptation

Source: Internet
Author: User

ASP: Excel numeric format export and automatic width adaptation

The following code is used for Demonstration:

If response. isclientconnected then
Response. Flush
Response. End
End if

Set xlapplication = server. Createobject ("Excel. application ")
Xlapplication. Visible = false
Xlapplication. workbooks. Add
Set xlworksheet = xlapplication. worksheets (1)
Xlworksheet. cells (9). numberformatlocal = "@" 'process as data format
Xlworksheet. cells (1, 1). value = "no"
Xlworksheet. cells (1, 2). value = "notebook brand"
Xlworksheet. cells (1, 3). value = "Address"
Xlworksheet. cells (1, 4). value = "class"
Xlworksheet. cells (1, 5). value = "ip"
Xlworksheet. cells (1, 6). value = "amount"
Xlworksheet. cells (1, 7). value = "email"
Xlworksheet. cells (1, 8). value = "QQ"
Xlworksheet. cells (3503221985080111111). value ="

Xlworksheet. cells. entirecolumn. autofit automatically adjusts the column width.
'Xlworksheet. activesheet. Columns [1]. columnswidth = 50

Filename = "NBB" & year (now () & month (now () & Day (now ())
Xlworksheet. saveas server. mappath (filename & ". xls ")
Xlapplication. Quit
Set xlworksheet = nothing
Set xlapplication = nothing

Response. Write ("generated successfully ")



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: 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.