如何在odoo 8上打印从右到左的报告

时间:2016-02-10 14:04:26

标签: right-to-left odoo-8 rml

我使用RML在odoo 8中创建了一个报告,一切都很好。但是当我打印报告时,从左到右打印caracteres。我尝试使用drawRightString,但PDF上没有任何内容 我使用了openerp-rtl模块,但我发现没有任何变化 如何在RTL模式下打印它。

1 个答案:

答案 0 :(得分:1)

一般来说,人们在Arbic语言上使用从右到左的文本。

所以在这种情况下你只需安装下面的python-bidi包:

https://pypi.python.org/pypi/python-bidi/

python-bidi package 有助于设置BiDi布局算法的Pure python实现。

并在您的OpenERP报告目录中添加bidi目录并使用get_display(string)方法将您的sting转换为arbic formate并使用arabic_reshaper

你可以做一些像

这样的事情
import arabic_reshaper
from bidi.algorithm import get_display

def get_arabic_string(string):
    reshaped_text = arabic_reshaper.reshape(string)
    bidi_text = get_display(reshaped_text)
    return bidi_text

只需要在你的rml文件中使用get_arbic_string函数并将其设置在rml上并将sting作为arbic formate传递。

检查另一个来源:

pyfribidi for windows or any other bidi algorithm

相关问题