PHPExcel, how to set a crash and expand for groups of strings?

Suppose I want to set a failure and expand for line 2 to 4 as one group and from 8 to 12 of the second group. This means that when the user wants to click on the icon of the +group of group 1, lines from 2 to 4 should be visible, and for group 2 from 8 to 12. Bellow is the code for one line.

$sheet->getRowDimension(1)->setOutlineLevel(1);

$sheet->getRowDimension(1)->setVisible(false);

$sheet->getRowDimension(1)->setCollapsed(true);

And another question: can we define an extension icon, not an icon +? sort of<w640 "

+4
source share
1 answer

( ), ; , .

// Set outline levels
for ($row = 2; $row <= 10; ++$row) {
    $objPHPExcel->getActiveSheet()
        ->getRowDimension($row)
            ->setOutlineLevel(1)
            ->setVisible(false)
            ->setCollapsed(true);
}

for ($row = 4; $row <= 9; ++$row) {
    $objPHPExcel->getActiveSheet()
        ->getRowDimension($row)
            ->setOutlineLevel(2)
            ->setVisible(false)
            ->setCollapsed(true);
}
for ($row = 6; $row <= 8; ++$row) {
    $objPHPExcel->getActiveSheet()
        ->getRowDimension($row)
            ->setOutlineLevel(3)
            ->setVisible(false)
            ->setCollapsed(true);
}
+8

Source: https://habr.com/ru/post/1629298/


All Articles