ASP: Excel numeric format export and automatic width adaptation The following code is used for Demonstration: <% If response. isclientconnected then Response. Flush Else 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 ") %> |