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
相关文档:
<%
Private Const BITS_TO_A_BYTE = 8
Private Const BYTES_TO_A_WORD = 4
Private Const BITS_TO_A_WORD = 32
Private m_lOnBits(30)
Private m_l2Power(30)
Private Function LShift(lValue, iShiftBits)
If iShiftBits = 0 Then
LShift = lValue
Exit Function
ElseIf iShiftBi ......
2、纯ASP代码生成图表函数——柱图
<%
dim total(12,2)
total(1,1)=56
total(2,1)=7
total(3,1)=-7
total(4,1)=0
total(5,1)=16
total(6,1)=10
total(7,1)=14
total(8,1)=7
total(9,1)=9
total(10,1)=7
total(11,1)=11
total(12,1)=14
total(1,2)="地理"
total(2,2)="化学"
total(3,2)="历史 ......
<%
Set fso = CreateObject("Scripting.FileSystemObject")
Set fldr = fso.GetFolder("c:\Program Files")
Response.Write "父文件夹名字是:" & fldr & "<br>"
If fldr.IsRootFolder = True Then
Response.Write "该文件夹是一根文件夹" & "<br>"
Else
Resp ......
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%response.ContentType ="application/vnd.ms-excel"
%>
<%
Set xlApplication = Server.CreateObject("Excel.Application") '调用excel对象
xlApplication.Visible = False '无需打开excel
xlApplication.SheetsInN ......