ASP生成word文档怎么样使它默认以普通页面视图打开
导EXCEL行不行??我自己写的0 then err.clear CreateFolder=False else CreateFolder=True end if End function '创建文件 Function CreateFile(FileName,Content) on error resume next FileName=Server.Mappath(FileName) Set FSO = Server.CreateObject("Scripting.FileSystemObject") set fd=FSO.createtextfile(FileName,true) fd.writeline Content if err>0 then err.clear CreateFile=False else CreateFile=True end if End function '删除文件 function DeleteFile(FileName) on error resume next Set FSO = Server.CreateObject("Scripting.FileSystemObject") if FSO.FileExists(FileName) then FSO.DeleteFile FileName,true end if if err>0 then err.clear DeleteFile=False else DeleteFile=True end if end function '删除文件夹 function DeleteFolder(Folder) on error resume next Folder=server.MapPath(Folder) Set FSO = Server.CreateObject("Scripting.FileSystemObject") if FSO.FolderExists(Folder) then FSO.Deletefolder Folder,true end if if err>0 then err.clear Deletefolder=False else Deletefolder=True end if end function %>"" then strLine=strLine&checkusername(request.Cookies("mdsusername"),rs("q_weixinnumber"))& chr(9) else strLine=strLine&rs("q_weixinnumber")& chr(9) end if strLine=strLine&rs("q_time")& chr(9) strLine=strLine&rs("q_oktime")& chr(9) strLine=strLine&checkuserphone(request.Cookies("mdsusername"),rs("q_weixinnumber"))&chr(9)myfile.writeline strLine rs.MoveNext loop end ifrs.Closeset rs = nothingconn.closeset conn = nothingset myfile = nothingSet fs=Nothing'读取写入信息此操作本地成功远程提示没有'CreateObject'权限set objExcelApp = CreateObject("Excel.Application") objExcelApp.DisplayAlerts = false '不显示警告 objExcelApp.Application.Visible = false '不显示界面objExcelApp.WorkBooks.Open(filepath) set objExcelBook = ...
ASP生成utf
用下面这个自定义函数就可以:Call WriteTextFile(server.mappath("../config.asp"),"内容","UTF-8")'----写入文件------------------------Sub WriteTextFile(filePath,fileContent,CharSet)dim objStreamset objStream=Server.CreateObject("adodb.stream")with objStream.Type=2.Mode=3.charset=utf-8.Open.WriteText fileContent.SaveToFile filePath,2.Flush.Closeend withset objStream=nothingEnd Sub
关于.net打印word问题,急!!!
ASP.NET利用dot模板生成Word文档代码,假定有一个模板文件位于网站Mywebsite/templates/a.dot,现在需要利用Word.ApplicationClass和Word.Document类来生成一个word文档。
关键代码如下: //初始化生成word文档需要的信息 Word.Application appWord =null; Word.Document doc = null; try { appWord = new Word.ApplicationClass(); appWord.Visible = false; object objTrue = true; object objFalse = false; object objTemplate = Server.MapPath(@"templates\a.dot");//模板路径 object objDocType = Word.WdDocumentType.wdTypeDocument; doc = appWord.Documents.Add(ref objTemplate, ref objFalse, ref objDocType, ref objTrue); //第一步生成word文档 //定义书签变量 object obDD_Name = "DD_Name";//姓 名 object obDD_Sex = "DD_Sex";//性 别 object obDD_Age = "DD_Age";//年龄 object obDD_Birthday = "DD_Birthday"; //出生年月 object obDD_Nation = "DD_Nation"; //民 族 object obDD_Native = "DD_Native"; //籍 贯 //第二步 读取数据,填充数据集 SqlDataReader dr = XXXXX;//读取出来的数据集 //第三步 给书签赋值 //给书签赋值 doc.Bookmarks.get_Item(ref obDD_Name).Range.Text = dr["appliername"].ToString(); //姓 名 doc.Bookmarks.get_Item(ref obDD_Sex).Range.Text = getCodeFullNameStd("性别", dr["Sex"].ToString());//性 别 doc.Bookmarks.get_Item(ref obDD_Age).Range.Text = Convert.ToString(DateTime.Now.Year - ((DateTime)dr["Birthday"]).Year);//年龄 . //第四步 生成word object filename = Server.MapPath("file") + "\\" + "XXXXXXXXXX情况表" +".doc"; object miss = System.Reflection.Missing.Value; doc.SaveAs(ref filename, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss, ref miss); object missingValue = Type.Missing; object doNotSaveChanges = Word.WdSaveOptions.wdDoNotSaveChanges; doc.Close(ref doNotSaveChanges, ref missingValue, ref missingValue); appWord.Application.Quit(ref miss, ref miss, ref miss); doc = null; appWord = null; } catch (System.Exception e) { //捕捉异常,如果出现异常则清空实例,退出word,同时释放资源 string aa = e.ToString(); object miss = System.Reflection.Missing.Value; object missingValue = Type.Missing; object doNotSaveChanges = Word.WdSaveOptions.wdDoNotSaveChanges; doc.Close(ref doNotSaveChanges, ref missingValue, ref missingValue); appWord.Application.Quit(ref miss, ref miss, ref miss); doc = null; appWord = null; }
用什么程序可以打开扩展名为 .asp 的文件
简单说一下: 1、安装IIS,windows 自带的,在添加删除组件里面有。
2、把asp文件放在一个目录下,比如c:\asp,然后鼠标右键打开目录的属性-》web共享-》共享文件夹,起一个别名,比如asp ,记住asp的文件名,比如叫default.asp 3、打开ie浏览器,输入http://localhost/asp/default.aspASP即Active Server Page的缩写。
它是一种包含了使用VB Script或Jscript脚本程序代码的网页。
当浏览器浏览ASP网页时, Web服务器就会根据请求生成相应的HTML代码然后再返回给浏览器,这样浏览器端看到的 就是动态生成的网页。
ASP是微软公司开发的代替CGI脚本程序的一种应用,它可以与数据库和其它程序进行交互。
是一种简单、方便的编程工具。
在了解了VBSCRIPT的基本语法后,只需要清楚各个组件的用途、属性、方法,就可以轻松编写出自己的ASP系统。
ASP的网页文件的格式是.ASP。
用记事本,FRONTPAGE,DW都可以打开,不过打开后你只能看到代码,不能看到页面,不过要注意,有些是把mdb数据库文件改名为asp的,如果出现乱码,有可能就是mdb改的。
还有一种出现乱码的情况,就是asp被加密过。
如果想在本地电脑看到页面内容,你必须自己安装支持ASP的运行环境, WINDOW自带的IIS就可以,没的话就安装一下,呵呵参考资料:http://zhidao.baidu.com/question/1403223.html
转载请注明出处51数据库 » asp动态生成word文档