使用Interop将Word文本添加到Word中 [英] Adding html text to Word using Interop

查看:176
本文介绍了使用Interop将Word文本添加到Word中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Office Interop将一些HTML格式的文本添加到Word中。我的代码如下所示:
$ b $ pre $ Clipboard.SetText(notes,TextDataFormat.Html);
pgCriteria.Range.Paste();

但它会抛出Command Failed异常。任何想法?

解决方案

花费数小时后,解决方案就是使用这个优秀的类
http://blogs.msdn.com/jmstall/pages/sample-code-html- clipboard.aspx


I'm trying to add some HTML formatted text to Word using Office Interop. My code looks like this:

Clipboard.SetText(notes, TextDataFormat.Html);
pgCriteria.Range.Paste();

but it's throwing a Command Failed exception. Any idea?

解决方案

After spending several hours the solutions is to use this excellent class http://blogs.msdn.com/jmstall/pages/sample-code-html-clipboard.aspx

这篇关于使用Interop将Word文本添加到Word中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆