本文介绍了使用Interop将Word文本添加到Word中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试使用Office Interop将一些HTML格式的文本添加到Word中。我的代码如下所示:
$ b $ pre $ Clipboard.SetText(notes,TextDataFormat.Html);
pgCriteria.Range.Paste();
但它会抛出Command Failed异常。任何想法?
解决方案
花费数小时后,解决方案就是使用这个优秀的类
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 classhttp://blogs.msdn.com/jmstall/pages/sample-code-html-clipboard.aspx
这篇关于使用Interop将Word文本添加到Word中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!