[英]Using ASP Classic to autofit all columns of an Excel Sheet
Hi all I am inserting records into excel using the following format and code 大家好,我正在使用以下格式和代码将记录插入excel
sFileName = "abc.xls"
sFilePath = server.mappath("EXCEL\" & sFileName)
Set fso = Server.CreateObject("Scripting.FileSystemObject")
Set objCreatedFile = fso.CreateTextFile(sFilePath)
objCreatedFile.close
Set objOpenFile = fso.OpenTextFile(sFilePath,8,True)
Set rst = server.CreateObject("ADODB.RecordSet")
sSQL = "select * from a table"
rst.Open sSQL, conn, 3, 3
if not rst.eof then
sStr = "NAME" & chr(9) & "ADDRESS" & char(9) & "TEL" & char(9)
objOpenFile.WriteLine sStr
Do while not rst.eof
sStr = rst("NAME) & chr(9) & rst("ADD") & char(9) & rst("TEL") & char(9)
objOpenFile.WriteLine sStr
rst.movenext
loop
end if
objOpenFile.Close
Set objOpenFile = nothing
Set fso = nothing
After inserting the records into excel or rather using excel to open a file with the records separated by tabs. 将记录插入excel或使用excel打开文件后,记录之间用制表符分隔。 I want to now call something to autofit all the columns in excel.
我现在想调用一些东西来自动调整excel中的所有列。 How to do it, please help.
怎么做,请帮忙。 Thank you.
谢谢。
tab-delimited text file not an excel file. 制表符分隔的文本文件不是Excel文件。 And there's no way (short of some kind of Excel add-in) to have the client's Excel automatically auto-fit the columns when they open the file
而且,没有办法(缺少某种Excel加载项)让客户端的Excel在打开文件时自动自动调整列
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.