Example #1
0
$format_text =& $workbook->addFormat(array('Border' => '0', 'Size' => '8'));
$worksheet->setLandscape();
$worksheet->setPaper(1);
$workbook->writeMerge($worksheet, 1, 0, 5, 1, 'Sample Report', $format_title);
$col = 0;
$row = 2;
$cols = array(array('name' => 'Jenis', 'width' => 20), array('name' => 'Tanggal', 'width' => 20), array('name' => 'Perihal', 'width' => 70), array('name' => 'Kode', 'width' => 40), array('name' => 'Tahun', 'width' => 20));
foreach ($cols as $field) {
    $worksheet->writeString($row, $col, $field['name'], $format_title_field);
    //$worksheet->setColumn($row, $col,$field['width']+0);
    //$format_title_field->setTextWrap();
    $col++;
}
$row++;
$data = array();
while ($rowx = $rs->FetchNextObject()) {
    $data[] = array($rowx->JENIS, formatDate2($rowx->TANGGAL), $rowx->PERIHAL, $rowx->KODE, $rowx->TAHUN);
}
foreach ($data as $r) {
    $col = 0;
    foreach ($r as $c) {
        $worksheet->writeString($row, $col, $c, $format_text);
        $col++;
    }
    $row++;
}
$workbook->close();
if (set_magic_quotes_runtime(1) == false) {
    die("Set Magic Quote Runtime Failed.");
}
exit;
Example #2
0
<?php

include_once ABSPATH . "includes/php-pdf/class.ezpdf.php";
$cols = array('jenis' => 'Jenis', 'tanggal' => 'Tanggal', 'perihal' => 'perihal', 'kode' => 'Kode', 'tahun' => 'Tahun');
$options = array('shaded' => 1, 'width' => 500, 'fontSize' => 8, 'titleFontSize' => 10);
$data = array();
while ($row = $rs->FetchNextObject()) {
    $data[] = array('jenis' => $row->JENIS, 'tanggal' => formatDate2($row->TANGGAL), 'perihal' => $row->PERIHAL, 'kode' => $row->KODE, 'tahun' => $row->TAHUN);
}
$pdf = new Cezpdf('a4', 'potrait');
$pdf->selectFont('includes/php-pdf/fonts/Helvetica.afm');
$pdf->ezText('<b>Sample Report</b>', 14, array('justification' => 'center'));
$pdf->ezSetDy(-20);
$pdf->ezTable($data, $cols, '', $options);
$pdf->ezStream();