<?php
 
/**
 
 @package printform-xls
 
 @name testxls.php : working with CPrintFormXls class example
 
 @author Alexander Selifonov < alex [at] selifan (dot) ru >
 
 @link http://www.selifan.ru
 
**/
 
# Attention: PHPExcel.php and all sub-dirs must be in one of folders
 
#            listed in include_path PHP parameter !!!
 
 
require_once('PHPExcel.php');
 
require_once('PHPExcel/IOFactory.php');
 
require_once('PHPExcel/Reader/Excel5.php');
 
# require_once('PHPExcel/Cell/AdvancedValueBinder.php');
 
 
require_once('printform-xls.php');
 
 
$excel = new CPrintFormXls(array(
 
   'configfile' => 'cfg-test.xml'
 
  ,'outname' => 'myfile-test.xls'
 
));
 
 
$data = array(
 
   'last_name'  => 'Smirnoff'
 
  ,'first_name' => 'Ivan'
 
  ,'birthdate'  => '1970-04-18'
 
  ,'address'    => 'Russia, Moscow, Usacheva street, 33-999'
 
  ,'resident'   => 1
 
);
 
$excel->AddData($data);
 
 
$excel->SetAuthor('Shurik !');
 
$excel->SetDescription('Ïðîâåðêà ðàáîòû êëàññà CPrintFormXls, òàíöóþò âñå !');
 
 
$excel->ProtectSheets(true,'mypassword');
 
$excel->ProtectBook(true,'mypassword'); # doesn't work ???
 
 
# Let's manupulate XLS object manually
 
$xlsobj = $excel->GetXlsObject();
 
$xlsobj->getSheet(0)->setCellValueByColumnAndRow(3, 17, 'This text inserted outside class !');
 
 
$ok = $excel->Render();
 
 
if(!$ok) echo $excel->GetErrorMessage();
 
 
function AddBraces($param) {
 
    return "[ $param ]";
 
}
 
 |