问题描述
任何人都可以向我展示(可能是复制/粘贴一个简单的代码示例)如何使用Prawn gem从现有的(.xls)文件创建.pdf文件? (基本上,我需要打开现有文件的命令。)
Can anybody show me (maybe copy/paste a simple code example) how to create the .pdf file from an existing (.xls) file, using the Prawn gem? (Basically, I'd need the command that "opens" the existing file.)
(我在问,因为虾的文档()似乎已经过去了很长一段时间 - 它甚至不能通过Google使用缓存...)
(I'm asking because the Prawn documentation (http://prawn.majesticseacreature.com/docs/) seems to be gone since quite a while - it's not even usable via Google cache...)
非常感谢您的帮助!
Tom
Thanks a lot for any help with this!Tom
推荐答案
我建议您将问题解决。
-
你可以用Ruby阅读xls吗? ,但它最好是片状。但是,您可以,并将xls很好地导出为该格式。
Can you read xls with Ruby? Possibly, but it's flaky at best. However, you can easily read csv, and xls exports nicely to that format.
你可以给一个prawn pdf写一个'表'值吗?
Can you write a 'table' of values to a prawn pdf? Yes
所以,(几乎)所有你需要的是一个小程序,它可以将csv文件解析成对虾友好的表结构,然后将它交给Prawn生成。
So, (almost) all you need is a little program that can parse a csv file into a prawn-friendly table-structure and then hand it off to Prawn for generation.
这篇关于大虾宝石:如何从*现有*文件(.xls)创建.pdf的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!