我尝试阅读并打印Exceltable(带文字,umlauten $%°())。我用xlrd读取并用reportlab打印它。结果很糟糕。我的表格不适合坐标,文本没有每列的换行符,因此列宽是宽的。有没有办法强制reportlab这样做? 这是我的代码:
>import xlrd
>wb = xlrd.open_workbook("test.xls",
>encoding_override="UTF-8")#"iso-8859-1")
>wb.sheet_names()
>sh = wb.sheet_by_index(0)
>
>rows = []
>for row_number in xrange(sh.nrows):
> rows.append(sh.row_values(row_number))
>
>data=[row for row in rows]
>
>
>from reportlab.lib import colors
>from reportlab.lib.pagesizes import letter
>from reportlab.platypus import SimpleDocTemplate, Table, TableStyle, Paragraph
>from reportlab.lib.styles import getSampleStyleSheet
>from reportlab.lib.units import inch
>from reportlab.platypus.paragraph.cleanBlockQuotedText
>styles = getSampleStyleSheet()
>doc = SimpleDocTemplate("simple_table.pdf", pagesize=letter)
>
>elements = []
>
>t=Table(data)
>elements.append(t)
>doc.build(elements)
有人看到我的错误吗?感谢