Пример #1
0
<?php

session_start();
require "../conexion.php";
include "../funciones.php";
include "biff.php";
$myxls = new BiffWriter();
$myxls->xlsSetFont('Arial', 10, FONT_NORMAL);
//FONT_BOLD
$myxls->xlsSetColWidth(0, 0, 10);
$myxls->xlsSetColWidth(1, 1, 15);
$myxls->xlsSetColWidth(2, 2, 15);
$myxls->xlsSetColWidth(3, 3, 15);
$myxls->xlsSetColWidth(4, 4, 15);
$myxls->xlsSetColWidth(5, 5, 15);
$myxls->xlsSetColWidth(6, 6, 15);
$myxls->xlsSetColWidth(7, 7, 15);
$myxls->xlsSetColWidth(8, 8, 15);
$myxls->xlsWriteText(0, 0, "Nombre");
$myxls->xlsWriteText(0, 1, "Apellido");
$myxls->xlsWriteText(0, 2, "Cédula");
$myxls->xlsWriteText(0, 3, "Teléfono");
$myxls->xlsWriteText(0, 4, "Ciudad");
$myxls->xlsWriteText(0, 5, "Correo");
$myxls->xlsWriteText(0, 6, "Tipo de Usuario");
$myxls->xlsWriteText(0, 7, "Estado");
$j = 1;
$pu = mysql_query("SELECT * FROM registro WHERE boletines=1 ORDER BY nombre, apellido");
while ($vp = mysql_fetch_array($pu)) {
    $nombre = (string) $vp["nombre"];
    $myxls->xlsWriteText($j, 0, $nombre);
Пример #2
0
function Demo()
{
    global $fname;
    $myxls = new BiffWriter();
    // file name suggested to the browser (stream)
    $myxls->outfile = 'demo.xls';
    // create 4 default fonts
    $myxls->xlsSetFont('Arial', 10, FONT_NORMAL);
    $myxls->xlsSetFont('Arial', 10, FONT_BOLD);
    $myxls->xlsSetFont('Courier New', 8, FONT_NORMAL);
    $myxls->xlsSetFont('Courier New', 8, FONT_BOLD);
    // set default row height to 14 points
    $myxls->xlsSetDefRowHeight(14);
    // turn  backup flag on (xlk)
    $myxls->xlsSetBackup();
    // print grid lines
    $myxls->xlsSetPrintGridLines();
    // print row (1,2...) and col (A, B..) references
    $myxls->xlsSetPrintHeaders();
    // protect the sheet against changes, pw = ABCD
    // all EMPTY cells AND cells having the status CELL_LOCKED are protected
    $myxls->xlsProtectSheet('ABCD', TRUE);
    // print header
    $myxls->xlsHeader('&12BiffWriter Demo (c) C. Novak - cnovak@gmx.net');
    // print footer
    $myxls->xlsFooter('&L&12Page &P of &N &C&D &T &R&F/&A');
    // print margin in inches
    $myxls->xlsPrintMargins(1, 1, 1, 1);
    // set a page break after row 2
    $myxls->xlsAddHPageBreak(2);
    // set a page break before column C
    $myxls->xlsAddVPageBreak('C');
    // create some content
    $myxls->xlsWriteText('A1', 0, 'BiffWriter Demo (c) C. Novak - cnovak@gmx.net', -1, 0, FONT_1, CELL_BOTTOM_BORDER, CELL_LOCKED);
    $myxls->xlsCellNote('A1', 0, 'This cell is protected with CELL_LOCKED. Notes can contain up to 2048 characters currently');
    $myxls->xlsWriteText('A2', 0, 'Biff 2.1 allows for up to 4 fonts having different attributes:', -1);
    $myxls->xlsWriteText('A3', 0, 'Arial', 0, 0, FONT_0, ALIGN_RIGHT);
    $myxls->xlsWriteText('A4', 0, 'Arial bold', 0, 0, FONT_1, ALIGN_RIGHT);
    $myxls->xlsWriteText('A5', 0, 'Courier', 0, 0, FONT_2, ALIGN_RIGHT);
    $myxls->xlsWriteText('A6', 0, 'Courier bold', 0, 0, FONT_3, ALIGN_RIGHT);
    $myxls->xlsWriteText('A7', 0, 'BIFF 2.1 comes with 21 predefined formats, custom formats can be added:', -1);
    $myxls->xlsCellNote('A7', 0, 'The cells below are set to "autowidth" and determine the width of column A');
    // add a user defined picture (format)
    $idx_fmt = $myxls->xlsAddFormat('[Blue] 0 "US$"');
    // print all defined picture strings using 33333.3333
    for ($x = 0; $x < count($myxls->picture); $x++) {
        $myxls->xlsWriteText($x + 7, 0, 'Format id ' . strval($x), 0, 0, FONT_2);
        $myxls->xlsWriteNumber($x + 7, 1, 33333.3333, 20, $x, FONT_2);
        if (empty($myxls->picture[$x])) {
            $myxls->xlsWriteText($x + 7, 2, 'predefined', 0, 0, FONT_2);
        } else {
            $myxls->xlsWriteText($x + 7, 2, 'custom ' . $myxls->picture[$x], 0, 0, FONT_3, CELL_BOX_BORDER);
        }
    }
    // assemble the stream
    // and either send the stream to the browser or
    // save it as a file in the location/filename passed via $fname
    $myxls->xlsParse($fname);
    return;
}