lib/PHPRtfLite/Table/Cell.php
public function renderDefinition()
    {
        $stream = $this->_rtf->getWriter();
        if ($this->isVerticalMerged()) {
            if ($this->isVerticalMergedFirstInRange()) {
                $stream->write('\clvmgf');
            }
            else {
                $stream->write('\clvmrg');
            }
        }

        $backgroundColor = $this->getBackgroundColor();
        if ($backgroundColor) {
            $colorTable = $this->_rtf->getColorTable();
            $stream->write('\clcbpat' . $colorTable->getColorIndex($backgroundColor) . ' ');
        }

        switch ($this->getVerticalAlignment()) {
            case self::VERTICAL_ALIGN_TOP:
                $stream->write('\clvertalt');
                break;

            case self::VERTICAL_ALIGN_CENTER:
                $stream->write('\clvertalc');
                break;

            case self::VERTICAL_ALIGN_BOTTOM:
                $stream->write('\clvertalb');
                break;
        }

        switch ($this->getRotateTo()) {
            case self::ROTATE_RIGHT:
                $stream->write('\cltxtbrl');
                break;

            case self::ROTATE_LEFT:
                $stream->write('\cltxbtlr');
                break;
        }

        // NOTE: microsoft and all other rtf readers I know confound left with top cell padding
        if ($this->_paddingLeft) {
            $stream->write('\clpadft3\clpadt' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingLeft) . ' ');
        }
        if ($this->_paddingTop) {
            $stream->write('\clpadfl3\clpadl' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingTop) . ' ');
        }
        if ($this->_paddingBottom) {
            $stream->write('\clpadfb3\clpadb' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingBottom) . ' ');
        }
        if ($this->_paddingRight) {
            $stream->write('\clpadfr3\clpadr' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingRight) . ' ');
        }

        $border = $this->getBorder();
        if ($border) {
            $stream->write($border->getContent('\cl'));
        }
    }
public function renderDefinition()
    {
        $stream = $this->_rtf->getWriter();
        if ($this->isVerticalMerged()) {
            if ($this->isVerticalMergedFirstInRange()) {
                $stream->write('\clvmgf');
            }
            else {
                $stream->write('\clvmrg');
            }
        }

        $backgroundColor = $this->getBackgroundColor();
        if ($backgroundColor) {
            $colorTable = $this->_rtf->getColorTable();
            $stream->write('\clcbpat' . $colorTable->getColorIndex($backgroundColor) . ' ');
        }

        switch ($this->getVerticalAlignment()) {
            case self::VERTICAL_ALIGN_TOP:
                $stream->write('\clvertalt');
                break;

            case self::VERTICAL_ALIGN_CENTER:
                $stream->write('\clvertalc');
                break;

            case self::VERTICAL_ALIGN_BOTTOM:
                $stream->write('\clvertalb');
                break;
        }

        switch ($this->getRotateTo()) {
            case self::ROTATE_RIGHT:
                $stream->write('\cltxtbrl');
                break;

            case self::ROTATE_LEFT:
                $stream->write('\cltxbtlr');
                break;
        }

        // NOTE: microsoft and all other rtf readers I know confound left with top cell padding
        if ($this->_paddingLeft) {
            $stream->write('\clpadft3\clpadt' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingLeft) . ' ');
        }
        if ($this->_paddingTop) {
            $stream->write('\clpadfl3\clpadl' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingTop) . ' ');
        }
        if ($this->_paddingBottom) {
            $stream->write('\clpadfb3\clpadb' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingBottom) . ' ');
        }
        if ($this->_paddingRight) {
            $stream->write('\clpadfr3\clpadr' . PHPRtfLite_Unit::getUnitInTwips($this->_paddingRight) . ' ');
        }

        $border = $this->getBorder();
        if ($border) {
            $stream->write($border->getContent('\cl'));
        }
    }
public function renderDefinition ( ) { $ stream = $ this -> _rtf -> getWriter ( ) ; if ( $ this -> isVerticalMerged ( ) ) { if ( $ this -> isVerticalMergedFirstInRange ( ) ) { $ stream -> write ( '\clvmgf' ) ; } else { $ stream -> write ( '\clvmrg' ) ; } } $ backgroundColor = $ this -> getBackgroundColor ( ) ; if ( $ backgroundColor ) { $ colorTable = $ this -> _rtf -> getColorTable ( ) ; $ stream -> write ( '\clcbpat' . $ colorTable -> getColorIndex ( $ backgroundColor ) . ' ' ) ; } switch ( $ this -> getVerticalAlignment ( ) ) { case self :: VERTICAL_ALIGN_TOP : $ stream -> write ( '\clvertalt' ) ; break ; case self :: VERTICAL_ALIGN_CENTER : $ stream -> write ( '\clvertalc' ) ; break ; case self :: VERTICAL_ALIGN_BOTTOM : $ stream -> write ( '\clvertalb' ) ; break ; } switch ( $ this -> getRotateTo ( ) ) { case self :: ROTATE_RIGHT : $ stream -> write ( '\cltxtbrl' ) ; break ; case self :: ROTATE_LEFT : $ stream -> write ( '\cltxbtlr' ) ; break ; } // NOTE: microsoft and all other rtf readers I know confound left with top cell padding if ( $ this -> _paddingLeft ) { $ stream -> write ( '\clpadft3\clpadt' . PHPRtfLite_Unit :: getUnitInTwips ( $ this -> _paddingLeft ) . ' ' ) ; } if ( $ this -> _paddingTop ) { $ stream -> write ( '\clpadfl3\clpadl' . PHPRtfLite_Unit :: getUnitInTwips ( $ this -> _paddingTop ) . ' ' ) ; } if ( $ this -> _paddingBottom ) { $ stream -> write ( '\clpadfb3\clpadb' . PHPRtfLite_Unit :: getUnitInTwips ( $ this -> _paddingBottom ) . ' ' ) ; } if ( $ this -> _paddingRight ) { $ stream -> write ( '\clpadfr3\clpadr' . PHPRtfLite_Unit :: getUnitInTwips ( $ this -> _paddingRight ) . ' ' ) ; } $ border = $ this -> getBorder ( ) ; if ( $ border ) { $ stream -> write ( $ border -> getContent ( '\cl' ) ) ; } }
renders cell definition
renders cell definition