[reportlab-users] Reportlab problem displaying japanese characters in a table

Michael Dorrian michael.dorrian at gmail.com
Fri Jun 12 05:45:32 EDT 2009


Thanks for the replys...........
Here is my function. I am just showing u what i had to do to display
the first field of the table correctly from the returned rows of the
sql.............there must be an easier way than this. The field
headings display correctly. Its just the database data thats the
problem. This table has a table style that uses the japanese font
HeiseiMin-W3 font. Anyway if u could give me a some simpler way of
doing this............
def getDomesticTable(ActNo):
con = pymssql.connect(host="server", user="xx", password="xxxx",
database="xxxx")
#Get Cursor
csr = con.cursor()
styles = getSampleStyleSheet()
query = "execute master.dbo.GetJPYFunds '%s'" % ActNo
csr.execute(query)
JPYRows = csr.fetchall()
parstyle = ParagraphStyle(name='Notes', fontName='HeiseiMin-W3',
fontSize=7,align='Center')

t = Table(((u'資産分類',u'ファンド名',u'口数',u'取得単価',u'取得価額',u'単価',u'評価額',u'概算損益',u'騰落',u'比率'),
(Paragraph(unicode(str(JPYRows[0][11]),
'shiftjis'),parstyle),100,200,300,400,100,200,300,400,300),
('Quarter 2',100,400,600,800,100,200,300,400,300),
('Quarter 3',100,200,300,800,100,200,300,400,300),
#('Quarter 4',100,200,300,800),
(None,None,None,'Total','1,200',None,900,900,None,None)),
(72,92,36,38,38,38,36,38,36,30),
(16, 19,16,16,18)
)
#print title
csr.close()
con.close()
return t

On 6/12/09, Andy Robinson <andy at reportlab.com> wrote:

> 2009/6/11 Michael Dorrian <michael.dorrian at gmail.com>:

>>

>> My question is this.....any clean or neat way i can read japanese strings

>> from the database and input them nicely into a reportlab table...

>

> Can you send the traceback?

>

> We serve thousands of pages of Japanese PDFs each day from MySQL data;

> but I'm quite familiar with the many ways things can get misencoded

> before you get it working...

>

> Best Regards,

>

> --

> Andy Robinson

> CEO/Chief Architect

> ReportLab Europe Ltd.

> Media House, 3 Palmerston Road, Wimbledon, London SW19 1PG, UK

> Tel +44-20-8545-1570

> _______________________________________________

> reportlab-users mailing list

> reportlab-users at reportlab.com

> http://two.pairlist.net/mailman/listinfo/reportlab-users

>



More information about the reportlab-users mailing list