Exemple #1
0
 protected function _writeTextStyle(Document_Word_Writer_Shared_XMLWriter $objWriter = null, Document_Word_Writer_Style_Font $style)
 {
     $font = $style->getName();
     $bold = $style->getBold();
     $italic = $style->getItalic();
     $color = $style->getColor();
     $size = $style->getSize();
     $fgColor = $style->getFgColor();
     $striketrough = $style->getStrikethrough();
     $underline = $style->getUnderline();
     $objWriter->startElement('w:rPr');
     // Font
     if ($font != 'Arial') {
         $objWriter->startElement('w:rFonts');
         $objWriter->writeAttribute('w:ascii', $font);
         $objWriter->writeAttribute('w:hAnsi', $font);
         $objWriter->writeAttribute('w:cs', $font);
         $objWriter->endElement();
     }
     // Color
     if ($color != '000000') {
         $objWriter->startElement('w:color');
         $objWriter->writeAttribute('w:val', $color);
         $objWriter->endElement();
     }
     // Size
     if ($size != 20) {
         $objWriter->startElement('w:sz');
         $objWriter->writeAttribute('w:val', $size);
         $objWriter->endElement();
         $objWriter->startElement('w:szCs');
         $objWriter->writeAttribute('w:val', $size);
         $objWriter->endElement();
     }
     // Bold
     if ($bold) {
         $objWriter->writeElement('w:b', null);
     }
     // Italic
     if ($italic) {
         $objWriter->writeElement('w:i', null);
         $objWriter->writeElement('w:iCs', null);
     }
     // Underline
     if (!is_null($underline) && $underline != 'none') {
         $objWriter->startElement('w:u');
         $objWriter->writeAttribute('w:val', $underline);
         $objWriter->endElement();
     }
     // Striketrough
     if ($striketrough) {
         $objWriter->writeElement('w:strike', null);
     }
     // Foreground-Color
     if (!is_null($fgColor)) {
         $objWriter->startElement('w:highlight');
         $objWriter->writeAttribute('w:val', $fgColor);
         $objWriter->endElement();
     }
     $objWriter->endElement();
 }
Exemple #2
0
 /**
  * Add a title style
  * 
  * @param string $styleName
  * @param array $styleFont
  * @param array $styleParagraph
  */
 public static function addTitleStyle($titleCount, $styleFont, $styleParagraph = null)
 {
     require_once __DIR__ . '/Style/Font.php';
     $styleName = 'Heading_' . $titleCount;
     if (!array_key_exists($styleName, self::$_styleElements)) {
         $font = new Document_Word_Writer_Style_Font('title', $styleParagraph);
         foreach ($styleFont as $key => $value) {
             if (substr($key, 0, 1) != '_') {
                 $key = '_' . $key;
             }
             $font->setStyleValue($key, $value);
         }
         self::$_styleElements[$styleName] = $font;
     }
 }