Plone的ODT/ODS模板转换
项目描述
redomino.appytransforms
它注册了一个新的门户转换,允许您动态地为给定模板生成odt或ods文件。
该产品基于http://appyframework.org/pod.html
由于它旨在生成本机LibreOffice/OpenOffice格式,因此无需在服务器模式下运行LibreOffice。
该插件面向开发者,可用于生成动态odt/ods文件,编写自定义PloneFormGen适配器等。
用法
示例
>>> from zope.component import getUtility >>> from Products.PortalTransforms.interfaces import IPortalTransformsTool >>> file_contents = open('your odt file with variables').read() # see redomino/appytransforms/tests/input.odt >>> portal_transforms = getUtility(IPortalTransformsTool) >>> converter = portal_transforms.convertTo(target_mimetype='application/vnd.oasis.opendocument.text.transformed', >>> orig=file_contents, >>> mimetype='application/vnd.oasis.opendocument.text', >>> mapper=dict(plone_version='4.3.2-sunny-day-beta'), >>> ) >>> transformed_odt_contents = converter.getData()
appy.pod的技巧和限制
技巧和appy.pod的限制。
ODT文件
使用“编辑”->“更改”->“记录”来显示变量
条件文本字段似乎不受支持(据我所知),使用带do text if expr的注释代替
LibreOffice不支持单词上的注释(见http://ask.libreoffice.org/en/question/5256/comments-in-writer/),因此似乎您只能
重复列表项,它不符合预期
ODS文件
不要在ods文件上使用“编辑”->“更改”->“记录”!
重复行,在第一单元格上添加注释“do row for person in persons”,并将动态内容放入单元格值中=“person[‘age’]”
如果您想将单个变量传递并显示到单个单元格中,请在单元格值中使用以下语法 =”variable_name”(不要作为注释)
appy的文档很糟糕:如果您在尝试使用ODT/ODS模板时遇到麻烦,请查看测试文档 https://github.com/redomino/redomino.appytransforms/tree/master/redomino/appytransforms/tests
测试
测试状态
如何启动测试
$ ./bin/test -m redomino.appytransforms
变更日志
0.1 (2014-02-24)
首次发布 [davidemoro]
项目详情
关闭
redomino.appytransforms-0.1.zip 的散列值
算法 | 散列摘要 | |
---|---|---|
SHA256 | 63ca696575a796cc284990ec393acc904d0c907839f583dcfc2c0962bafbb560 |
|
MD5 | 6d38a3dfb853bf4de1c366cc5fb61765 |
|
BLAKE2b-256 | 5f0a99aee4fdc6fbf61e2fed0334019f6dd1ec653d223648523dea611ebb86bc |