Reputation: 15
I'm creating a simple four column, one row table. However, when the code executes I receive the following error
Table 4 rows X 1 cols> with cell (0,0) containing 'D' data error - 1 columns in data but 4 in column widths".
The code is as follows:
colwidths = (46, 76, 48, 40)
rowheights = (20)
tabledata = ('DATE ', '3-20-2016', 'FIELD # ', '1')
t = Table((tabledata), (colwidths), (rowheights))
Upvotes: 1
Views: 2959
Reputation: 700
I encountered a similar problem this week so i will put my solution here for others.
It seems there are two main causes:
OR
e.g. you have a <tr> ...<tr> instead of <tr> ...</tr>. note the closing /
My approach to this problem is to split the whole page into partials (with each table as a partial) and load them in the browser one by one.
You are likely to identify the table causing the error.
Upvotes: 1
Reputation: 21609
You simply need to wrap tabledata
in another iterable to ensure its interpreted as all 5 items being on a single row, instead of 5 rows containing a single item? i.e.
tabledata = [('DATE ', '3-20-2016', 'FIELD # ', '1')]
Upvotes: 1