请问高手,可以把ASP中生成的报表倒入到word或excel中吗。具体则么实现,谢谢

请问高手,可以把ASP中生成的报表倒入到word或excel中吗。具体则么实现,谢谢
---------------------------------------------------------------

sub Import2Xls()
'把结果转存到Excel中

dim objXls
dim sSql
dim iCount
dim iIndex,idir,istr,iend,count,ipage,userunit,line,str_text, a, b, l_start, x, lc, acount
dim ObjChk, userkey, groupkey
set obj=CreateObject("Excel.Application")
obj.Visible=True
obj.Workbooks.Add
if Err.number <> 0 then
'出错
obj.quit
set obj=Nothing
msgbox "本机没有安装Excel或者生成新文件时出错!",16,"输出到Excel"
else
.columns.columnwidth =3.75 '栏宽
.Rows.RowHeight = 22
.columns(1).columnwidth = 23.75 '栏宽
.columns(1).HorizontalAlignment = -4131 '格式居左
.rows(1).rowheight = 120
.rows(1).VerticalAlignment= -4160
.rows(1).Orientation = -4166

1If Request("ShowStyle")="PowerTop" then

GroupList true, 2, obj
UserList false, 2, obj
PowerList true, obj

1Elseif Request("ShowStyle")="UserTop" then

GroupList false, 2, obj
UserList true, 2, obj
PowerList false, obj

1End if

with .Range(.Cells(1,1), .Cells(rowcount + 1, colcount + 1)).Borders(7) '画左边界
.LineStyle = 1
.Weight = -4138
.ColorIndex = -4105
End with
with .Range(.Cells(1,1), .Cells(rowcount + 1, colcount + 1)).Borders(8) '画上边界
.LineStyle = 1
.Weight = -4138
.ColorIndex = -4105
End with
with .Range(.Cells(1,1), .Cells(rowcount + 1, colcount + 1)).Borders(9) '画右边界
.LineStyle = 1
.Weight = -4138
.ColorIndex = -4105
End with
with .Range(.Cells(1, 1), .Cells(rowcount + 1, colcount + 1)).Borders(10) '画下边界
.LineStyle = 1
.Weight = -4138
.ColorIndex = -4105
End with
with .Range(.Cells(1,1), .Cells(rowcount + 1, colcount + 1)).Borders(11) '画下边界
.LineStyle = 1
.Weight = 2
.ColorIndex = -4105
End with
with .Range(.Cells(1,1), .Cells(rowcount + 1, colcount + 1)).Borders(12) '画下边界
.LineStyle = 1
.Weight = 2
.ColorIndex = -4105
End with
End with
rowcount = 0
colcount = 0
End if
end sub

sub PowerList(flag, obj)
Dim x, y, c, a, str_key, str_sql, l_start, location, b, b_start, str_bkey

If flag= true then
x = rowcount
y = colcount
Else
x = colcount
y = rowcount
End if
l_start=1

for a = 1 to y
location=dhCountTime(Userskey,";", a)
str_key=Mid(Userskey, l_start, location - l_start)
l_start=location + 1

str_sql="select user_sincluder from ksweb_usertable where user_ssyskey='``` =sAppkey

 1FunRunADC(str_sql)   
 2  
 3If ADC.Recordset.RecordCount &gt; 0 then   
 4If len(Trim(ADC.Recordset("user_sincluder"))) &gt; 0 then   
 5b_start=1   
 6for b = 1 to x   
 7location=dhCountTime(UserGroupkey,";", b)   
 8str_bkey=Mid(UserGroupkey, b_start, location - b_start)   
 9b_start=location + 1   
10If instr(1, Trim(ADC.Recordset("user_sincluder")), str_bkey) &gt; 0 then   
11If flag=true then   
12obj.ActiveWorkBook.Activesheet.Cells(b+1, a+1)="√"   
13Else   
14obj.ActiveWorkBook.Activesheet.Cells(a+1, b+1)="√"   
15end if   
16end if   
17next   
18End if   
19End if   
20next   
21End sub
Published At
Categories with Web编程
comments powered by Disqus