[reportlab-users] Bug in manual & code?

Schollnick, Benjamin reportlab-users@reportlab.com
Wed, 25 Feb 2004 12:52:31 -0500


Either I am misunderstanding, or I suspect there is a Table / TableStyle
bug...

def build_text_entry ( data, trans_table, Configuration_File, Contents):
    
    global height
    global width
    normal = ParagraphStyle ('Normal')
    literal = ParagraphStyle ('Literal')
    
    table_data = []
    for entry in trans_table:
        table_data.append ( (entry[1], data[entry[2]]) )

    tstyle     = TableStyle ( [('ALIGN', (0,0), (-1, -1), 'LEFT' ),
                              ('GRID', (0,0), (-1, -1),  10,
reportlab.lib.colors.black)] )
    Table_Display = Table ( table_data, style= tstyle)
    Table_Display.setStyle ( tstyle )
    Contents.append ( Table_Display )
    Contents.append ( Spacer (0, 10) )

I could not get the TableStyle to work, until I added the setStyle command.

But according to the documentation the Table command can have the *DEFAULT*
style
passed to it...

		- Benjamin

> -----Original Message-----
> From: reportlab-users-admin@reportlab.com
> [mailto:reportlab-users-admin@reportlab.com]On Behalf Of Schollnick,
> Benjamin
> Sent: Monday, February 23, 2004 8:23 AM
> To: 'reportlab-users@reportlab.com'
> Subject: RE: [reportlab-users] Re: SimpleDocTemplate 
> stripping internal
> wh itespace??
> 
> 
> 
> > Have you read the manuals and did you look at the examples?
> 
> I have gone through the manuals, I am still digesting the examples...
> As I mentioned, I have up to this point, only been using 
> DrawString commands
> on the canvas....  So I am using this project as a excuse to 
> force myself to
> learn the rest of the functionality in Reportlab....
> 
> So I am attempting to force myself to use the higher level constructs
> while creating this report...
> 
> > I suppose what you really want is a tabular layout.
> 
> True, it would probably be a better fit...
> 
> The major issue, is that for the tabular layout...  (Via the 
> Table user
> method)
> I do not know how many values there will be.  
> 
> But I can work around that....
> 
> > (using fixed-width fonts smells a bit like a report from the 
> > early 70ies).
> 
> Well, this is a first draft >g<  But seriously....
> 
> My intention is to offer at least two styles of reports, and 
> I thought it
> would be
> nice to have a style that was easy to read, yet easy to cut 
> and paste...
> (I am not sure that a PDF table would copy and paste well...)
> 
> 		xxxxx		:	123123
> 		yyyy yyy yy : 	23406
> 		ttt t t tttt: 	990 092 
> 
> Is a little easier to read than:
> 
> 		xxxxx	: 123123
> 		yyyy yyy yy : 23406
> 		ttt t t tttt: 990 092 
> 
> That's all....  I'll double check with the preformatted 
> format....  I just
> thought it was a little strange that the parser would be 
> stripping the white
> space inside a string....
> 
> 			- Benjamin
> > 
> > Henning
> > 
> > > From: "Schollnick, Benjamin" <Benjamin.Schollnick@usa.xerox.com>
> > > To: "'reportlab-users@reportlab.com'" 
> > <reportlab-users@reportlab.com>
> > > Subject: [reportlab-users] SimpleDocTemplate stripping internal
> > whitespace??
> > > Reply-To: reportlab-users@reportlab.com
> > >
> > > Folks,
> > >
> > > I have run into a issue, that I can't explain....
> > >
> > > I use the follow routine, for Canvas.DrawString, without any
> > > problems...
> > >
> > > def format_lines    ( fieldname, data, fieldname_width=15, 
> > data_width=20):
> > >     """
> > >         Reformat the data into a string.
> > >         Simply a "Macro", to reduce duplication.
> > >
> > >         Inputs -
> > >             FieldName   - Name of the field that is to be 
> > reformated.
> > >             data        - The actual stored data.
> > >
> > >         Outputs -
> > >             fieldname = "This is the fieldname"
> > >             data      = "This is the data."
> > >             "This is the fie: This is the "
> > >
> > >         Example:
> > >
> > >     """
> > >     fmt = '  %-' + str(fieldname_width) + 's: %-' + 
> > str(data_width) + 's'
> > >     return fmt % (fieldname, data)
> > >
> > >
> > > Now since I decided to use SimpleDocTemplate, it is appearing that
> > > the
> > > internal whitespace is being removed...
> > >
> > > i.e.
> > >
> > > Version : 1.7h
> > >
> > > Is there a simple way to have it not filter the internal white
> > > space?
> > >
> > >         Contents.append (Paragraph ( format_lines    ( entry[1],
> > > data[entry[2]],
> > >                                                       
> > fieldname_width=25,
> > > data_width=20),
> > >                                      normal ) )
> > >
> > >
> > > - Ben
> > 
> > _______________________________________________
> > reportlab-users mailing list
> > reportlab-users@reportlab.com
> > http://two.pairlist.net/mailman/listinfo/reportlab-users
> > 
> _______________________________________________
> reportlab-users mailing list
> reportlab-users@reportlab.com
> http://two.pairlist.net/mailman/listinfo/reportlab-users
>