in reply to Re: Printing extracted Excel data into a HTML table
in thread Printing extracted Excel data into a HTML table
However, there are *potentially SERIOUS* problems if the spread is sparsely populated.
By way of illustration, we'll identify rows and cells of the .html table using notation similar to that used by the spreadsheet... ie, A1 is top left cell, A2 is the leftmost cell of the second row, B2 is the second cell in the second row and so on. (In the diagram below, the first row and first col are solely to show the grid; they are not data)
Trials with a sparsely populated .xls source:
A B C D E F (r1 and c1 are labels only) 1 C1 C2 F1 2 A2 C2 D2 E2 3 B3 E3 F3
The alphanumerics represent "locations" or "addresses" used as data in the spreadsheet cell. The html output (below) shows that empty cells are (as the code makes clear) ignored...
A B C D E F (labels only) 1 C1 C2 F1 2 A2 C2 D2 E2 3 B3 E3 F3
if positional relationships have significance, you just might care (in fact, you should care, a lot), and the cure will depend on what you're willing to accept in your html table. One notion that I would consider would be inserting a non-breaking space, , in the table cell identified with an empty spreadsheet cell.
UNtested: I think the empty spread cells will be undef, so tweaking Siddartha's line 9, defined $WorksheetObject->{MaxCol} &&..., into an if...else construct would facilitate populating the .html table with non-breaking spaces when a spreadheet cell is empty.
NB that the algo also produces empty <table>-</table> pairs at the end of its output.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Printing extracted Excel data into a HTML table
by Siddartha (Curate) on Dec 09, 2005 at 15:28 UTC |