<%
const lie=3 'Modify the number of columns
const tablewidth="33%" 'Define the width of the table
const tableheight="18%" 'Define the height of the table
const imgwidth="15%" 'Define the width of the table
const imgheight="27.5%" 'Define the height of the table
const fontsize="12px;" 'Define the size of the text
const txtwidth="120" 'The width of the text table on the right side of the picture
const txtheight="18%" 'The height of the text table on the right side of the picture
const txtalign="left" 'Text alignment on the right side of the picture: left, center, right'TOP
emphasizes that the file is a Word file
functiondoctop()
doctop="<html xmlns:v=""urn:schemas-microsoft-com:vml"" xmlns:o=""urn:schemas-microsoft-com:office:office"" xmlns:w=""urn:schemas -microsoft-com:office:word"" xmlns="" http://www.w3.org/TR/REC-html40""><head><title >Generate results</title><meta http-equiv= Content-Type content=""text/html; charset=gb2312""></meta><meta name=ProgId content=Word.Document></meta><meta name=Generator content=""Microsoft Word 10"" ></meta><meta name=Originator content=""Microsoft Word 10""><style type=""text/css"">@page Section1{margin:30pt 8.5pt 5.65pt 12pt;}div.Section1{ page:Section1;}table{font-size:"&fontsize&"}</style></meta></head>"+chr(13)+chr(10)
end function
function imgtotable(fto,fpar,dext)
imgtotable="<table width="&tablewidth&" height="&tableheight&" border=0>"
imgtotable=imgtotable+"<tr valign=""top""><td><img src="""&replace(demo,fpar,"")&""" width="""&imgwidth&""" height="" "&imgheight&"""/></td>"
imgtotable=imgtotable+"<td colspan=""2"" align=""center"">"
imgtotable=imgtotable+"<table width="&txtwidth&" height="&txtheight&"><tr><td align="""&txtalign&""">"&replace(lcase(fto.name),"."&dext,"") &"</td></tr><tr><td align="""&txtalign&""">Actor</td></tr><tr><td align="""&txtalign&""">Language </td></tr><tr><td align="""&txtalign&""">Capacity</td></tr><tr><td align="""&txtalign&""">Type</td></tr><tr><td td></tr></table>"
imgtotable=imgtotable+"</td></tr></table>"+chr(13)+chr(10)
end function
function imagetodoc(fpath,fpar)
set fto=fso.createtextfile(fpath&"/Run result.doc",True)
fto.writelinedoctop()
fto.writeline "<body topmargin=0 leftmargin=0><table width=""64"" height=""100%"" border=1><div class=Section1>"
for each demo in fpath.files
dext=Lcase(fso.getExtensionName(demo))
if dext="jpg" or dext="gif" or dext="png" then
if (i mod lie)=0 then fto.writeline " <tr>"+chr(13)+chr(10)
i=i+1
fto.writeline "<td>"
'for troubleshooting
'fto.writeline "123"
fto.writeline imgtotable(demo,fpar,dext)
fto.writeline "</td>"+chr(13)+chr(10)
if (i mod lie)=0 then i=0:fto.writeline " </tr>"+chr(13)+chr(10)
end if
next
fto.close
response.write "</div></table></body>"
response.write ""&fpo&fpath&"Run result.doc"" Generation completed.<br />"
set fto=nothing
end function
set fso=server.createobject("scripting.filesystemobject")
set fpo=fso.getfolder(server.mappath("./"))
for each demo in fpo.subfolders
call imagetodoc(demo,"")
next
set fpo=nothing
set fso=nothing
%>