RML报表的网格内容可以自动换行的格式要怎么设置?
-
本来就可以自动换行的,中文可能需要特殊处理。
你是指中文不能换行吧?
-
是的,中文不能自动换行
-
我刚才试了下,英文也不行。
加这些word-break等 css也不行。 -
我打印的效果
-
谢谢 mrshelly
问题已经解决,这里: hi.baidu.com/leoomo/blog/item/f2652fd53c7ac2cf51da4bd5.html 有解决办法我的处理方法:
在 addonsbase_report_cn__init__.py 增加如下的代码
import reportlab.lib.styles
reportlab.lib.styles.ParagraphStyle.defaults['wordWrap'] = "CJK"高兴呀,呵呵。
[[i] 本帖最后由 chengwenge 于 2010-1-8 15:08 编辑 [/i]]
-
我现在报表都是直接修改rml来定义的,使用openoffice设计转换总是不行,rml2pdf运行就是慢了点。
[检测到链接无效,已移除] 有个使用mako模板进行 html打印的,我简单试了下,不行就放弃了,没有仔细研究。 -
这样解决问题,看着就爽
-
按chengwenge的方法修改代码,打印时出现如下问题:
Environment Information :
System : Linux-2.6.24-26-generic-i686-with-debian-lenny-sid
OS Name : posix
LSB Version: core-2.0-ia32:core-3.0-ia32:core-3.1-ia32:core-3.2-ia32:core-4.0-ia32:core-2.0-noarch:core-3.0-noarch:core-3.1-noarch:core-3.2-noarch:core-4.0-noarch:cxx-3.0-ia32:cxx-3.1-ia32:cxx-3.2-ia32:cxx-4.0-ia32:cxx-3.0-noarch:cxx-3.1-noarch:cxx-3.2-noarch:cxx-4.0-noarch:desktop-3.1-ia32:desktop-3.2-ia32:desktop-4.0-ia32:desktop-3.1-noarch:desktop-3.2-noarch:desktop-4.0-noarch:graphics-2.0-ia32:graphics-3.0-ia32:graphics-3.1-ia32:graphics-3.2-ia32:graphics-4.0-ia32:graphics-2.0-noarch:graphics-3.0-noarch:graphics-3.1-noarch:graphics-3.2-noarch:graphics-4.0-noarch:languages-3.2-ia32:languages-4.0-ia32:languages-3.2-noarch:languages-4.0-noarch:multimedia-3.2-ia32:multimedia-4.0-ia32:multimedia-3.2-noarch:multimedia-4.0-noarch:printing-3.2-ia32:printing-4.0-ia32:printing-3.2-noarch:printing-4.0-noarch
Distributor ID: Ubuntu
Description: Ubuntu 8.04.3 LTS
Release: 8.04
Codename: hardy
Operating System Release : 2.6.24-26-generic
Operating System Version : #1 SMP Tue Dec 1 18:37:31 UTC 2009
Operating System Architecture : 32bit
Operating System Locale : en_HK.UTF8
Python Version : 2.5.2
OpenERP-Client Version : 5.0.7
Last revision No. & ID :Bazaar Package not Found !Traceback (most recent call last):
File "/usr/lib/python2.5/site-packages/openerp-server/service/web_services.py", line 704, in go
(result, format) = obj.create(cr, uid, ids, datas, context)
File "/usr/lib/python2.5/site-packages/openerp-server/report/printscreen/ps_list.py", line 81, in create
res = self._create_table(uid, datas['ids'], result['fields'], fields_order, rows, context, model_desc)
File "/usr/lib/python2.5/site-packages/openerp-server/report/printscreen/ps_list.py", line 219, in _create_table
self.obj.render()
File "/usr/lib/python2.5/site-packages/openerp-server/report/render/render.py", line 50, in render
result = self._render()
File "/usr/lib/python2.5/site-packages/openerp-server/report/render/rml.py", line 41, in _render
return rml2pdf.parseNode(self.rml, self.localcontext, images=self.bin_datas, path=self.path,title=self.title)
File "/usr/lib/python2.5/site-packages/openerp-server/addons/base_report_cn/init.py", line 81, in convert2TrueType
return method(data, args[1:] if len(args) > 2 else args[1], **argv)
File "/usr/lib/python2.5/site-packages/openerp-server/report/render/rml2pdf/trml2pdf.py", line 781, in parseNode
r.render(fp)
File "/usr/lib/python2.5/site-packages/openerp-server/report/render/rml2pdf/trml2pdf.py", line 195, in render
pt_obj.render(el)
File "/usr/lib/python2.5/site-packages/openerp-server/report/render/rml2pdf/trml2pdf.py", line 775, in render
self.doc_tmpl.build(fis)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 740, in build
self.handle_flowable(flowables)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/doctemplate.py", line 638, in handle_flowable
if frame.add(f, self.canv, trySplit=self.allowSplitting):
File "/usr/lib/python2.5/site-packages/reportlab/platypus/frames.py", line 141, in _add
w, h = flowable.wrap(aW, h)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/tables.py", line 978, in wrap
self._calc(availWidth, availHeight)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/tables.py", line 523, in _calc
self._calc_height(availHeight,availWidth,W=W)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/tables.py", line 480, in _calc_height
dW,t = self._listCellGeom(v,w or self._listValueWidth(v),s)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/tables.py", line 348, in _listCellGeom
vw, vh = v.wrapOn(canv, aW, aH)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/flowables.py", line 113, in wrapOn
w, h = self.wrap(aW,aH)
File "/usr/lib/python2.5/site-packages/reportlab/platypus/paragraph.py", line 567, in wrap
self.blPara = self.breakLinesCJK([first_line_width, later_widths])
File "/usr/lib/python2.5/site-packages/reportlab/platypus/paragraph.py", line 819, in breakLinesCJK
raise ValueError('CJK Wordwrap can only handle one fragment per paragraph for now')
ValueError: CJK Wordwrap can only handle one fragment per paragraph for now -
[quote author=chengwenge link=topic=783.msg3527#msg3527 date=1262933052]
谢谢 mrshelly
问题已经解决,这里: http://hi.baidu.com/leoomo/blog/item/f2652fd53c7ac2cf51da4bd5.html 有解决办法
我的处理方法:
在 addonsbase_report_cn__init__.py 增加如下的代码
import reportlab.lib.styles
reportlab.lib.styles.ParagraphStyle.defaults['wordWrap'] = "CJK"
高兴呀,呵呵。
[[i] 本帖最后由 chengwenge 于 2010-1-8 15:08 编辑 [/i]]
[/quote]
怎么在6.1里面看不到这个文件?6.1的相关修改在什么地方呢?