在Linux中使用php或ruby操纵word docs(doc,docx等) [英] Manipulating word docs (doc, docx, etc) in linux with php or ruby

查看:83
本文介绍了在Linux中使用php或ruby操纵word docs(doc,docx等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有用户在我的网页上载Word文档.我需要打开这些文档,以html显示它们,并允许用户下载经过操纵的版本.

我的网络服务器允许我使用PHP和Rails.因此,使用任何一种语言的解决方案都是可以接受的.

我在研究中发现了许多其他帖子,例如LiveDocx,似乎更适合于使用已知模板创建Word文档.还有我的网络服务器不支持的Java POI. 我还发现了有关do​​cx的信息,因此我可以将其解压缩并调整xml文件-很棒,除了我想接受比单独的docx更多的扩展名.

这是我最后一次尝试寻找该问题的另一种解决方案的方法.有什么建议?我是否只需要切换到Windows服务器? (即使使用Windows服务器,我也可以做我想做的事吗?)

解决方案

您不是在说需要应用哪种类型的操作,也不是在服务器上安装任何新的东西,但是如果可以的话,您可以安装OpenOffice. (或@Rok指出的Libreoffice),然后通过命令行从脚本中访问它.

OoO可以转换各种办公格式,包括过去和当前的Microsoft办公格式,PDF和HTML,我认为这是可用于此类工作的最佳工具.

您可以在转换后的HTML视图中显示文档,或者如果它不起作用(如果可以的话,我想它会破坏复杂文档中的 lot !),并嵌入PDF在iframe中也应该如此.

OpenOffice.org论坛条目提供了一些起点. /p>

:如果您无法安装任何软件,则有第三方Web服务可以进行转换,大部分都是付费的. 此处是一个示例. /p>

I have users uploading word documents on my webpage. I need to open these documents, display them in html, and allow the user to download a manipulated version.

My webserver allows me to use PHP and Rails. So a solution in either language would be acceptable.

I have found numerous other posts in my research such as LiveDocx which seems to be more geared only towards creating word documents with known templates. And Java POI which isn't supported by my webserver. I have also found information on docx such that I can just unzip it and tweak the xml files -- which would be great except that I would like to accept more extensions than docx alone.

This is my last ditch attempt to find another solution to this problem. Any suggestions? Am I just going to have to switch to a windows server? (even with a windows server, can I do what I want?)

解决方案

You are not saying what kinds of manipulations you need to apply, nor whether you can install anything new on the server, but if you can, you could install OpenOffice (or Libreoffice as pointed out by @Rok) and access it from your script through the command line.

OoO can convert all sorts of office formats, including past and current Microsoft office ones, PDF and HTML, and is I think the best tool available for this kind of job.

You could display documents in a converted HTML view, or if that doesn't work (I imagine it would break a lot inside complex documents, if it works at all!), a PDF embedded in an iframe, which should be just as well.

This OpenOffice.org Forum entry provides some starting points.

Edit: If you can't install any software, there are third party web services that do conversions, most for a fee. Here is an example.

这篇关于在Linux中使用php或ruby操纵word docs(doc,docx等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆