Box\Spout\Writer\Style\Style::shouldWrapText PHP Method

shouldWrapText() public method

public shouldWrapText ( ) : boolean
return boolean
    public function shouldWrapText()
    {
        return $this->shouldWrapText;
    }

Usage Example

Esempio n. 1
0
 /**
  * Returns the contents of the "<style:style>" section, inside "<office:automatic-styles>" section
  *
  * @param \Box\Spout\Writer\Style\Style $style
  * @return string
  */
 protected function getStyleSectionContent($style)
 {
     $defaultStyle = $this->getDefaultStyle();
     $styleIndex = $style->getId() + 1;
     // 1-based
     $content = '<style:style style:data-style-name="N0" style:family="table-cell" style:name="ce' . $styleIndex . '" style:parent-style-name="Default">';
     if ($style->shouldApplyFont()) {
         $content .= '<style:text-properties';
         $fontColor = $style->getFontColor();
         if ($fontColor !== $defaultStyle->getFontColor()) {
             $content .= ' fo:color="#' . $fontColor . '"';
         }
         $fontName = $style->getFontName();
         if ($fontName !== $defaultStyle->getFontName()) {
             $content .= ' style:font-name="' . $fontName . '" style:font-name-asian="' . $fontName . '" style:font-name-complex="' . $fontName . '"';
         }
         $fontSize = $style->getFontSize();
         if ($fontSize !== $defaultStyle->getFontSize()) {
             $content .= ' fo:font-size="' . $fontSize . 'pt" style:font-size-asian="' . $fontSize . 'pt" style:font-size-complex="' . $fontSize . 'pt"';
         }
         if ($style->isFontBold()) {
             $content .= ' fo:font-weight="bold" style:font-weight-asian="bold" style:font-weight-complex="bold"';
         }
         if ($style->isFontItalic()) {
             $content .= ' fo:font-style="italic" style:font-style-asian="italic" style:font-style-complex="italic"';
         }
         if ($style->isFontUnderline()) {
             $content .= ' style:text-underline-style="solid" style:text-underline-type="single"';
         }
         if ($style->isFontStrikethrough()) {
             $content .= ' style:text-line-through-style="solid"';
         }
         $content .= '/>';
     }
     if ($style->shouldWrapText()) {
         $content .= '<style:table-cell-properties fo:wrap-option="wrap" style:vertical-align="automatic"/>';
     }
     if ($style->shouldApplyBorder()) {
         $borderProperty = '<style:table-cell-properties %s />';
         $borders = array_map(function (BorderPart $borderPart) {
             return BorderHelper::serializeBorderPart($borderPart);
         }, $style->getBorder()->getParts());
         $content .= sprintf($borderProperty, implode(' ', $borders));
     }
     if ($style->shouldApplyBackgroundColor()) {
         $content .= sprintf('
             <style:table-cell-properties fo:background-color="#%s"/>', $style->getBackgroundColor());
     }
     $content .= '</style:style>';
     return $content;
 }
All Usage Examples Of Box\Spout\Writer\Style\Style::shouldWrapText