PHPOffice/PHPPresentation (PowerPoint) - how to prevent paragraph text from wrapping to a new line when in a table cell? Is there a dedicated method?

Viewed 11

Inside a table cell I have a text - a number in fact but with space thousands separators like:

123 456 789

This data is dynamic and the value can vary a lot. I need a method to prevent this number from wrapping to a new line inside cell like:

123 456
789

I need to achieve something like when using the CSS property 'white-space: nowrap'.

Here is my code:

$oShape = $currentSlide->createTableShape(3); // 3 columns
        $oShape->setWidth(180);
        //...
        foreach ($seriesData as $data) {
            $oRow = $oShape->createRow();
            //...
            $oCell = $oRow->nextCell();
            // $oCell->setWidth(70); // I don't want to define fixed width here
            $oCell->createTextRun($data['string'])->getFont()->setBold(true)->setSize(8);
            $oCell->getActiveParagraph()->getAlignment()->setHorizontal(Alignment::HORIZONTAL_RIGHT)->setMarginLeft(1)->setMarginTop(0)->setMarginRight(2)->setMarginBottom(0);
// ... etc. the rest of the cells that I don't have a problem with

The issue is that the paragraph inside this cell often wraps to a new line.

Is there a dedicated method or property for no wrap in such case?

0 Answers
Related