Generate Excel Documents:
Copy the codeThe code is as follows:
<%
'Create a file
dim templateName,templatechar,filepath,filename,fileCharset,templateContent
templateName="template/template_excel.htm" 'Template name, supports paths such as "/moban/" or "temp/"
templatechar="gb2312" �
filepath="files/excel/" �
filename="" �
CreateMultiFolder(filepath) 'This sentence is used to determine whether a folder exists. If it does not exist, it will be automatically created and supports n-level directories.
fileCharset="gb2312" �
'Read the specified template content
templateContent=ReadFromTextFile(templateName,templatechar)
'The following is for you to replace the template content.
templateContent=replace(templateContent,"{$websiteName}","blue ideal")
templateContent=replace(templateContent,"{$userName}","Happy Bullet")
templateContent=replace(templateContent,"{$now}",Now())
'Other content...
'The final call to generate the file
Call WriteToTextFile(filepath&filename,templateContent,fileCharset)
'The object is closed at the end
set stm=nothing
downloadFile(filepath&filename)
%>
Generate .htm static page
Copy the codeThe code is as follows:
<%
'Create a file
dim templateName,templatechar,filepath,filename,fileCharset,templateContent
templateName="template/template_html.htm" 'Template name, supports paths such as "/moban/" or "temp/"
templatechar="gb2312" �
filepath="files/html/"
filename="" �
CreateMultiFolder(filepath) 'This sentence is used to determine whether a folder exists. If it does not exist, it will be automatically created and supports n-level directories.
fileCharset="gb2312" �
'Read the specified template content
templateContent=ReadFromTextFile(templateName,templatechar)
'The following is for you to replace the template content.
templateContent=replace(templateContent,"{$websiteName}","blue ideal")
templateContent=replace(templateContent,"{$userName}","Happy Bullet")
templateContent=replace(templateContent,"{$now}",now())
'Other content...
'The final call to generate the file
Call WriteToTextFile(filepath&filename,templateContent,fileCharset)
'The object is closed at the end
set stm=nothing
("Congratulations, "&filename&" has been generated, <a href="""&filepath&filename&""" target=""_blank""">Click to view</a>")
%>
Package file download