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

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

问题描述

我正在尝试使用 Office Interop 向 Word 添加一些 HTML 格式的文本.我的代码如下所示:

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?

推荐答案

花了几个小时的解决方案是使用这个优秀的类http://blogs.msdn.com/jmstall/pages/示例代码-html-clipboard.aspx

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

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

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