예제 #1
0
 public function getContent(ods $ods, DOMDocument $dom)
 {
     if ($this->styleName) {
         $style = $this->styleName;
     } else {
         $style = new odsStyleGraphic("gr1");
     }
     $ods->addTmpStyles($style);
     $table_table_cell = $dom->createElement('table:table-cell');
     $this->cellOpts($table_table_cell);
     $draw_frame = $dom->createElement('draw:frame');
     //$draw_frame->setAttribute("table:end-cell-address", "Feuille1.AA85");
     //$draw_frame->setAttribute("table:end-x", "1.27cm");
     //$draw_frame->setAttribute("table:end-y", "0.472cm");
     $draw_frame->setAttribute("draw:z-index", $this->zIndex);
     $draw_frame->setAttribute("draw:name", "Images " . md5(time() . rand()));
     $draw_frame->setAttribute("draw:style-name", $style->getName());
     $draw_frame->setAttribute("draw:text-style-name", "P1");
     $draw_frame->setAttribute("svg:width", $this->width);
     $draw_frame->setAttribute("svg:height", $this->height);
     $draw_frame->setAttribute("svg:x", $this->x);
     $draw_frame->setAttribute("svg:y", $this->y);
     $table_table_cell->appendChild($draw_frame);
     $draw_image = $dom->createElement('draw:image');
     $draw_image->setAttribute("xlink:href", $ods->addTmpPictures($this->file));
     $draw_image->setAttribute("xlink:type", "simple");
     $draw_image->setAttribute("xlink:show", "embed");
     $draw_image->setAttribute("xlink:actuate", "onLoad");
     $draw_frame->appendChild($draw_image);
     $text_p = $dom->createElement('text:p');
     $draw_image->appendChild($text_p);
     return $table_table_cell;
 }
예제 #2
0
 protected function getContent(ods $ods, DOMDocument $dom)
 {
     $table_table_cell = $dom->createElement('table:table-cell');
     if ($this->styleName) {
         $ods->addTmpStyles($this->styleName);
         $table_table_cell->setAttribute("table:style-name", $this->styleName->getName());
     }
     $this->cellOpts($table_table_cell);
     return $table_table_cell;
 }
예제 #3
0
 public function getContent(ods $ods, DOMDocument $dom)
 {
     if (!$ods->getStyleByName($this->odsStyleTableColumn->getName())) {
         $ods->addTmpStyles($this->odsStyleTableColumn);
     }
     $table_table_column = $dom->createElement('table:table-column');
     $table_table_column->setAttribute("table:style-name", $this->odsStyleTableColumn->getName());
     if ($this->repeated) {
         $table_table_column->setAttribute("table:number-columns-repeated", $this->repeated);
     }
     $table_table_column->setAttribute("table:default-cell-style-name", "Default");
     return $table_table_column;
 }
예제 #4
0
 public function getContent(ods $ods, DOMDocument $dom)
 {
     switch ($this->format) {
         case 'MMDDYYHHMMSSAMPM':
             $ods->addTmpStyles(new odsStyleDateTimeMMDDYYHHMMSSAMPM($this->language));
             break;
         case 'MMDDYYHHMMAMPM':
             $ods->addTmpStyles(new odsStyleDateTimeMMDDYYHHMMAMPM($this->language));
             break;
         case 'DDMMYYHHMMSS':
             $ods->addTmpStyles(new odsStyleDateTimeDDMMYYHHMMSS($this->language));
             break;
         case 'DDMMYYHHMM':
             $ods->addTmpStyles(new odsStyleDateTimeDDMMYYHHMM($this->language));
             break;
         default:
             //FIXME: send error;
     }
     $table_table_cell = $dom->createElement('table:table-cell');
     $this->cellOpts($table_table_cell);
     if ($this->styleName) {
         $style = $ods->getStyleByName($this->styleName->getName() . "-" . $this->format);
         if (!$style) {
             $style = clone $this->styleName;
             $style->setName($this->styleName->getName() . "-" . $this->format);
             $style->setStyleDataName('DateTime-' . $this->format);
             $ods->addTmpStyles($style);
         }
         $table_table_cell->setAttribute("table:style-name", $style->getName());
     } else {
         $style = $ods->getStyleByName("ce1-" . $this->format);
         if (!$style) {
             $style = clone $ods->getStyleByName("ce1");
             $style->setName("ce1-" . $this->format);
             $style->setStyleDataName('DateTime-' . $this->format);
             $ods->addTmpStyles($style);
         }
         $table_table_cell->setAttribute("table:style-name", $style->getName());
     }
     $table_table_cell->setAttribute("office:value-type", "date");
     $table_table_cell->setAttribute("office:date-value", $this->dateTime);
     return $table_table_cell;
 }
예제 #5
0
파일: Ods.php 프로젝트: sgdoc/sgdoce-codigo
 /**
  * Salva o documento Ods
  * @param string $path
  * @throws DocumentException
  */
 public function save($dir)
 {
     foreach ($this->_pages as $page) {
         $this->_ods->addTable($page->content());
     }
     $dir = substr($dir, -1, 1) == '/' ? $dir : $dir . '/';
     $file = $dir . $this->property()->getName() . '.ods';
     $this->_ods->genOdsFile($file);
     if (!file_exists($file)) {
         throw new DocumentException(self::ERROR_SAVE);
     }
 }
예제 #6
0
 public function getContent(ods $ods, DOMDocument $dom)
 {
     switch ($this->currency) {
         case 'EUR':
             $ods->addTmpStyles(new odsStyleMoneyEUR());
             $ods->addTmpStyles(new odsStyleMoneyEURNeg());
             break;
         case 'USD':
             $ods->addTmpStyles(new odsStyleMoneyUSD());
             $ods->addTmpStyles(new odsStyleMoneyUSDNeg());
             break;
         case 'GBP':
             $ods->addTmpStyles(new odsStyleMoneyGBP());
             $ods->addTmpStyles(new odsStyleMoneyGBPNeg());
             break;
         default:
             //FIXME: send error;
     }
     $table_table_cell = $dom->createElement('table:table-cell');
     $this->cellOpts($table_table_cell);
     if ($this->styleName) {
         $style = $ods->getStyleByName($this->styleName->getName() . "-" . $this->currency);
         if (!$style) {
             $style = clone $this->styleName;
             $style->setName($this->styleName->getName() . "-" . $this->currency);
             $style->setStyleDataName('NCur-' . $this->currency);
             $ods->addTmpStyles($style);
         }
         $table_table_cell->setAttribute("table:style-name", $style->getName());
     } else {
         $style = $ods->getStyleByName("ce1-" . $this->currency);
         if (!$style) {
             $style = clone $ods->getStyleByName("ce1");
             $style->setName("ce1-" . $this->currency);
             $style->setStyleDataName('NCur-' . $this->currency);
             $ods->addTmpStyles($style);
         }
         $table_table_cell->setAttribute("table:style-name", $style->getName());
     }
     $table_table_cell->setAttribute("office:value-type", "currency");
     $table_table_cell->setAttribute("office:currency", $this->currency);
     $table_table_cell->setAttribute("office:value", $this->value);
     // text:p
     $text_p = $dom->createElement('text:p');
     $table_table_cell->appendChild($text_p);
     return $table_table_cell;
 }