Discussion:
[reportlab-users] Border style for tables
Arkadi Colson
2011-05-04 12:41:30 UTC
Permalink
Hi

One small question:
Is it possible to use a dotted border style for tables in reportlab?

Thanks!

Best regards,
Arkadi
Elan Noy
2011-05-04 16:02:39 UTC
Permalink
Hi


I am working on a pdf that will include addresses. The address is in a
table cell.
How can I add a line break after each address attribute such that the
address will look something like:

Name
1 Street address
New York
New York

I tried to use <br/> but it did not work

txt = "Name"+"<br/>"
or
txt = "Name <br/>"

Thanks in advance

Elan
Robin Becker
2011-05-04 16:09:03 UTC
Permalink
Hi
I am working on a pdf that will include addresses. The address is in a table cell.
How can I add a line break after each address attribute such that the address
Name
1 Street address
New York
New York
I tried to use <br/> but it did not work
txt = "Name"+"<br/>"
or
txt = "Name <br/>"
Thanks in advance
Elan
........
If you are using simple text in the cell then use the standard escape character eg

'line1\nline2\nline3' etc etc. If you are putting a paragraph in the cell then
<br/> should work in the paragraph text.
--
Robin Becker
Elan Noy
2011-05-05 13:03:29 UTC
Permalink
Post by Robin Becker
Hi
I am working on a pdf that will include addresses. The address is in a table cell.
How can I add a line break after each address attribute such that the address
Name
1 Street address
New York
New York
I tried to use <br/> but it did not work
txt = "Name"+"<br/>"
or
txt = "Name <br/>"
Thanks in advance
Elan
........
If you are using simple text in the cell then use the standard escape character eg
'line1\nline2\nline3' etc etc. If you are putting a paragraph in the
cell then <br/> should work in the paragraph text.
One more question, if I may.
Is there a way to have TABs in the text. I need to organize text in a
nice format, and it will be a shame to use tables for something as
simple as tabs,

Regards

Elan
Robin Becker
2011-05-05 13:18:53 UTC
Permalink
.........
Post by Elan Noy
One more question, if I may.
Is there a way to have TABs in the text. I need to organize text in a nice
format, and it will be a shame to use tables for something as simple as tabs,
Regards
Elan
.......
paragraphs do not support tabs in any way that's useful.
--
Robin Becker
Elan Noy
2011-05-05 13:19:58 UTC
Permalink
Post by Robin Becker
.........
Post by Elan Noy
One more question, if I may.
Is there a way to have TABs in the text. I need to organize text in a nice
format, and it will be a shame to use tables for something as simple as tabs,
Regards
Elan
.......
paragraphs do not support tabs in any way that's useful.
Not the reply I wanted to hear :), but thanks ,

Elan
Tim Roberts
2011-05-05 18:10:28 UTC
Permalink
Post by Elan Noy
One more question, if I may.
Is there a way to have TABs in the text. I need to organize text in a
nice format, and it will be a shame to use tables for something as
simple as tabs,
I wrote a simple paragraph-like flowable several years ago that supports
tabs. I even posted it on this list some months ago. Whether it can be
shoehorned into your application is another question, however.
--
Tim Roberts, timr at probo.com
Providenza & Boekelheide, Inc.
Robin Becker
2011-05-04 16:47:56 UTC
Permalink
Post by Arkadi Colson
Hi
Is it possible to use a dotted border style for tables in reportlab?
Thanks!
Best regards,
Arkadi
yes see the example below

######################################################
from reportlab.platypus.tables import Table, TableStyle
from reportlab.lib import colors

doc = SimpleDocTemplate('ttab.pdf', showBoundary=1)
t = Table((('','North','South','East','West'),
('Quarter 1',100,200,300,400),
('Quarter 2',100,400,600,800),
('Total',300,600,900,'1,200')),
(72,36,36,36,36),
(24, 16,16,18)
)
#line commands are like
#op, start, stop, weight, colour, cap, dashes, join, linecount, linespacing
t.setStyle(
TableStyle([
('GRID', (1,1), (-2,-2), 0.25, colors.red),
('BOX', (0,0), (-1,-1), 0.25, colors.blue, None, (2,2,1)),
])
)
story = [t]
doc.build(story)
######################################################
--
Robin Becker
Continue reading on narkive:
Loading...