Ruby Ruby 操作 Word

ikbear · April 20, 2012 · Last by tumayun replied at April 20, 2012 · 4064 hits

用 Ruby 将 Word 中的代码片段根据相应的代码语法高亮,怎么弄呢?

用 pygments 生成高亮后的代码到 html,然后复制代码到 Word 里面,Word 中的复制应该是带格式的,所以颜色应该还是有的

#1 楼 @andor_chen 我现在是需要对 word 中原有的很多很多代码片段进行高亮显示,所以必须操作 word。但是,查找 word 中的代码片段应该很有难度。

http://ilstar.blogbus.com/logs/56861313.html 找个高亮库,按这里的操作一下应该可以了

win32ole 曾经 excel 中实现过类似功能 你可以录制宏 看看 vba 代码 然后用 win32ole 实现

You need to Sign in before reply, if you don't have an account, please Sign up first.