-- 作者:jiterp
-- 发布时间:2020/2/9 22:50:00
--
自己捉摸出来了,曲线实现。
\'定义HTM文件内容 Dim htm As String = "<!DOCTYPE html>" & vbcrlf htm = htm & "<html>" & vbcrlf htm = htm & "<head>" & vbcrlf htm = htm & "<meta http-equiv=" & """" & "Content-Type" & """" & " c""" & "text/html; charset=utf-8" & """" & " />" & vbcrlf htm = htm & "</head>" & vbcrlf htm = htm & "<body>" & vbcrlf htm = htm & Tables("sy_files").Current("filetext") & vbcrlf \'指定单元格HTM代码内容 htm = htm & "</body>" & vbcrlf htm = htm & "</html>"
\'生在HTM文件 FileSys.WriteAllText(ProjectPath & "print.htm",htm, True)
\'生成Doc文件 Dim s As String = FileSys.ReadAllText(ProjectPath & "print.htm") \'这里是读取html文件内容,也可以改为取HTML编辑器的网页内容 Dim sw As new io.StreamWriter("d:\\abc.doc", False, system.text.Encoding.GetEncoding("utf-8")) sw.WriteLine(s) sw.Flush() sw.Close()
|