Ruby on Rails:有没有办法将word转换为html?
也许还有一种批量转换的方法?
maybe a way to batch convert also?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
也许还有一种批量转换的方法?
maybe a way to batch convert also?
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
接受
或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
发布评论
评论(2)
您可以使用 Google Docs API 上传和转换 .doc。
http://code.google.com/apis/documents/overview.html
一些示例和代码:http://code.google.com/apis/documents/code。 html
Ruby 示例和演示:
http://code.google.com/ p/gdata-samples/source/browse/#svn/trunk/doclist/DocListManager
http://doclistmanager.googlecodesamples.com/
You could use Google Docs API to upload and convert .doc's.
http://code.google.com/apis/documents/overview.html
Some samples and code: http://code.google.com/apis/documents/code.html
Ruby example and demo:
http://code.google.com/p/gdata-samples/source/browse/#svn/trunk/doclist/DocListManager
http://doclistmanager.googlecodesamples.com/
简短的回答是否定的,但长期的回答是有点。
MS Word 本身会将文件保存为 html - 但这完全是一团糟。在某种程度上,这只是因为直接将Word文件转换为html的客户群并不担心它是马虎的,所以Word并没有努力做出干净的输出。另一方面,它本质上是困难的,因为 Word 旨在创建固定大小的非动态文档,就像纸质书籍一样。因此,转换为其他静态格式(例如 PDF)很容易,但如何转换为 HTML?你只是让文字流动起来吗?您设置的宽度是否有望使布局保持不变?如果 Word 文档中的字体或布局元素在 HTML 渲染器中不可用怎么办?
最简单的事情是逐个项目地进行 - 例如,您可以创建 DTD 来转换 RTF 文件 - 但这涉及您对如何转换这些文件做出程序员级别的决定。
The short answer is no, but the long answer is sorta.
MS Word itself will save a file out as html - but it's a total friggin' mess. To an extent this is simply because the customer base that is converting word files to html directly are not concerned about it being sloppy, so Word hasn't worked hard on making a clean output. On the other hand, it's intrinsically difficult, because word is oriented to create fixed size, non-dynamic documents, like a paper-base book. So it's easy to convert to other static formats (say a PDF), but how do you convert to HTML? Do you just make the text flow across? Do you set a width that will hopefully make the layout stay the same? What if there is fonts or layout elements in the word doc that are not available in the HTML renderer?
The easiest thing to do is to do it project by project - you can create a DTD to convert an RTF file, for instance - but this involves you making programmer level decisions about how these will be converted.