严重

问题描述

怎么样将.doc.txt.html.htm转换成.htm的格式。要求保存格式不更改。谁有发文系统的

解决方案

解决方案二:
http://web.newsfan.net/archive/index.php?t-159515.html
解决方案三:
谢谢哦。我已经把这个问题给解决了
解决方案四:
///<summary>///文件格式转换///</summary>///<paramname="needformaterfile">需要转换的文件(包括路径)</param>///<paramname="filetype">文件类型</param>privatevoidconvertform(stringneedformaterfile,stringfiletype){//实例化一个ApplicationClass类。用前需要引入usingMicrosoft.Office.Interop.Word;Microsoft.Office.Interop.Word.ApplicationClassword=newMicrosoft.Office.Interop.Word.ApplicationClass();//获取类型TypewordType=word.GetType();//创建目录用System.IO.DirectoryInfodr=null;//文件类System.IO.FileInfofl=null;try{//实例化一个文档对象Microsoft.Office.Interop.Word.Documentsdocs=word.Documents;//获取类型doc文档的类型TypedocsType=docs.GetType();objectfileName=needformaterfile;//创建一个对象用来保存转换的类型文档Microsoft.Office.Interop.Word.Documentdoc=null;//判断文件格式switch(filetype){case".doc":doc=(Microsoft.Office.Interop.Word.Document)docsType.InvokeMember("Open",System.Reflection.BindingFlags.InvokeMethod,null,docs,newObject[]{fileName,Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenFormatDocument,true});break;case".txt":doc=(Microsoft.Office.Interop.Word.Document)docsType.InvokeMember("Open",System.Reflection.BindingFlags.InvokeMethod,null,docs,newObject[]{fileName,Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenFormatAuto,true});break;default:doc=(Microsoft.Office.Interop.Word.Document)docsType.InvokeMember("Open",System.Reflection.BindingFlags.InvokeMethod,null,docs,newObject[]{fileName,Microsoft.Office.Interop.Word.WdOpenFormat.wdOpenFormatAuto,true});break;}//服务器上的路径stringserverpath=Server.MapPath("HtmlFile\qywh\");//转换格式,另存为TypedocType=doc.GetType();//创建目录.....//dr=newSystem.IO.DirectoryInfo("F:\HtmlFile\"+this.ddl_ClassName.SelectedItem.Value.Trim()+"\"+getfilefolder());dr=newSystem.IO.DirectoryInfo(serverpath+this.ddl_ClassName.SelectedItem.Value.Trim()+"\"+getfilefolder());if(dr.Exists==false){dr.Create();}fl=newFileInfo(Server.MapPath("upfile\"+this.lab_InitFileName.Text).ToString());//objectsaveFileName="F:\HtmlFile\"+this.ddl_ClassName.SelectedItem.Value.Trim()+"\"+getfilefolder()+"\"+gettargetfilename()+".htm";//stringstrsaveFileName="F:\HtmlFile\"+this.ddl_ClassName.SelectedItem.Value.Trim()+"\"+getfilefolder()+"\"+gettargetfilename()+".htm";objectsaveFileName=serverpath+this.ddl_ClassName.SelectedItem.Value.Trim()+"\"+getfilefolder()+"\"+gettargetfilename()+".htm";stringstrsaveFileName=serverpath+this.ddl_ClassName.SelectedItem.Value.Trim()+"\"+getfilefolder()+"\"+gettargetfilename()+".htm";docType.InvokeMember("SaveAs",System.Reflection.BindingFlags.InvokeMethod,null,doc,newobject[]{saveFileName,Microsoft.Office.Interop.Word.WdSaveFormat.wdFormatHTML});wordType.InvokeMember("Quit",System.Reflection.BindingFlags.InvokeMethod,null,word,null);
解决方案五:
控件右上角-编辑列-选定的字段下面选择然后往下移就可以了
解决方案六:
不好意思发错了
解决方案七:
为什么在asp。net上出现无法在web服务器上启动调试,无法连接到web服务器。请验证web服务器正在运行,并且防止防火墙没有阻止传入的http请求。。

时间: 2024-09-20 12:19:44