Ejemplo n.º 1
0
 /**
  * Gets rtf code of header. Internal use. 
  * @return string
  * @access public 
  */
 function getContent()
 {
     $content = isset($this->headery) ? '\\headery' . round(TWIPS_IN_CM * $this->headery) . ' ' : '';
     $content .= '{\\' . $this->type . ' ';
     $content .= parent::getContent();
     $content .= '\\par ';
     $content .= '}';
     return $content . "\r\n";
 }
Ejemplo n.º 2
0
 /** 
  * Gets rtf code of Cell object. Internal use.
  * @return string
  * @access public
  */
 function getContent()
 {
     $content = '{';
     $content .= !empty($this->alignment) ? $this->alignment : '';
     $content .= !empty($this->font) ? $this->font->getContent($this->rtf) : '';
     $content .= Container::getContent() . '\\cell \\pard }' . "\r\n";
     return $content;
 }
Ejemplo n.º 3
0
 /** 
  * Gets rtf code of section. Internal use.
  * @return string
  * @access public
  */
 function getContent()
 {
     $content = '';
     if (empty($this->first)) {
         $content .= '\\sect \\sectd ';
     }
     //headers
     if (!empty($this->headers)) {
         foreach ($this->headers as $value) {
             $content .= $value->getContent();
         }
     } else {
         foreach ($this->rtf->headers as $value) {
             $content .= $value->getContent();
         }
     }
     //footers
     if (!empty($this->footers)) {
         foreach ($this->footers as $value) {
             $content .= $value->getContent();
         }
     } else {
         foreach ($this->rtf->footers as $value) {
             $content .= $value->getContent();
         }
     }
     //borders
     if (!empty($this->bordered)) {
         $content .= $this->bordered->getContent($this->rtf, '\\pg');
     } else {
         if (!empty($this->rtf->bordered)) {
             $content .= $this->rtf->bordered->getContent($this->rtf, '\\pg');
         }
     }
     //section properties
     if (!empty($this->noBreak)) {
         $content .= '\\sbknone ';
     }
     if (!empty($this->columnsCount)) {
         $content .= '\\cols' . $this->columnsCount . ' ';
     }
     if (empty($this->columnsWidths)) {
         if (!empty($this->spaceBetweenColumns)) {
             $content .= '\\colsx' . round($this->spaceBetweenColumns * TWIPS_IN_CM) . ' ';
         }
     } else {
         $width = 0;
         foreach ($this->columnsWidths as $value) {
             $width += $value * TWIPS_IN_CM;
         }
         $printableWidth = $this->rtf->paperWidth - $this->rtf->marginLeft - $this->rtf->marginRight;
         $space = round(($printableWidth * TWIPS_IN_CM - $width) / (count($this->columnsWidths) - 1));
         $i = 1;
         foreach ($this->columnsWidths as $key => $value) {
             $content .= '\\colno' . $i . '\\colw' . $value * TWIPS_IN_CM;
             if (!empty($this->columnsWidths[$key])) {
                 $content .= '\\colsr' . $space;
             }
             $i++;
         }
         $content .= ' ';
     }
     if (!empty($this->lineBetweenColumns)) {
         $content .= '\\linebetcol ';
     }
     /*---Page part---*/
     if (isset($this->paperWidth)) {
         $content .= '\\pgwsxn' . round($this->paperWidth * TWIPS_IN_CM) . ' ';
     }
     if (isset($this->paperHeight)) {
         $content .= '\\pghsxn' . round($this->paperHeight * TWIPS_IN_CM) . ' ';
     }
     if (isset($this->marginLeft)) {
         $content .= '\\marglsxn' . round($this->marginLeft * TWIPS_IN_CM) . ' ';
     }
     if (isset($this->marginRight)) {
         $content .= '\\margrsxn' . round($this->marginRight * TWIPS_IN_CM) . ' ';
     }
     if (isset($this->marginTop)) {
         $content .= '\\margtsxn' . round($this->marginTop * TWIPS_IN_CM) . ' ';
     }
     if (isset($this->marginBottom)) {
         $content .= '\\margbsxn' . round($this->marginBottom * TWIPS_IN_CM) . ' ';
     }
     if (isset($this->gutter)) {
         $content .= '\\guttersxn' . round($this->gutter * TWIPS_IN_CM) . ' ';
     }
     if (!empty($this->mirrorMargins)) {
         $content .= '\\margmirsxn ';
     }
     //vertical alignment
     if (!empty($this->alignment)) {
         $content .= $this->alignment;
     }
     $content .= "\r\n" . parent::getContent() . "\r\n";
     return $content;
 }