Forum


Replies: 4   Views: 3291
Mergedocx() breaks when merging a document with a long 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 darren77  · 06-02-2013 - 16:38

I am trying to merge 2 documents: the first one is just an introduction text, the second one is a table which is almost as long as the whole page.

The merging document should get:
[list]introduction text
the first part of the table
a page break
the second part of the table [/list]

What I get is:

[list]the first part of the table
empty lines
introduction text
empty lines
a page break
the second part of the table[/list]

I am testing it using the following code:

[code]$newDocx = new DocxUtilities();
$options = array('mergeType' => 0);
$newDocx -> mergeDocx(TEMP_PATH . 'section_4_intro' . EXT, //intro
TEMP_PATH . 'section_4_table' . EXT, //table
TEMP_PATH . 'section_4_merged' . EXT, //final
$options);
[/code]

I tried both mergeType 1 and 0

I can PM the word files if you wish

Thanks

Posted by darren77  · 11-04-2013 - 12:13

Also, when I try to merge 2 documents with a table on each, the table merged has got many missing rows

Posted by admin  · 11-04-2013 - 12:13

Hello,

Please send us your documents to test them: http://www.phpdocx.com/contact. Contact first and we'll answer you.

Regards.

Posted by admin  · 11-04-2013 - 12:13

Hello,

The problem is that your templates have specifically encoded that section break has to be "continuous".

Look at this web page, for example, to see how to change them: http://www.howtogeek.com/73928/change-the-type-for-a-section-break-in-word-2007-and-2010/

Like the section break was continuous and your table had an absolute page positioning and "allowing overlap" set to true it was trying to locate the table at the beguinning of the page and breaking it as Word decided best (not very well by the way).

Regards.