Ruby on Rails:有没有办法将word转换为html?

发布于 2024-09-08 08:49:50 字数 21 浏览 2 评论 0原文

也许还有一种批量转换的方法?

maybe a way to batch convert also?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

离去的眼神 2024-09-15 08:49:50

简短的回答是否定的,但长期的回答是有点。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文