网站首页 > 书籍教程 > ASP教程 > ASP生成输出DOC(Word文件)

ASP生成输出DOC(Word文件)

  • 作者:互联网
  • 时间:2009-06-26 18:10:24

< %
const lie=3    '修改列数
const tablewidth="33%" '定义表格的宽度
const tableheight="18%" '定义表格的高度
const imgwidth="15%" '定义表格的宽度
const imgheight="27.5%" '定义表格的高度
const fontsize="12px;" '定义文字的大小
const txtwidth="120"    '图片右侧文字表格宽
const txtheight="18%"    '图片右侧文字表格高
const txtalign="left"    '图片右侧文字对齐方式:left左,center中,right右

'TOP 强调该文件为Word文件
function doctop()
    doctop="http://ww***.org/TR/REC-html40"">>生成结果co***nt=Word.Document>"+chr(13)+chr(10)
end function

function imgtotable(fto,fpar,dext)
    imgtotable=""
    imgtotable=imgtotable+""
    imgtotable=imgtotable+"
"
    imgtotable=imgtotable+"
"&replace(lcase(fto.name),"."&dext,"")&"
演员
语言
容量
类型
"
    imgtotable=imgtotable+"
"+chr(13)+chr(10)
end function


function imagetodoc(fpath,fpar)
    set ft***so.createtextfile(fpath&"/运行结果.doc",True)
    ft***riteline doctop()
    ft***riteline "
"
    for each demo in fp***.files
        dext=Lcase(fs***etExtensionName(demo))
        if dext="jpg" or dext="gif" or dext="png" then
            if (i mod lie)=0 then ft***riteline "   
"+chr(13)+chr(10)
            i=i+1
            ft***riteline ""+chr(13)+chr(10)
            if (i mod lie)=0 then i=0:ft***riteline "    "+chr(13)+chr(10)
        end if
    next
    ft***lose
    re***nse.write "
"
            '用于排错
            'ft***riteline "123"
            ft***riteline imgtotable(demo,fpar,dext)
            ft***riteline "
"
    re***nse.write ""&fpo&fpath&"运行结果.doc"" 生成完毕。
"
    set fto=nothing
end function

set fs***erver.createobject("sc***ting.filesystemobject")
set fp***so.getfolder(se***r.mappath("./"))
for each demo in fp***ubfolders
    call imagetodoc(demo,"")
next
set fpo=nothing
set fso=nothing
%>