html格式图片可以转换成word文档,html网页转换成word文档,转换成功,并且可以保存图片,但是总是为"web版式"的格式,怎么改成“页面”格式,多谢...

当前位置:我的异常网» C# » html网页转换成word文档,转换成功,并且可以保存图

html网页转换成word文档,转换成功,并且可以保存图片,但是总是为"web版式"的格式,怎么改成“页面”格式,多谢

www.myexceptions.net  网友分享于:2013-06-09  浏览:866次

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();

}

------解决方案--------------------

不知道 友情帮顶

文章评论

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值