2

I'm using openTBS to populate tables in a word document. Works great for adding rows to tables with a known amount of columns, however I want to be able to populate a table with an unknown number of rows and columns. Is there a way to achieve this? Thanks.

Matt
  • 251
  • 4
  • 13

2 Answers2

2

I had a similar requirement in the project I'm working on, and as far as I can find, the blunt answer is 'no'.

One option is to include all columns, and delete those that aren't required. From my experimentation however, I seem to remember (you may wish to double check) that it doesn't resize columns after you've deleted, which for my purposes, meant this wasn't an option.

I ended up creating around 10 different tables in my template, and merging into a different table depending on the data from my php.

Chris
  • 5,882
  • 2
  • 32
  • 57
  • 1
    Chris: if you tune the ms Word properties "Preferred width" for the table and the columns, then you can have the table to keep the same size and columns are auto adjusted after a deletion. – Skrol29 Sep 06 '13 at 22:51
  • 1
    Nevertheless, you can add columns following the same tip of Dynamic Columns for HTML tables (http://www.tinybutstrong.com/examples.php?e=dyncol&m=result). But you will not be able to manage the size of columns after the point of insertion. It can be without problem if you add columns at the very right of the table thus size will be automatically applied. – Skrol29 Sep 06 '13 at 22:56
  • Post an answer @Skrol29 - That's far better than mine! The html tables I'd never come across before, sounds like that basically IS the solution! – Chris Sep 12 '13 at 16:23
1

You can add columns following the same tip of Dynamic Columns for HTML tables. But you will not be able to manage the size of columns after the point of insertion. It can be without problem if you add columns at the very right of the table thus size will be automatically applied.

Skrol29
  • 5,402
  • 1
  • 20
  • 25
  • 1
    Thanks for the reply. I looked at the linked page but couldn't make sense of how to apply that to Word. Are you able to give an example of what the table in Word would look like and then the structure of the array(s) that would merge into it? Thanks :) – Matt Sep 16 '13 at 04:35