mrbaseball34;10955374 wrote:
Not sure why you are telling me about CSS columns, This data is in a table.
Since you're not dealing with tabular data, I assumed you'd be using CSS for visual formatting rather than a table. You'll be needing to group data, that has no semantical relationship, together into rows to build a table. It seems needlessly complicated.
mrbaseball34;10955374 wrote:
It doesn't work that way, they are all run together, not just one type of election in a single column.
I never suggested they stay in one column either. Your mockup data ends the first column with:
CONGRESSIONAL (this is the header - also the array you claim you have)
UNITED STATES SENATOR (this seems to be some kind of subheader)
- data for the above header & subheader
The second column starts with:
CONGRESSIONAL (same header as before)
REPRESENTATIVE IN CONGRESS DISTRICT 6 (new subheader)
- data for the above header & subheader
Which is why I suggested splitting between these SUBHEADERS.
That suggestion is of course based off the assumption that you have data grouped in a sensible fashion, e.g. in the same way as they did when creating the PDF, and that you are actually creating multiple columns with css (floating divs perhaps), rather than trying to do it backwards with a table.
mrbaseball34;10955374 wrote:
I'm not parsing the PDF, I have the data in a database and reading the values into arrays for each type of election.
Good to know.
mrbaseball34;10955374 wrote:
I can do this using PHP if I use static row heights and calculate the rows needed to show the table using three columns. The problem lies in the cases where height of the content is more than the base row height. This was my first thought, I just wanted to know if anyone else had any other ideas.
And my suggestion deals with knowing exactly how much height your specific data takes up, i.e. how many rows/lines it will span, as opposed to the very simple approach of just assuming one line per item.
Afaik, PHP has no built in support for text width (or final height within specific width constraints). If you don't like the javascript approach, you could use Imagick and queryFontMetrics to find out how much space each text item needs.
Still, I strongly recommend dropping your table setup and doing this with columns, from top to bottom, and left to right. The only way I personally see to solve the table approach is by solving the multi-column approach, setting up data for each column in an array, create a multidimensional array from this and then "inverting" it (assuming matrix inversion does indeed mean changing an [X]mn matrix into an [X]nm matrix by moving each element (e)mn to position (e)nm).