ReptarX / pyfpdf

Automatically exported from code.google.com/p/pyfpdf
GNU Lesser General Public License v3.0
0 stars 0 forks source link

tag th without attribute width (list index out of range) #9

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1 - generate a report containing a table, where the th tag, does not include 
the width attribute, the error will occur: 
"
  File ".../html.py", line 73, in handle_data
    l = [self.table_col_width[self.table_col_index]]
IndexError: list index out of range

"

What is the expected output? What do you see instead?

What version of the product are you using? On what operating system?
1.54b - 2010-09-10, Ubuntu 10.10

Please provide any additional information below.

I changed the expression: "if 'width' not in self.td and 'colspan' not in 
self.td:" to

"if 'width' not in self.td and 'colspan' not in self.td: and 
len(self.table_col_width) > 0 and not self.table_col_index > 
len(self.table_col_width) -1:
"

, and the error no longer occurs.

html used: 

"
<html>
    <body>
        <table>
            <thead>
                <tr>
                    <th>Id</th>
                    <th>Name</th>
                    <th>City</th>
                    <th>Birth date</th>
                </tr>
            </thead>
            <tbody>
                <tr class="even">
                    <td>1</td>
                    <td>Lucas</td>
                    <td>criciuma</td>
                    <td>2010-11-27</td>
                </tr>
                <tr class="odd">
                    <td>2</td>
                    <td>Lucas2</td>
                    <td></td>
                    <td></td>
                </tr>
            </tbody>
        </table>
    </body>
</html>

"

Original issue reported on code.google.com by lucassdvl@gmail.com on 28 Nov 2010 at 3:37

GoogleCodeExporter commented 9 years ago
I can confirm the issue, and the fix listed here.

Original comment by ross.peo...@gmail.com on 8 Mar 2011 at 9:28

GoogleCodeExporter commented 9 years ago
fixed, thanks, sorry for the delay

Original comment by reingart@gmail.com on 6 Aug 2012 at 8:06