易截截图软件、单文件、免安装、纯绿色、仅160KB

asp导出excel二

<!--#include file=common.asp-->
<%
'**********************************************
' code by asp导出excel通用
' 修改引用 by 子言(jastudio)
' qq:23638564 email:kpggdf@163.com
' web:www.gdsspt.com
'**********************************************
dim xibua
dim mysql
xibua = request.querystring("ids")
if xibua="all" then
mysql = "select * from singup"
else
mysql = "select * from singup where [系部]='"&xibua&"'"
end if
server.scripttimeout=100000 '处理时间较长,设置值应大一点
on error resume next
set objexcelapp = createobject("excel.application")
objexcelapp.displayalerts = false
objexcelapp.application.visible = false
objexcelapp.workbooks.add
set objexcelbook = objexcelapp.activeworkbook
set objexcelsheets = objexcelbook.worksheets
set objspreadsheet = objexcelbook.sheets(1)
dim objrs
set objrs = server.createobject("adodb.recordset")
objrs.open mysql,conn,1,3
if objrs.eof then
response.write("error")
respose.end
end if
dim objfield, icol, irow
icol = 1 '取得列号
irow = 1 '取得行号
objspreadsheet.cells(irow, icol).value = ""&xibua&"部的报名情况" '单元格插入数据
objspreadsheet.columns(icol).shrinktofit=true '设定是否自动适应表格单元大小(单元格宽不变)
'设置excel表里的字体
objspreadsheet.cells(irow, icol).font.bold = true '单元格字体加粗
objspreadsheet.cells(irow, icol).font.italic = false '单元格字体倾斜
objspreadsheet.cells(irow, icol).font.size = 20 '设置单元格字号
objspreadsheet.cells(irow, icol).paragraphformat.alignment=1 '设置单元格对齐格式:居中
objspreadsheet.cells(irow,icol).font.name="宋体" '设置单元格字体
objspreadsheet.cells(irow,icol).font.colorindex=2 '设置单元格文字的颜色,颜色可以查询,2为白色
objspreadsheet.range("a1:f1").merge '合并单元格(单元区域)
objspreadsheet.range("a1:f1").interior.colorindex = 1 '设计单元络背景色
'objspreadsheet.range("a2:f2").wraptext=true '设置字符回卷(自动换行)
irow=irow+1
for each objfield in objrs.fields
'objspreadsheet.columns(icol).shrink


相关文档:

asp正则表达式判断是否是数字

'判断是否是数字(包括整数和浮点数)
function IsNumber(str)
if RegPatrn("^-?[1-9]\d*$",str) or RegPatrn("^-?([1-9]\d*\.\d*|0\.\d*[1-9]\d*|0?\.0+|0)$",str) then
IsNumber=true
else
IsNumber=false
end if
end function
'正则表达式判断是否匹配
Function RegPatrn(patrn, strng)
RegPatrn = false
Di ......

ASP的那些东西(一)

客户端脚本:<script language="scriptlanguage"></script>
服务器端脚本:<% ......%>
Vbscript是visual basic的一个子集,虽然限制了可以使用的内置函数的数量,但是也使得他非常小巧,从而提高了可移植性
Variant是vbscript的唯一数据类型,有13种子类型:
Empty,Null,Boolean,Byte,Integer,Curre ......

ASP 常用函数积累

LBound() 函数: 返回指定的数组维可用的最小下标。
UBound() 函数: 返回指定的数组维可用的最大下标。
InStr([start, ]string1, string2[, compare]) 返回字符或字符串在另一个字符串中第一次出现的位置
InStrRev()函数 返回某字符串在另一个字符串中最后出现的位置
CDate() 函数可把一个合法的日期和时间表达式转换为 ......

ASP编程中20个非常有用的例子

ASP编程中20个非常有用的例子  
 
 
1.如何用Asp判断你的网站的虚拟物理路径
答:使用Mappath方法
<%= Server.MapPath("\")%>
2.我如何知道使用者所用的浏览器?
答:使用the Request object方法
strBrowser=Request.ServerVariables("HTTP_USER_AGENT")
If Instr(strBrowser,"MSIE") & ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号