使用Perl或Ruby提取Excel单元格评论的最佳方式是什么? [英] What's the best way to extract Excel cell comments using Perl or Ruby?
问题描述
我一直在Perl中使用 Spreadhsheet :: ParseExcel (如在Perl中解析Excel文件的最佳方法是什么?)中的建议)但我不知道如何提取单元格评论。
任何想法?一个解决方案是使用Ruby的win32ole库。
$ b
以下(稍微详细)的示例连接到打开的Excel工作表,并从单元格B2获取注释文本。
code> require'win32ole'
xl = WIN32OLE.connect('Excel.Application')
ws = xl.ActiveSheet
cell = ws.Range('B2 ')
comment = cell.Comment
text = comment.Text
更多使用Ruby的win32ole库自动化Excel的信息和示例可以在这里找到:
http://rubyonwindows.blogspot.com/search/label/excel
I've been parsing Excel documents in Perl successfully with Spreadhsheet::ParseExcel (as recommended in What's the best way to parse Excel file in Perl?), but I can't figure out how to extract cell comments.
Any ideas? A solution in Perl or Ruby would be ideal.
One option is to use Ruby's win32ole library.
The following (somewhat verbose) example connects to an open Excel worksheet and gets the comment text from cell B2.
require 'win32ole'
xl = WIN32OLE.connect('Excel.Application')
ws = xl.ActiveSheet
cell = ws.Range('B2')
comment = cell.Comment
text = comment.Text
More info and examples of using Ruby's win32ole library to automate Excel can be found here:
http://rubyonwindows.blogspot.com/search/label/excel
这篇关于使用Perl或Ruby提取Excel单元格评论的最佳方式是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!