示例#1
0
$style3->setBorder('0.01cm solid #0000ff');
// Align start
$style4_1 = new odsStyleTableCell();
$style4_1->setTextAlign('start');
// Align center
$style4_2 = new odsStyleTableCell();
$style4_2->setTextAlign('center');
// Align end
$style4_3 = new odsStyleTableCell();
$style4_3->setTextAlign('end');
// Align justify
$style4_4 = new odsStyleTableCell();
$style4_4->setTextAlign('justify');
// Bold [bold, normal]
$style5 = new odsStyleTableCell();
$style5->setFontWeight('bold');
// Italic [italic, normal]
$style6 = new odsStyleTableCell();
$style6->setFontStyle('italic');
// Underline [font-color, #000000, null]
$style7 = new odsStyleTableCell();
$style7->setUnderline("font-color");
// Font size
$style8 = new odsStyleTableCell();
$style8->setFontSize("18pt");
// Font Face
$TimesNewRoman = new odsFontFace('Times New Roman');
$ods->addFontFaces($TimesNewRoman);
$style9 = new odsStyleTableCell();
$style9->setFontFace($TimesNewRoman);
// Font Face
示例#2
0
 public function ods($start, $end)
 {
     $data = $this->gendate($start, $end);
     $ods = new ods();
     $table = new odsTable('table 1');
     $table->setHorizontalSplit(1);
     $table->setVerticalSplit(3);
     // Set coluomn width
     $styleColumn = new odsStyleTableColumn();
     $styleColumn->setColumnWidth("4cm");
     $table->addTableColumn(new odsTableColumn($styleColumn));
     $table->addTableColumn($column = new odsTableColumn($styleColumn = new odsStyleTableColumn()));
     $styleColumn->setColumnWidth("1.5cm");
     $column->setRepeated($data['total_days']);
     // Set Title Style
     $styleTitle1 = new odsStyleTableCell();
     $styleTitle1->setBorder("0.01cm solid #000000");
     $styleTitle1->setFontWeight('bold');
     $styleTitle2 = clone $styleTitle1;
     $styleTitle2->setTextAlign("center");
     // Months style
     $row = new odsTableRow();
     $row->addCell(new odsTableCellString("Months:", $styleTitle1));
     foreach ($data['months'] as $moi) {
         $cell = new odsTableCellString($moi['title'], $styleTitle2);
         $cell->setNumberColumnsSpanned($moi['day']);
         $row->addCell($cell);
     }
     $table->addRow($row);
     $row = new odsTableRow();
     $row->addCell(new odsTableCellString("Weeks :", $styleTitle1));
     foreach ($data['weeks'] as $week) {
         $cell = new odsTableCellString($week['title'], $styleTitle2);
         $cell->setNumberColumnsSpanned($week['day']);
         $row->addCell($cell);
     }
     $table->addRow($row);
     $row = new odsTableRow();
     $row->addCell(new odsTableCellString("Days:", $styleTitle1));
     foreach ($data['days'] as $day) {
         $cell = new odsTableCellString($day['title'], $styleTitle2);
         $cell->setNumberColumnsSpanned($day['day']);
         $row->addCell($cell);
     }
     $table->addRow($row);
     foreach ($data['projects'] as $projet) {
         $row = new odsTableRow();
         $row->addCell(new odsTableCellString($projet['title'], $styleTitle1));
         if ($projet["shift"]) {
             $cell = new odsTableCellEmpty();
             $cell->setNumberColumnsRepeated($projet["shift"]);
             $row->addCell($cell);
         }
         $styleX = clone $styleTitle2;
         $styleX->setBackgroundColor($projet[color]);
         $cell = new odsTableCellString($projet['title'], $styleX);
         $cell->setNumberColumnsSpanned($projet['days']);
         $row->addCell($cell);
         $table->addRow($row);
     }
     $ods->addTable($table);
     $ods->downloadOdsFile("tab.ods");
     exit;
 }