plone的odt/ods模板转换
redomino.appytransforms的Python项目详细描述
redomino.appytransforms
它注册了一个新的门户转换,允许您为给定的模板动态生成odt或ods文件。
本产品基于http://appyframework.org/pod.html
因为它的目标是生成本地libre office/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()
应用程序pod的提示和限制
提示和应用程序。pod的限制。
ODT文件:
- 使用“编辑”->;“更改”->;“记录”显示变量
- 条件文本字段似乎不受支持(据我所见),请改为将注释与do text if expr一起使用
- libreoffice不支持对单个单词的注释(请参见http://ask.libreoffice.org/en/question/5256/comments-in-writer/),因此似乎您将不得不使用唯一的方法来
- 重复列表项,它不能按预期工作
ODS文件:
- 不要在ODS文件上使用“编辑”->;“更改”->;“记录”!
- 重复行,在第一个单元格上添加注释“为person中的person添加行”,并将动态内容放入单元格value=“person['age']”
- 如果要传递单个变量并将其显示到单个单元格中,请在单元格value=“variable_name”(不作为注释)中使用以下语法
appy的文档很糟糕:如果您在尝试使用odt/ods模板时遇到困难,请查看tests文档https://github.com/redomino/redomino.appytransforms/tree/master/redomino/appytransforms/tests
更改日志
0.1(2014-02-24)
- 首次发布 [大卫莫罗]