如何以编程方式生成申请表/文件?

发布于 2024-08-14 03:02:53 字数 538 浏览 4 评论 0原文

目前,我们使用MS WORD和MS EXCEL来邮寄需要发送给多个收件人的合并文档。

例如,假设有一份投诉表,投诉人需要填写他/她的姓名、地址等。因此,我们设置了一个包含内容的 .doc 文件,并设置了用于邮件合并的动态实体,名称为并将地址详细信息放入 Excel 文件中,我们可以在其中愉快地进行邮件合并以生成所有或仅必要的表格/文档。

但是,我希望自动化此过程,就像网站中的表格一样,投诉人可以在其中填写他/她的姓名、地址和其他详细信息,我们可以使用它自动生成投诉表格并提供下载(最好是 pdf 格式)。

现在,我想到的唯一解决方案是 Latex,这样我就可以替换所需的实体并编译为 PDF。然而,无论虚拟主机是否提供 Latex,这一点都必须与虚拟主机协商。

还有其他解决办法吗?我们可以通过其他方式来完成此任务,并且对于大多数网络托管解决方案来说不应该成为问题吗?

编辑:我更喜欢非 .NET 或者非微软的解决方案,因为服务器运行的是 Linux,虽然 Mono 可能能够完成工作,但我们的开发人员都不知道任何 .NET 语言。然而,如果需要的话,我们可能不得不深入研究它。

At the moment, we use MS WORD and MS EXCEL to mail merge documents that needs to be sent to multiple recepients.

For example, say there is a complaint form where the complainant needs to fill in his/her name, address, etc. So we have a .doc file set up with the content and the dynamic entities set up for mail merging, with the name and address details put in an excel file, from where we can happily mail merge to generate all or just the necessary forms/documents.

However, I would like to automate this process, like a form in a website where the complainant can fill in his/her name, address and other details, and we could use that to generate the complaint form automatically and offer it to be downloaded (preferrably as a pdf).

Now, the only solution that comes to mind, is Latex, so that I can just replace the needed entities and just compile to PDF. However, that bit has to be negotiated with the webhost, if they are offering Latex or not.

Is there any other solution? Any other way we could get this done, with something that shouldn't be a problem for most webhosting solutions to offer?

EDIT: I would prefer a non .NET or rather non microsoft solution since, the servers are running linux and while mono might be capable of getting the job done, none of our devs know any .NET languages. However, if required we might have to dwelve into it.

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

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

发布评论

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

评论(4

一瞬间的火花 2024-08-21 03:02:53

使用 XSL 生成 PDF。检查以下内容: Apoc XSL-FO

您需要使用以下内容创建一个 XML 文件:所需字段并使用此工具对其进行转换。

Generating PDF using an XSL. Check the following: Apoc XSL-FO

You will need to create an XML file with the required fields and transform that with this tool.

所有深爱都是秘密 2024-08-21 03:02:53

如果您希望避免使用 .NET,那么 XSL-FO 值得一看。尝试 FOray 项目。
如果您还没有经验,那么 XSLT 可能会是一个陡峭的学习过程。此外,如果不询问 XSLT 专家,用户将无法更改模板。

如果您的模板已经在 MS Word 和 MS Excel 中,那么我会坚持在服务器上生成 MS 文档。自 OpenXML 以来,现在可以轻松地通过代码使用这些 - 查看 OfficeOpenXMLOpenXMLDeveloper

If you wish to avoid .NET then XSL-FO is worth a look. Try the FOray project.
XSLT can be a steep learn if you do not have experience already. Also users will not be able to change the templates without asking the XSLT guru to do it.

If your templates are already in MS Word and MS Excel then I would stick with generating MS docs on the server. These are now easy to work with from code since OpenXML - check out OfficeOpenXML and OpenXMLDeveloper

寄离 2024-08-21 03:02:53

我建议在服务器上生成 rtf:使用 cpan 的 RTF::Writer 自动生成很容易,具有生成良好 pdf 的转换器,可以在 word、oo-writer 和 oo-writer 中手动编辑。 TextEdit,在主要编辑应用程序之间没有任何非常糟糕的兼容性问题,并且具有不错的文本和文本编辑功能。资源提取工具,其中文本提取比pdf更好。

有一些支持在 rtf 和 rtf 之间移动。乳胶,虽然最好的 rtf -> Latex 转换器 docx2tex 依赖于 System.IO.Packaging .net 模块,其单声道实现不是但坚如磐石。

后记 - 不是推荐:对于这项工作来说,它太笨重了,但是 iText 将直接从表单数据生成 pdf。如果您想做一些奇特的事情,例如签名 pdf,那么这就是您的最佳选择。

后记 #2 — 如果您使用 Word 的主文档表示形式将 Word 文档分解为单独的文件,那么您可以使用手动生成的内容来破坏其中一个部分。这使得仅使用标准 file-utils 和一些简单的 rtf->doc 调整就可以轻松地在 word .doc 文件上执行近似表单填充的操作。

I suggest generating rtf on the server: it's easy enough to automatically generate using cpan's RTF::Writer, has converters generating good pdf, can be edited by hand in word, oo-writer & TextEdit, doesn't have any really bad compatibility issues between the main editing applications, and has decent text & resource extraction tools, with text extraction being rather better than pdf.

There's some support for moving between rtf & latex, although the best rtf -> latex converter, docx2tex, depends on the System.IO.Packaging .net module, whose mono implementation isn't yet rock solid.

Postscript — Not a recommendation: it's too much of an unwieldy sledgehammer for this job, but iText will generate the pdf directly from the form data. If you wanted to do fancy things like signed pdf, that would be the way to go.

Postscript #2 — If you break up the Word document into individual files using word's master document representation, then you can clobber one of the parts with hand-generated content. This makes it easy to do something approximating form-filling on word .doc files using just standard file-utils and some trivial rtf->doc tweaking.

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