Forum


Replies: 1   Views: 345
How does the cantsplit property of table rows work?
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 dev@ram  · 18-12-2018 - 14:12

I want certain rows of the table to stay together and not get split across pages. I tried to apply the cantSplit =1 for the rows but it does not seem to work

$docx->addTable($data['rows'],$tableStyles, $tableRowProps);

The content of $tableRowProps is

Array
(
    [0] => Array
        (
            [tableHeader] => 1
        )

    [1] => Array
        (
            [cantSplit] => 1
        )

    [2] => Array
        (
            [cantSplit] => 1
        )

    [3] => Array
        (
            [cantSplit] => 1
        )

    [4] => Array
        (
            [cantSplit] => 1
        )

    [6] => Array
        (
            [cantSplit] => 1
        )

    [7] => Array
        (
            [cantSplit] => 1
        )

    [9] => Array
        (
            [cantSplit] => 1
        )

    [10] => Array
        (
            [cantSplit] => 1
        )

    [11] => Array
        (
            [cantSplit] => 1
        )

    [12] => Array
        (
            [cantSplit] => 1
        )

    [13] => Array
        (
            [cantSplit] => 1
        )

    [14] => Array
        (
            [cantSplit] => 1
        )

    [15] => Array
        (
            [cantSplit] => 1
        )

    [16] => Array
        (
            [cantSplit] => 1
        )

    [17] => Array
        (
            [cantSplit] => 1
        )

    [18] => Array
        (
            [cantSplit] => 1
        )

    [20] => Array
        (
            [cantSplit] => 1
        )

    [21] => Array
        (
            [cantSplit] => 1
        )

    [22] => Array
        (
            [cantSplit] => 1
        )

    [23] => Array
        (
            [cantSplit] => 1
        )

    [24] => Array
        (
            [cantSplit] => 1
        )

    [25] => Array
        (
            [cantSplit] => 1
        )

    [27] => Array
        (
            [cantSplit] => 1
        )

    [28] => Array
        (
            [cantSplit] => 1
        )

    [29] => Array
        (
            [cantSplit] => 1
        )

    [30] => Array
        (
            [cantSplit] => 1
        )

    [31] => Array
        (
            [cantSplit] => 1
        )

)

But the table still splits(at 27th row). So I'm not sure what is happening.

Please see attached screenshot of doc generated.

https://drive.google.com/open?id=1aNvJqqtYT1647z3CRgRomyZ3Our10ukT

Basically what I'm trying to do is to get the content with the blue background and all the rows immediately below it with the white background(group them) to be in the same page(avoid the table splitting them into different pages). I tried cantSplit=0 for the last white row(with all others(cantSplit=1) but that didnt work so I put everything to cantSplit =1 . That did'nt work either. So how does it work ??

Any help is highly appreciated.