Forum


Replies: 2   Views: 3363
Not all rows appear in the table
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by appcloud  · 27-10-2011 - 08:54

We are trying to use phpdocx to merge an array to a table in word docx template.

The problem(s)

test1:
- If we add a header row to the word doc TEMPLATE and use header=>true in settings, we only get ONE ROW in the merged docx

test2:
- If we remove the header from the word TEMPLATE and comment out the header=>true setting, we only get the first n rows (depends on how many cells are present)

Our data array contains 7 rows (see dump at the bottom of the post)


For test#1 our docx tempate contains exactly two rows and three cells in each row. the first row cells contain plain text, the second row cells contain merge fields, ie $task_taskid$ etc.

$settings = array('header' => true);

The docx generated only contains the first row from the data array


For test#2 our docx template contains exactly ONE row and three cells in the row, $task_taskid$ etc.

$settings = array(
// 'header' => true
);

The doc generated only has the first three rows.

Through trial and error we found that if we repeat test#2 but add a fourth column/cell, then we get four rows in our merged docx. Therefore it seems that there is a quirk/bug somewhere based on the # of cells (at least thats what it seems like).

We purchased a license of phpdocx solely to merge arrays to word doc tables. Please advise ... We can provide samples of docx template and copies of the merged output for each test.

We are using version 2.4

// Here is a dump of my $data array

array(7) {
[0] => array(3) {
["task_taskid"] => string(4) "1111"
["task_title"] => string(3) "111"
["task_recordstate_id"] => string(3) "111"
}
[1] => array(3) {
["task_taskid"] => string(3) "222"
["task_title"] => string(3) "111"
["task_recordstate_id"] => string(3) "111"
}
[2] => array(3) {
["task_taskid"] => string(3) "333"
["task_title"] => string(3) "111"
["task_recordstate_id"] => string(3) "111"
}
[3] => array(3) {
["task_taskid"] => string(3) "444"
["task_title"] => string(3) "111"
["task_recordstate_id"] => string(3) "111"
}
[4] => array(3) {
["task_taskid"] => string(3) "555"
["task_title"] => string(3) "111"
["task_recordstate_id"] => string(3) "111"
}
[5] => array(3) {
["task_taskid"] => string(3) "666"
["task_title"] => string(3) "111"
["task_recordstate_id"] => string(3) "111"
}
[6] => array(3) {
["task_taskid"] => string(3) "888"
["task_title"] => string(3) "111"
["task_recordstate_id"] => string(3) "111"
}
}