html网页转换成word文档,转换成功,并且可以保存图片,但是总是为"web版式"的格式,怎么改成“页面”格式,多谢
html网页转换成word文档,转换成功,并且可以保存图片,但是总是为"web版式"的格式,怎么改成“页面”格式,多谢
日期:2014-05-18 浏览次数:20511 次
html网页转换成word文档,转换成功,并且可以保存图片,但是总是为"web版式"的格式,如何改成“页面”格式,谢谢
转换成功,并且可以保存图片,但是总是为"web版式"的格式,如何改成“页面”格式,谢谢
Word.Document thisDocument = null;
Word.FormFields formFields = null;
Word.Application thisApplication = new Word.ApplicationClass();
thisApplication.Visible = true;
thisApplication.Caption = "";
thisApplication.Options.CheckSpellingAsYouType = false;
thisApplication.Options.CheckGrammarAsYouType = false;
Object ConfirmConversions = false;
Object ReadOnly = true;
object AddToRecentFiles = true;
Object PasswordDocument = System.Type.Missing;
Object PasswordTemplate = System.Type.Missing;
Object Revert = System.Type.Missing;
Object WritePasswordDocument = System.Type.Missing;
Object WritePasswordTemplate = System.Type.Missing;
Object Format = System.Type.Missing;//
Object Encoding = System.Type.Missing;
Object Visible = System.Type.Missing;
Object OpenAndRepair = System.Type.Missing;
Object DocumentDirection = System.Type.Missing;
Object NoEncodingDialog = System.Type.Missing;
Object XMLTransform = System.Type.Missing;
object FileFormat = Word.WdSaveFormat.wdFormatDocument;
object SaveNativePictureFormat = false;
object LineEnding = Word.WdLineEndingType.wdCRLF;//Word.WdLineEndingType.wdLSPS;
Word.ApplicationClass word = new ApplicationClass();
object nothing = System.Reflection.Missing.Value;
//路径
object filename = "D:\\test.html";
string FileName="D:\\test.doc";
Word.Document doc =
thisApplication.Documents.Open(ref filename, ref ConfirmConversions,
ref ReadOnly, ref AddToRecentFiles, ref PasswordDocument, ref PasswordTemplate,
ref Revert, ref WritePasswordDocument, ref WritePasswordTemplate, ref Format,
ref Encoding, ref Visible, ref OpenAndRepair, ref DocumentDirection,
ref NoEncodingDialog, ref XMLTransform);
//doc.Paragraphs.Last.Range.Text = this.richTextBox1.Text;
object myfileName = FileName;
//将WordDoc文档对象的内容保存为doc文档
doc.SaveAs(ref myfileName,ref FileFormat, ref nothing, ref nothing, ref AddToRecentFiles, ref nothing, ref nothing, ref nothing,ref SaveNativePictureFormat, ref nothing, ref nothing, ref nothing, ref nothing, ref nothing, ref LineEnding, ref nothing);
//关闭WordDoc文档对象
doc.Close(ref nothing, ref nothing, ref nothing);
//关闭WordApp组件对象
word.Quit(ref nothing, ref nothing, ref nothing);
Response.Write("successfully!");
System.Diagnostics.Process[] ps = System.Diagnostics.Process.GetProcesses();
foreach (System.Diagnostics.Process p in ps)
{
if (p.ProcessName.ToLower().CompareTo("winword") == 0)
p.Kill();
}
------解决方案--------------------
不知道 友情帮顶
免责声明: 本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。