Initialer Commit
This commit is contained in:
commit
47de7d4d4c
7
config/autoload.ini
Normal file
7
config/autoload.ini
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
;;
|
||||||
|
; Configure what you want the autoload creator to register
|
||||||
|
;;
|
||||||
|
register_namespaces = true
|
||||||
|
register_classes = true
|
||||||
|
register_templates = true
|
28
config/autoload.php
Normal file
28
config/autoload.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Contao Open Source CMS
|
||||||
|
*
|
||||||
|
* Copyright (C) 2005-2012 Leo Feyer
|
||||||
|
*
|
||||||
|
* @package xls_export
|
||||||
|
* @link http://contao.org
|
||||||
|
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Register the classes
|
||||||
|
*/
|
||||||
|
ClassLoader::addClasses(array
|
||||||
|
(
|
||||||
|
// Classes
|
||||||
|
'xls_bof' => 'system/modules/xls_export/vendor/biff.php',
|
||||||
|
'fat_class' => 'system/modules/xls_export/vendor/fat.php',
|
||||||
|
'xls_font' => 'system/modules/xls_export/vendor/font.php',
|
||||||
|
'xls_mergedcells' => 'system/modules/xls_export/vendor/mergedcells.php',
|
||||||
|
'xls_palette' => 'system/modules/xls_export/vendor/palette.php',
|
||||||
|
'xls_picture' => 'system/modules/xls_export/vendor/picture.php',
|
||||||
|
'xls_xf' => 'system/modules/xls_export/vendor/xf.php',
|
||||||
|
'xlsexport' => 'system/modules/xls_export/vendor/xls_export.php',
|
||||||
|
));
|
322
vendor/biff.php
vendored
Normal file
322
vendor/biff.php
vendored
Normal file
@ -0,0 +1,322 @@
|
|||||||
|
<?php
|
||||||
|
define ("XLSDATA_BYTE", 1,true);
|
||||||
|
define ("XLSDATA_SHORT", 2,true);
|
||||||
|
define ("XLSDATA_LONG", 3,true);
|
||||||
|
define ("XLSDATA_FLOAT", 4,true);
|
||||||
|
define ("XLSDATA_STRING", 5,true);
|
||||||
|
define ("XLSDATA_LSTRING", 6,true);
|
||||||
|
define ("XLSDATA_STRING1", 7,true);
|
||||||
|
define ("XLSDATA_DATA32BIT",8,true);
|
||||||
|
|
||||||
|
define ("XLS_BIFF5",0x0809);
|
||||||
|
define ("XLS_BIFF_EOF",0x000a);
|
||||||
|
define ("WORKBOOK_SHEET",0x0010);
|
||||||
|
|
||||||
|
define ("BIFF_WORKBOOKGLOBALS",0x0005);
|
||||||
|
define ("BIFF_CALCCOUNT",0x000c);
|
||||||
|
define ("BIFF_CALCMODE",0x000d);
|
||||||
|
define ("BIFF_PRECISION",0x000e);
|
||||||
|
define ("BIFF_REFMODE",0x000f);
|
||||||
|
define ("BIFF_DELTA",0x0010);
|
||||||
|
define ("BIFF_ITERATION",0x0011);
|
||||||
|
define ("BIFF_PROTECT",0x0012);
|
||||||
|
define ("BIFF_PASSWORD",0x0013);
|
||||||
|
define ("BIFF_PAGEHEADER",0x0014);
|
||||||
|
define ("BIFF_PAGEFOOTER",0x0015);
|
||||||
|
define ("BIFF_EXTERNALREFERENCESCOUNT",0x0016);
|
||||||
|
define ("BIFF_EXTERNSHEET",0x0017);
|
||||||
|
define ("BIFF_DEFINEDNAME",0x0018);
|
||||||
|
define ("BIFF_WINDOWPROTECT",0x0019);
|
||||||
|
define ("BIFF_SELECTION",0x001d);
|
||||||
|
define ("BIFF_DATEMODE",0x0022);
|
||||||
|
define ("BIFF_LEFTMARGIN",0x0026);
|
||||||
|
define ("BIFF_RIGHTMARGIN",0x0027);
|
||||||
|
define ("BIFF_TOPMARGIN",0x0028);
|
||||||
|
define ("BIFF_BOTTOMMARGIN",0x0029);
|
||||||
|
define ("BIFF_PRINTHEADERS",0x002a);
|
||||||
|
define ("BIFF_PRINTGRIDLINES",0x002b);
|
||||||
|
define ("BIFF_FONT",0x0031);
|
||||||
|
define ("BIFF_CONTINUE",0x003c);
|
||||||
|
define ("BIFF_WINDOW1",0x003d);
|
||||||
|
define ("BIFF_BACKUP",0x0040);
|
||||||
|
define ("BIFF_DEFCOLWIDTH",0x0055);
|
||||||
|
define ("BIFF_WRITEACCESS",0x005c);
|
||||||
|
define ("BIFF_OBJECT",0x005d);
|
||||||
|
define ("BIFF_SAVERECALC",0x005f);
|
||||||
|
define ("BIFF_COLINFO",0x007d);
|
||||||
|
define ("BIFF_IMAGEDATA",0x007f);
|
||||||
|
define ("BIFF_GUTS",0x0080);
|
||||||
|
define ("BIFF_SHEETPR",0x0081);
|
||||||
|
define ("BIFF_GRIDSET",0x0082);
|
||||||
|
define ("BIFF_HCENTER",0x0083);
|
||||||
|
define ("BIFF_VCENTER",0x0084);
|
||||||
|
define ("BIFF_BOUNDSHEET",0x0085);
|
||||||
|
define ("BIFF_COUNTRY",0x008c);
|
||||||
|
define ("BIFF_OBJECTDISPLAYOPTIONS",0x008d);
|
||||||
|
define ("BIFF_PALETTE",0x0092);
|
||||||
|
define ("BIFF_FUNCTIONGROUPCOUNT",0x009c);
|
||||||
|
define ("BIFF_PAGESETUP",0x00a1);
|
||||||
|
define ("BIFF_TOOLBARHEADER",0x00bf); // undocumented
|
||||||
|
define ("BIFF_TOOLBAREND",0x00c0); // undocumented
|
||||||
|
define ("BIFF_MENURECORDGROUP",0x00c1);
|
||||||
|
define ("BIFF_DBCELL",0x00d7);
|
||||||
|
define ("BIFF_BOOKBOOL",0x00da);
|
||||||
|
define ("BIFF_XFRECORD",0x00e0);
|
||||||
|
define ("BIFF_INTERFACEHEADER",0x00e1);
|
||||||
|
define ("BIFF_INTERFACEEND",0x00e2);
|
||||||
|
define ("BIFF_MERGEDCELLS",0x00e5);
|
||||||
|
|
||||||
|
/*
|
||||||
|
016FH = 367 = ASCII
|
||||||
|
01B5H = 437 = IBM PC CP-437 (US)
|
||||||
|
02D0H = 720 = IBM PC CP-720 (OEM Arabic)
|
||||||
|
02E1H = 737 = IBM PC CP-737 (Greek)
|
||||||
|
0307H = 775 = IBM PC CP-775 (Baltic)
|
||||||
|
0352H = 850 = IBM PC CP-850 (Latin I)
|
||||||
|
0354H = 852 = IBM PC CP-852 (Latin II (Central European))
|
||||||
|
0357H = 855 = IBM PC CP-855 (Cyrillic)
|
||||||
|
0359H = 857 = IBM PC CP-857 (Turkish)
|
||||||
|
035AH = 858 = IBM PC CP-858 (Multilingual Latin I with Euro)
|
||||||
|
035CH = 860 = IBM PC CP-860 (Portuguese)
|
||||||
|
035DH = 861 = IBM PC CP-861 (Icelandic)
|
||||||
|
035EH = 862 = IBM PC CP-862 (Hebrew)
|
||||||
|
035FH = 863 = IBM PC CP-863 (Canadian (French))
|
||||||
|
0360H = 864 = IBM PC CP-864 (Arabic)
|
||||||
|
0361H = 865 = IBM PC CP-865 (Nordic)
|
||||||
|
0362H = 866 = IBM PC CP-866 (Cyrillic (Russian))
|
||||||
|
0365H = 869 = IBM PC CP-869 (Greek (Modern))
|
||||||
|
036AH = 874 = Windows CP-874 (Thai)
|
||||||
|
03A4H = 932 = Windows CP-932 (Japanese Shift-JIS)
|
||||||
|
03A8H = 936 = Windows CP-936 (Chinese Simplified GBK)
|
||||||
|
03B5H = 949 = Windows CP-949 (Korean (Wansung))
|
||||||
|
03B6H = 950 = Windows CP-950 (Chinese Traditional BIG5)
|
||||||
|
04B0H = 1200 = UTF-16 (BIFF8)
|
||||||
|
04E2H = 1250 = Windows CP-1250 (Latin II) (Central European)
|
||||||
|
04E3H = 1251 = Windows CP-1251 (Cyrillic)
|
||||||
|
04E4H = 1252 = Windows CP-1252 (Latin I) (BIFF4-BIFF5)
|
||||||
|
04E5H = 1253 = Windows CP-1253 (Greek)
|
||||||
|
04E6H = 1254 = Windows CP-1254 (Turkish)
|
||||||
|
04E7H = 1255 = Windows CP-1255 (Hebrew)
|
||||||
|
04E8H = 1256 = Windows CP-1256 (Arabic)
|
||||||
|
04E9H = 1257 = Windows CP-1257 (Baltic)
|
||||||
|
04EAH = 1258 = Windows CP-1258 (Vietnamese)
|
||||||
|
0551H = 1361 = Windows CP-1361 (Korean (Johab))
|
||||||
|
2710H = 10000 = Apple Roman
|
||||||
|
8000H = 32768 = Apple Roman
|
||||||
|
8001H = 32769 = Windows CP-1252 (Latin I) (BIFF2-BIFF3)
|
||||||
|
*/
|
||||||
|
define ("BIFF_CODEPAGE",0x0042);
|
||||||
|
|
||||||
|
define ("BIFF_REFRESHALL",0x01b7);
|
||||||
|
define ("BIFF_DIMENSIONS",0x0200);
|
||||||
|
define ("BIFF_NUMBER",0x0203);
|
||||||
|
define ("BIFF_LABEL",0x0204);
|
||||||
|
define ("BIFF_ROW",0x0208);
|
||||||
|
define ("BIFF_INDEX",0x020b);
|
||||||
|
define ("BIFF_DEFAULTROWHEIGHT",0x0225);
|
||||||
|
define ("BIFF_WINDOW2",0x023e);
|
||||||
|
define ("BIFF_STYLEINFORMATION",0x0293);
|
||||||
|
define ("BIFF_FORMAT",0x041e);
|
||||||
|
define ("BIFF_SHEETPROTECTION",0x0867);
|
||||||
|
|
||||||
|
class xls_bof {
|
||||||
|
var $data = null;
|
||||||
|
var $size = 0;
|
||||||
|
var $type = null;
|
||||||
|
|
||||||
|
public function __construct($aboftype=-1) {
|
||||||
|
if ($aboftype==-1) { die("Error"); }
|
||||||
|
$this->data = array();
|
||||||
|
$this->type = $aboftype;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function append($adatatype, $adatarec) {
|
||||||
|
$new = array();
|
||||||
|
$new["type"] = $adatatype;
|
||||||
|
$new["data"] = $adatarec;
|
||||||
|
$this->data[] = $new;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clear($aboftype=-1) {
|
||||||
|
if ($aboftype==-1) { die("Error"); }
|
||||||
|
$this->type = $aboftype;
|
||||||
|
$this->data = array();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function fetch() {
|
||||||
|
$output = "";
|
||||||
|
foreach ($this->data as $key => $datarec) {
|
||||||
|
switch ($datarec["type"]) {
|
||||||
|
case XLSDATA_BYTE : $output .= pack("C",$datarec["data"]);
|
||||||
|
$this->size+=1;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case XLSDATA_SHORT: $output .= pack("v",$datarec["data"]);
|
||||||
|
$this->size+=2;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case XLSDATA_LONG : $output .= pack("V",$datarec["data"]);
|
||||||
|
$this->size+=4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case XLSDATA_FLOAT: $output .= pack("d",$datarec["data"]);
|
||||||
|
$this->size+=8;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case XLSDATA_DATA32BIT :
|
||||||
|
$ldata = $datarec["data"];
|
||||||
|
$b3 = $ldata & 0xff;
|
||||||
|
$b2 = ($ldata >> 8) & 0xff;
|
||||||
|
$b1 = ($ldata >> 16) & 0xff;
|
||||||
|
$b0 = ($ldata >> 24) & 0xff;
|
||||||
|
$output .= pack("CCCC",$b0,$b1,$b2,$b3);
|
||||||
|
$this->size+=4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case XLSDATA_STRING:
|
||||||
|
$output .= pack("C",strlen($datarec["data"]));
|
||||||
|
$this->size++;
|
||||||
|
if (strlen($datarec["data"])==0) {
|
||||||
|
$output .= pack("C",0x00);
|
||||||
|
$this->size++;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case XLSDATA_STRING1:
|
||||||
|
$this->size+=strlen($datarec["data"]);
|
||||||
|
//$output .= pack("C",$datarec["data"]);
|
||||||
|
$output .= $datarec["data"];
|
||||||
|
break;
|
||||||
|
case XLSDATA_LSTRING:
|
||||||
|
$output .= pack("v",strlen($datarec["data"]));
|
||||||
|
$this->size++;
|
||||||
|
$this->size++;
|
||||||
|
$this->size+=strlen($datarec["data"]);
|
||||||
|
//$output .= pack("C",$datarec["data"]);
|
||||||
|
$output .= $datarec["data"];
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return pack("vv",$this->bof,$this->size).$output;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save($afilehd) {
|
||||||
|
$this->bof = $this->type;
|
||||||
|
$this->size = 0;
|
||||||
|
$tmp = $this->fetch();
|
||||||
|
if ($this->size<2080) {
|
||||||
|
fwrite($afilehd,$tmp);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (defined("BIFFDEBUG")) {
|
||||||
|
echo "long record - size : ".$this->size."<br>";
|
||||||
|
}
|
||||||
|
$wcount = $this->size;
|
||||||
|
$tmptype = $this->type;
|
||||||
|
$tmp = substr($tmp,4);
|
||||||
|
$tmparr = str_split($tmp,2076);
|
||||||
|
if (defined("BIFFDEBUG")) {
|
||||||
|
echo "create parts : ".count($tmparr)."<br>";
|
||||||
|
}
|
||||||
|
$tmpout = "";
|
||||||
|
foreach ($tmparr as $key => $datapart) {
|
||||||
|
if (defined("BIFFDEBUG")) {
|
||||||
|
echo "part ($key) size : ".strlen($datapart)."<br>";
|
||||||
|
}
|
||||||
|
$tmpout = pack("vv",$tmptype,strlen($datapart)).$datapart;
|
||||||
|
fwrite($afilehd,$tmpout);
|
||||||
|
$tmptype = BIFF_CONTINUE;
|
||||||
|
}
|
||||||
|
unset($tmparr);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function workbookxfrecords($afilehd) {
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0x00,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0001,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0001,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0002,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0002,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0xfff5,0xf4,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0x0001,0x00,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0001,0x002b,0xfff5,0xf8,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0001,0x0029,0xfff5,0xf8,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0001,0x002c,0xfff5,0xf8,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0001,0x002a,0xfff5,0xf8,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0001,0x0009,0xfff5,0xf8,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0x0001,0x10,0x000020c0);
|
||||||
|
$this->workbookonexfdata($afilehd,0x0000,0x0000,0x0001,0x50,0x00000488);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function workbookonexfdata($afilehd, $fontindex, $formatindex, $xftype, $textorientation, $colorindexs) {
|
||||||
|
$this->clear(BIFF_XFRECORD);
|
||||||
|
$this->append(XLSDATA_SHORT,$fontindex);
|
||||||
|
$this->append(XLSDATA_SHORT,$formatindex);
|
||||||
|
$this->append(XLSDATA_SHORT,$xftype);
|
||||||
|
$this->append(XLSDATA_BYTE,0x20); /* alignment
|
||||||
|
bits mask
|
||||||
|
2-0 07H XF_HOR_ALIGN ? Horizontal alignment
|
||||||
|
0 General
|
||||||
|
1 Left
|
||||||
|
2 Centred
|
||||||
|
3 Right
|
||||||
|
4 Filled
|
||||||
|
5 Justified (BIFF4-BIFF8)
|
||||||
|
6 Centred across selection (BIFF4-BIFF8)
|
||||||
|
7 Distributed (BIFF8, available in Excel 10.0 (Excel XP) and later only)
|
||||||
|
3 08H 1 = Text is wrapped at right border
|
||||||
|
6-4 70H XF_VERT_ALIGN ? Vertical alignment
|
||||||
|
0 Top
|
||||||
|
1 Centred
|
||||||
|
2 Bottom
|
||||||
|
3 Justified (BIFF5-BIFF8)
|
||||||
|
4 Distributed (BIFF8, available in Excel 10.0 (Excel XP) and later only)
|
||||||
|
*/
|
||||||
|
$this->append(XLSDATA_BYTE,$textorientation); /*
|
||||||
|
bits mask
|
||||||
|
1-0 03H XF_ORIENTATION ? Text orientation
|
||||||
|
0 Not rotated
|
||||||
|
1 Letters are stacked top-to-bottom, but not rotated
|
||||||
|
2 Text is rotated 90 degrees counterclockwise
|
||||||
|
3 Text is rotated 90 degrees clockwise
|
||||||
|
7-2 FCH XF_USED_ATTRIB ? Used attributes
|
||||||
|
0 01H Flag for number format
|
||||||
|
1 02H Flag for font
|
||||||
|
2 04H Flag for horizontal and vertical alignment, text wrap, indentation, orientation, rotation, and text direction
|
||||||
|
3 08H Flag for border lines
|
||||||
|
4 10H Flag for background area style
|
||||||
|
5 20H Flag for cell protection (cell locked and formula hidden)
|
||||||
|
*/
|
||||||
|
$this->append(XLSDATA_LONG,$colorindexs); /* Cell border lines and background area:
|
||||||
|
Bit Mask Contents
|
||||||
|
6-0 0000007FH Colour index for pattern colour
|
||||||
|
13-7 00003F80H Colour index for pattern background
|
||||||
|
21-16 003F0000H Fill pattern
|
||||||
|
24-22 01C00000H Bottom line style
|
||||||
|
31-25 FE000000H Colour index for bottom line colour
|
||||||
|
*/
|
||||||
|
$this->append(XLSDATA_LONG,0); /* Line styles
|
||||||
|
Bit Mask Contents
|
||||||
|
2-0 00000007H Top line style
|
||||||
|
5-3 00000038H Left line style
|
||||||
|
8-6 000001C0H Right line style
|
||||||
|
15-9 0000FE00H Colour index for top line colour
|
||||||
|
22-16 007F0000H Colour index for left line colour
|
||||||
|
29-23 3F800000H Colour index for right line colour
|
||||||
|
*/
|
||||||
|
$this->save($afilehd);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
?>
|
53
vendor/fat.php
vendored
Normal file
53
vendor/fat.php
vendored
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
<?php
|
||||||
|
class fat_class {
|
||||||
|
var $streamsize = null;
|
||||||
|
var $rootstorageoffset = null;
|
||||||
|
var $fatchain = array();
|
||||||
|
var $fatsectorcount = null;
|
||||||
|
|
||||||
|
public function __construct($afilehd, $astreamsize, $arootstorageoffset) {
|
||||||
|
$this->streamsize = $astreamsize;
|
||||||
|
$this->rootstorageoffset = $arootstorageoffset;
|
||||||
|
|
||||||
|
if ($this->streamsize>=0x1000) {
|
||||||
|
$streamsectors = $this->streamsize >> 9;
|
||||||
|
$streamsectors += (($this->streamsize & 0x1ff)>0 ? 1 : 0);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$streamsectors = ($this->rootstorageoffset+0x100) >> 9;
|
||||||
|
$streamsectors += ((($this->rootstorageoffset+0x100) & 0x1ff)>0 ? 1 : 0);
|
||||||
|
$streamsectors--;
|
||||||
|
}
|
||||||
|
while ($streamsectors>1) {
|
||||||
|
$this->fatchain[] = count($this->fatchain)+1; // allocate next sector;
|
||||||
|
$streamsectors--;
|
||||||
|
}
|
||||||
|
$this->fatchain[] = 0xfffffffe; // last sector of stream
|
||||||
|
if ($this->streamsize>=0x1000) {
|
||||||
|
$this->fatchain[] = 0xfffffffe; // rootstorage , used one sector
|
||||||
|
}
|
||||||
|
$this->fatchain[] = 0xfffffffe; // minifat , used one sector
|
||||||
|
$this->fatchain[] = 0xfffffffe; // directory , used one sector
|
||||||
|
|
||||||
|
$fatsize1 = (count($this->fatchain) >> 7) + (((count($this->fatchain) & 0x7f)>0) ? 1 : 0);
|
||||||
|
$fatsize0 = $fatsize1;
|
||||||
|
while ($fatsize1) {
|
||||||
|
$this->fatchain[] = 0xfffffffd; // fat , used nn sector
|
||||||
|
$fatsize1--;
|
||||||
|
}
|
||||||
|
$this->fatsectorcount = (count($this->fatchain) >> 7)+(((count($this->fatchain) & 0x7f)>0) ? 1 : 0);
|
||||||
|
if ($this->fatsectorcount!=$fatsize0) { $this->fatchain[] = 0xfffffffd; }
|
||||||
|
$reqbytes = 128-(count($this->fatchain) & 0x7f);
|
||||||
|
$fatfill = array_fill(count($this->fatchain),$reqbytes,0xffffffff);
|
||||||
|
$this->fatchain = array_merge($this->fatchain,$fatfill);
|
||||||
|
|
||||||
|
$output = "";
|
||||||
|
$count = 0;
|
||||||
|
foreach ($this->fatchain as $key => $sectorid) {
|
||||||
|
$output .= pack("V",$sectorid);
|
||||||
|
$count += 4;
|
||||||
|
}
|
||||||
|
fwrite($afilehd,$output,$count);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
117
vendor/font.php
vendored
Normal file
117
vendor/font.php
vendored
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
<?php
|
||||||
|
define ("XLSFONT_NORMAL",0x0190);
|
||||||
|
define ("XLSFONT_BOLD",0x02bc);
|
||||||
|
|
||||||
|
define ("XLSFONT_ESCAPE_NONE",0x0000);
|
||||||
|
define ("XLSFONT_ESCAPE_SUPERSCRIPT",0x0001);
|
||||||
|
define ("XLSFONT_ESCAPE_SUBSCRIPT",0x0002);
|
||||||
|
|
||||||
|
define ("XLSFONT_UNDERLINE_NONE",0x00);
|
||||||
|
define ("XLSFONT_UNDERLINE_SINGLE",0x01);
|
||||||
|
define ("XLSFONT_UNDERLINE_DOUBLE",0x02);
|
||||||
|
define ("XLSFONT_UNDERLINE_SINGLEACC",0x21);
|
||||||
|
define ("XLSFONT_UNDERLINE_DOUBLEACC",0x22);
|
||||||
|
|
||||||
|
define ("XLSFONT_FAMILY_NORMAL",0x00);
|
||||||
|
define ("XLSFONT_FAMILY_ROMAN",0x01);
|
||||||
|
define ("XLSFONT_FAMILY_SWISS",0x02);
|
||||||
|
define ("XLSFONT_FAMILY_MODERN",0x03);
|
||||||
|
define ("XLSFONT_FAMILY_SCRIPT",0x04);
|
||||||
|
define ("XLSFONT_FAMILY_DECORATIVE",0x05);
|
||||||
|
|
||||||
|
define ("XLSFONT_STYLE_ITALIC",0x0002);
|
||||||
|
define ("XLSFONT_STYLE_STRIKEOUT",0x0008);
|
||||||
|
define ("XLSFONT_STYLE_OUTLINED",0x0010);
|
||||||
|
define ("XLSFONT_STYLE_SHADOWED",0x0020);
|
||||||
|
define ("XLSFONT_STYLE_CONDENSED",0x0040);
|
||||||
|
|
||||||
|
define ("XLSFONT_CHARACTERSET_LATIN",0x00);
|
||||||
|
define ("XLSFONT_CHARACTERSET_SYSTEMDEFAULT",0x01);
|
||||||
|
define ("XLSFONT_CHARACTERSET_SYMBOL",0x02);
|
||||||
|
define ("XLSFONT_CHARACTERSET_ROMAN",0x4d);
|
||||||
|
define ("XLSFONT_CHARACTERSET_JAPANESE",0x80);
|
||||||
|
define ("XLSFONT_CHARACTERSET_KOREAN_HANGUL",0x81);
|
||||||
|
define ("XLSFONT_CHARACTERSET_KOREAN_JOHAB",0x82);
|
||||||
|
define ("XLSFONT_CHARACTERSET_CHINESE_SIMPLIFIED",0x86);
|
||||||
|
define ("XLSFONT_CHARACTERSET_CHINESE_TRADITIONAL",0x88);
|
||||||
|
define ("XLSFONT_CHARACTERSET_GREEK",0xa1);
|
||||||
|
define ("XLSFONT_CHARACTERSET_TURKISH",0xa2);
|
||||||
|
define ("XLSFONT_CHARACTERSET_VIETNAMESE",0xa3);
|
||||||
|
define ("XLSFONT_CHARACTERSET_HEBREW",0xb1);
|
||||||
|
define ("XLSFONT_CHARACTERSET_ARABIC",0xb2);
|
||||||
|
define ("XLSFONT_CHARACTERSET_BALTIC",0xba);
|
||||||
|
define ("XLSFONT_CHARACTERSET_CYRILLIC",0xcc);
|
||||||
|
define ("XLSFONT_CHARACTERSET_THAI",0xde);
|
||||||
|
define ("XLSFONT_CHARACTERSET_LATIN2",0xee); // central european
|
||||||
|
define ("XLSFONT_CHARACTERSET_LATIN1",0xff);
|
||||||
|
|
||||||
|
class xls_font {
|
||||||
|
var $font_array = null;
|
||||||
|
|
||||||
|
public function xls_font() { // constructor
|
||||||
|
$this->font_array = array();
|
||||||
|
$this->append(null);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function append($params) {
|
||||||
|
$font["name"] = (isset($params["name"]) ? $params["name"] : XLSFILE_DEFAULT_FONTNAME);
|
||||||
|
$font["height"] = (isset($params["height"]) ? $params["height"]*20 : XLSFILE_DEFAULT_FONTHEIGHT);
|
||||||
|
$font["weight"] = (isset($params["weight"]) ? $params["weight"] : XLSFONT_NORMAL);
|
||||||
|
$font["color"] = (isset($params["color"]) ? $params["color"] : XLSFILE_DEFAULT_FGCOLOR);
|
||||||
|
$font["underline"] = (isset($params["underline"]) ? $params["underline"] : XLSFONT_UNDERLINE_NONE);
|
||||||
|
$font["escapement"] = (isset($params["escapement"]) ? $params["escapement"] : XLSFONT_ESCAPE_NONE);
|
||||||
|
$font["family"] = (isset($params["family"]) ? $params["family"] : XLSFONT_FAMILY_NORMAL);
|
||||||
|
$font["style"] = (isset($params["style"]) ? $params["style"] : 0x0000);
|
||||||
|
$font["characterset"] = XLSFILE_CHARACTERSET;
|
||||||
|
$s = serialize($font);
|
||||||
|
unset($font);
|
||||||
|
$fontidx = array_search($s,$this->font_array);
|
||||||
|
if ($fontidx===false) {
|
||||||
|
$this->font_array[] = $s;
|
||||||
|
$fontidx = array_search($s,$this->font_array);
|
||||||
|
}
|
||||||
|
if ($fontidx>0) {
|
||||||
|
$fontidx += 5; // first 5 reserved, +5 for user defined font
|
||||||
|
}
|
||||||
|
$fontidx += (($fontidx==4) ? 1 : 0);
|
||||||
|
return $fontidx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save($filehandle,$xls_biffobject) {
|
||||||
|
$font0 = unserialize($this->font_array[0]);
|
||||||
|
$xls_biffobject->clear(BIFF_FONT);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$font0["height"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$font0["style"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$font0["color"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$font0["weight"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$font0["escapement"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$font0["underline"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$font0["family"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$font0["characterset"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,0x0000);
|
||||||
|
$xls_biffobject->append(XLSDATA_STRING,$font0["name"]);
|
||||||
|
$repeatdefault = 4;
|
||||||
|
while ($repeatdefault>0) {
|
||||||
|
$xls_biffobject->save($filehandle);
|
||||||
|
$repeatdefault--;
|
||||||
|
}
|
||||||
|
$i=0;
|
||||||
|
while ($i!=count($this->font_array)) {
|
||||||
|
$font0 = unserialize($this->font_array[$i]);
|
||||||
|
$xls_biffobject->clear(BIFF_FONT);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$font0["height"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$font0["style"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$font0["color"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$font0["weight"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$font0["escapement"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$font0["underline"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$font0["family"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$font0["characterset"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,0x0000);
|
||||||
|
$xls_biffobject->append(XLSDATA_STRING,$font0["name"]);
|
||||||
|
$xls_biffobject->save($filehandle);
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
34
vendor/mergedcells.php
vendored
Normal file
34
vendor/mergedcells.php
vendored
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
<?php
|
||||||
|
class xls_mergedcells {
|
||||||
|
var $merged_array = null;
|
||||||
|
|
||||||
|
public function xls_mergedcells() {
|
||||||
|
$this->merged_array=array();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function merge_cells($arowfirst, $arowlast, $acolfirst, $acollast) {
|
||||||
|
$this->merged_array[]=array("rowfirst" => $arowfirst, "rowlast" => $arowlast, "colfirst" => $acolfirst, "collast" => $acollast);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findpos($arow,$acol) {
|
||||||
|
foreach ($this->merged_array as $key => $data) {
|
||||||
|
if ((($arow>=$data["rowfirst"]) && ($arow<=$data["rowlast"])) && (($acol>=$data["colfirst"]) && ($acol<=$data["collast"]))) {
|
||||||
|
return array("row" => $data["rowfirst"],"col" => $data["colfirst"]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save($filehandle,$xls_biffobject) {
|
||||||
|
$xls_biffobject->clear(BIFF_MERGEDCELLS);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,count($this->merged_array));
|
||||||
|
foreach ($this->merged_array as $key => $data) {
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$data["rowfirst"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$data["rowlast"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$data["colfirst"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$data["collast"]);
|
||||||
|
}
|
||||||
|
$xls_biffobject->save($filehandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
294
vendor/palette.php
vendored
Normal file
294
vendor/palette.php
vendored
Normal file
@ -0,0 +1,294 @@
|
|||||||
|
<?php
|
||||||
|
class xls_palette {
|
||||||
|
var $htmlcolorarray = array("aliceblue" => "#f0f8ff",
|
||||||
|
"antiquewhite" => "#faebd7",
|
||||||
|
"aqua" => "#00ffff",
|
||||||
|
"aquamarine" => "#7fffd4",
|
||||||
|
"azure" => "#f0ffff",
|
||||||
|
"beige" => "#f5f5dc",
|
||||||
|
"bisque" => "#ffe4c4",
|
||||||
|
"black" => "#000000",
|
||||||
|
"blanchedalmond" => "#ffebcd",
|
||||||
|
"blue" => "#0000ff",
|
||||||
|
"blueviolet" => "#8a2be2",
|
||||||
|
"brown" => "#a52a2a",
|
||||||
|
"burlywood" => "#deb887",
|
||||||
|
"cadetblue" => "#5f9ea0",
|
||||||
|
"chartreuse" => "#7fff00",
|
||||||
|
"chocolate" => "#d2691e",
|
||||||
|
"coral" => "#ff7f50",
|
||||||
|
"cornflowerblue" => "#6495ed",
|
||||||
|
"cornsilk" => "#fff8dc",
|
||||||
|
"crimson" => "#dc143c",
|
||||||
|
"cyan" => "#00ffff",
|
||||||
|
"darkblue" => "#00008b",
|
||||||
|
"darkcyan" => "#008b8b",
|
||||||
|
"darkgoldenrod" => "#b8860b",
|
||||||
|
"darkgray" => "#a9a9a9",
|
||||||
|
"darkgrey" => "#a9a9a9",
|
||||||
|
"darkgreen" => "#006400",
|
||||||
|
"darkkhaki" => "#bdb76b",
|
||||||
|
"darkmagenta" => "#8b008b",
|
||||||
|
"darkolivegreen" => "#556b2f",
|
||||||
|
"darkorange" => "#ff8c00",
|
||||||
|
"darkorchid" => "#9932cc",
|
||||||
|
"darkred" => "#8b0000",
|
||||||
|
"darksalmon" => "#e9967a",
|
||||||
|
"darkseagreen" => "#8fbc8f",
|
||||||
|
"darkslateblue" => "#483d8b",
|
||||||
|
"darkslategray" => "#2f4f4f",
|
||||||
|
"darkslategrey" => "#2f4f4f",
|
||||||
|
"darkturquoise" => "#00ced1",
|
||||||
|
"darkviolet" => "#9400d3",
|
||||||
|
"deeppink" => "#ff1493",
|
||||||
|
"deepskyblue" => "#00bfff",
|
||||||
|
"dimgray" => "#696969",
|
||||||
|
"dimgrey" => "#696969",
|
||||||
|
"dodgerblue" => "#1e90ff",
|
||||||
|
"firebrick" => "#b22222",
|
||||||
|
"floralwhite" => "#fffaf0",
|
||||||
|
"forestgreen" => "#228b22",
|
||||||
|
"fuchsia" => "#ff00ff",
|
||||||
|
"gainsboro" => "#dcdcdc",
|
||||||
|
"ghostwhite" => "#f8f8ff",
|
||||||
|
"gold" => "#ffd700",
|
||||||
|
"goldenrod" => "#daa520",
|
||||||
|
"gray" => "#808080",
|
||||||
|
"grey" => "#808080",
|
||||||
|
"green" => "#008000",
|
||||||
|
"greenyellow" => "#adff2f",
|
||||||
|
"honeydew" => "#f0fff0",
|
||||||
|
"hotpink" => "#ff69b4",
|
||||||
|
"indianred" => "#cd5c5c",
|
||||||
|
"indigo" => "#4b0082",
|
||||||
|
"ivory" => "#fffff0",
|
||||||
|
"khaki" => "#f0e68c",
|
||||||
|
"lavender" => "#e6e6fa",
|
||||||
|
"lavenderblush" => "#fff0f5",
|
||||||
|
"lawngreen" => "#7cfc00",
|
||||||
|
"lemonchiffon" => "#fffacd",
|
||||||
|
"lightblue" => "#add8e6",
|
||||||
|
"lightcoral" => "#f08080",
|
||||||
|
"lightcyan" => "#e0ffff",
|
||||||
|
"lightgoldenrodyellow" => "#fafad2",
|
||||||
|
"lightgray" => "#d3d3d3",
|
||||||
|
"lightgrey" => "#d3d3d3",
|
||||||
|
"lightgreen" => "#90ee90",
|
||||||
|
"lightpink" => "#ffb6c1",
|
||||||
|
"lightsalmon" => "#ffa07a",
|
||||||
|
"lightseagreen" => "#20b2aa",
|
||||||
|
"lightskyblue" => "#87cefa",
|
||||||
|
"lightslategray" => "#778899",
|
||||||
|
"lightslategrey" => "#778899",
|
||||||
|
"lightsteelblue" => "#b0c4de",
|
||||||
|
"lightyellow" => "#ffffe0",
|
||||||
|
"lime" => "#00ff00",
|
||||||
|
"limegreen" => "#32cd32",
|
||||||
|
"linen" => "#faf0e6",
|
||||||
|
"magenta" => "#ff00ff",
|
||||||
|
"maroon" => "#800000",
|
||||||
|
"mediumaquamarine" => "#66cdaa",
|
||||||
|
"mediumblue" => "#0000cd",
|
||||||
|
"mediumorchid" => "#ba55d3",
|
||||||
|
"mediumpurple" => "#9370d8",
|
||||||
|
"mediumseagreen" => "#3cb371",
|
||||||
|
"mediumslateblue" => "#7b68ee",
|
||||||
|
"mediumspringgreen" => "#00fa9a",
|
||||||
|
"mediumturquoise" => "#48d1cc",
|
||||||
|
"mediumvioletred" => "#c71585",
|
||||||
|
"midnightblue" => "#191970",
|
||||||
|
"mintcream" => "#f5fffa",
|
||||||
|
"mistyrose" => "#ffe4e1",
|
||||||
|
"moccasin" => "#ffe4b5",
|
||||||
|
"navajowhite" => "#ffdead",
|
||||||
|
"navy" => "#000080",
|
||||||
|
"oldlace" => "#fdf5e6",
|
||||||
|
"olive" => "#808000",
|
||||||
|
"olivedrab" => "#6b8e23",
|
||||||
|
"orange" => "#ffa500",
|
||||||
|
"orangered" => "#ff4500",
|
||||||
|
"orchid" => "#da70d6",
|
||||||
|
"palegoldenrod" => "#eee8aa",
|
||||||
|
"palegreen" => "#98fb98",
|
||||||
|
"paleturquoise" => "#afeeee",
|
||||||
|
"palevioletred" => "#d87093",
|
||||||
|
"papayawhip" => "#ffefd5",
|
||||||
|
"peachpuff" => "#ffdab9",
|
||||||
|
"peru" => "#cd853f",
|
||||||
|
"pink" => "#ffc0cb",
|
||||||
|
"plum" => "#dda0dd",
|
||||||
|
"powderblue" => "#b0e0e6",
|
||||||
|
"purple" => "#800080",
|
||||||
|
"red" => "#ff0000",
|
||||||
|
"rosybrown" => "#bc8f8f",
|
||||||
|
"royalblue" => "#4169e1",
|
||||||
|
"saddlebrown" => "#8b4513",
|
||||||
|
"salmon" => "#fa8072",
|
||||||
|
"sandybrown" => "#f4a460",
|
||||||
|
"seagreen" => "#2e8b57",
|
||||||
|
"seashell" => "#fff5ee",
|
||||||
|
"sienna" => "#a0522d",
|
||||||
|
"silver" => "#c0c0c0",
|
||||||
|
"skyblue" => "#87ceeb",
|
||||||
|
"slateblue" => "#6a5acd",
|
||||||
|
"slategray" => "#708090",
|
||||||
|
"slategrey" => "#708090",
|
||||||
|
"snow" => "#fffafa",
|
||||||
|
"springgreen" => "#00ff7f",
|
||||||
|
"steelblue" => "#4682b4",
|
||||||
|
"tan" => "#d2b48c",
|
||||||
|
"teal" => "#008080",
|
||||||
|
"thistle" => "#d8bfd8",
|
||||||
|
"tomato" => "#ff6347",
|
||||||
|
"turquoise" => "#40e0d0",
|
||||||
|
"violet" => "#ee82ee",
|
||||||
|
"wheat" => "#f5deb3",
|
||||||
|
"white" => "#ffffff",
|
||||||
|
"whitesmoke" => "#f5f5f5",
|
||||||
|
"yellow" => "#ffff00",
|
||||||
|
"yellowgreen" => "#9acd32");
|
||||||
|
|
||||||
|
var $palette_array = array( 0x000000,
|
||||||
|
0xffffff,
|
||||||
|
0xff0000,
|
||||||
|
0x00ff00,
|
||||||
|
0x0000ff,
|
||||||
|
0xffff00,
|
||||||
|
0xff00ff,
|
||||||
|
0x00ffff,
|
||||||
|
0x800000,
|
||||||
|
0x008000,
|
||||||
|
0x000080,
|
||||||
|
0x808000,
|
||||||
|
0x800080,
|
||||||
|
0x008080,
|
||||||
|
0xc0c0c0,
|
||||||
|
0x808080,
|
||||||
|
0x9999ff,
|
||||||
|
0x993366,
|
||||||
|
0xffffcc,
|
||||||
|
0xccffff,
|
||||||
|
0x660066,
|
||||||
|
0xff8080,
|
||||||
|
0x0066cc,
|
||||||
|
0xccccff,
|
||||||
|
0x000080,
|
||||||
|
0xff00ff,
|
||||||
|
0xffff00,
|
||||||
|
0x00ffff,
|
||||||
|
0x800080,
|
||||||
|
0x800000,
|
||||||
|
0x008080,
|
||||||
|
0x0000ff,
|
||||||
|
0x00ccff,
|
||||||
|
0xccffff,
|
||||||
|
0xccffcc,
|
||||||
|
0xffff99,
|
||||||
|
0x99ccff,
|
||||||
|
0xff99cc,
|
||||||
|
0xcc99ff,
|
||||||
|
0xffcc99,
|
||||||
|
0x3366ff,
|
||||||
|
0x33cccc,
|
||||||
|
0x99cc00,
|
||||||
|
0xffcc00,
|
||||||
|
0xff9900,
|
||||||
|
0xff6600,
|
||||||
|
0x666699,
|
||||||
|
0x969696,
|
||||||
|
0x003366,
|
||||||
|
0x339966,
|
||||||
|
0x003300,
|
||||||
|
0x333300,
|
||||||
|
0x993300,
|
||||||
|
0x993366,
|
||||||
|
0x333399,
|
||||||
|
0xc7c7c7
|
||||||
|
);
|
||||||
|
public function getcoloridx($acolor) {
|
||||||
|
if (is_array($acolor)) {
|
||||||
|
$red = $acolor["red"];
|
||||||
|
$green = $acolor["green"];
|
||||||
|
$blue = $acolor["blue"];
|
||||||
|
return $this->findcolor($red,$green,$blue);
|
||||||
|
}
|
||||||
|
else if (!is_numeric($acolor)) {
|
||||||
|
if ($acolor{0}=="#") {
|
||||||
|
return $this->findhtmlcolor($acolor);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return $this->findnamedcolor($acolor);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$red = ($acolor & 0x00ff0000) >> 16;
|
||||||
|
$green = ($acolor & 0x0000ff00) >> 8;
|
||||||
|
$blue = ($acolor & 0x000000ff);
|
||||||
|
return $this->findcolor($red,$green,$blue);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findnamedcolor($colorname) {
|
||||||
|
if (!isset($this->htmlcolorarray[strtolower($colorname)])) { die("unknown color name."); }
|
||||||
|
return $this->findhtmlcolor($this->htmlcolorarray[strtolower($colorname)]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findhtmlcolor($htmlcolor) {
|
||||||
|
$red = hexdec(substr($htmlcolor,1,2));
|
||||||
|
$green = hexdec(substr($htmlcolor,3,2));
|
||||||
|
$blue = hexdec(substr($htmlcolor,5,2));
|
||||||
|
return $this->findcolor($red,$green,$blue);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function findcolor($ared,$agreen,$ablue) {
|
||||||
|
$rgbval = 0;
|
||||||
|
$rgbval = ($ared<<16) | ($agreen << 8) | ($ablue << 0);
|
||||||
|
// before allocate, check the color in the array
|
||||||
|
// if found, return colorindex
|
||||||
|
$colorindex = array_search($rgbval,$this->palette_array);
|
||||||
|
if ($colorindex===false) {
|
||||||
|
return $colorindex;
|
||||||
|
//$colorindex = count($this->palette_array);
|
||||||
|
//$this->palette_array[] = $rgbval;
|
||||||
|
}
|
||||||
|
$colorindex += 8;
|
||||||
|
return $colorindex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function change_color($idx,$color) {
|
||||||
|
$oldidx = $this->getcoloridx($color);
|
||||||
|
if ($oldidx!==false) { return $oldidx; }
|
||||||
|
if (is_array($color)) {
|
||||||
|
$red = $acolor["red"];
|
||||||
|
$green = $acolor["green"];
|
||||||
|
$blue = $acolor["blue"];
|
||||||
|
$rgbval = ($red<<16) | ($green << 8) | ($blue << 0);
|
||||||
|
$this->palette_array[$idx-8] = $rgbval;
|
||||||
|
}
|
||||||
|
else if (!is_numeric($color)) {
|
||||||
|
if ($color{0}=="#") {
|
||||||
|
$rgbval = hexdec(substr($color,1));
|
||||||
|
$this->palette_array[$idx-8] = $rgbval;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
if (!isset($this->htmlcolorarray[strtolower($color)])) { die("unknown color name."); }
|
||||||
|
$this->palette_array[$idx-8] = hexdec(substr($this->htmlcolorarray[strtolower($color)],1));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
$this->palette_array[$idx-8] = $color;
|
||||||
|
}
|
||||||
|
return $idx;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save($filehandle,$xls_biffobject) {
|
||||||
|
$xls_biffobject->clear(BIFF_PALETTE);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,count($this->palette_array));
|
||||||
|
foreach ($this->palette_array as $key => $color_data) {
|
||||||
|
$tmp = $color_data<<8;
|
||||||
|
$xls_biffobject->append(XLSDATA_DATA32BIT,$tmp);
|
||||||
|
}
|
||||||
|
$xls_biffobject->save($filehandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
230
vendor/picture.php
vendored
Normal file
230
vendor/picture.php
vendored
Normal file
@ -0,0 +1,230 @@
|
|||||||
|
<?php
|
||||||
|
/*
|
||||||
|
offs size data content
|
||||||
|
---------------------------------------
|
||||||
|
0000 , 02 : 5d 00 biff type, Object
|
||||||
|
0002 , 02 : 42 00 record length
|
||||||
|
0004 , 04 : 01 00 00 00 count of the objects in the file
|
||||||
|
0008 , 02 : 08 00 object type , 8 = picture
|
||||||
|
000a , 02 : 01 00 object ID
|
||||||
|
000c , 02 : 14 06 grbit
|
||||||
|
bit0 : =1, if the object selected
|
||||||
|
bit1 : =1, if the object moves and sizes with the cells
|
||||||
|
bit2 : =1, if the object moves with the cells
|
||||||
|
bit3 : reserved
|
||||||
|
bit4 : =1, if the object is locked when the sheet is protected
|
||||||
|
bit5..6 : reserved
|
||||||
|
bit7 : =1, if the object is part of a group of objects
|
||||||
|
bit8 : =1, if the object is hidden
|
||||||
|
bit9 : =1, if the object is visible
|
||||||
|
bit10 : =1, if the object is printable
|
||||||
|
bit11..15 : reserved
|
||||||
|
000e , 02 : 01 00 col-left
|
||||||
|
0010 , 02 : 00 00 x position in left column
|
||||||
|
0012 , 02 : 01 00 row-top
|
||||||
|
0014 , 02 : 00 00 y position in top row
|
||||||
|
0016 , 02 : 01 00 col-right
|
||||||
|
0018 , 02 : 30 00 x position in right column
|
||||||
|
001a , 02 : 01 00 row-bottom
|
||||||
|
001c , 02 : 26 00 y position in bottom row
|
||||||
|
001e , 02 : 00 00 fmla structure length
|
||||||
|
0020 , 04 : 00 00 05 00 00 00 reserved , must be zero ?
|
||||||
|
word-offset 0 : = 0
|
||||||
|
word offset 1 : = 0x0005
|
||||||
|
word-offset 2 : = 0
|
||||||
|
0026 , 01 : 09 background color index
|
||||||
|
0027 , 01 : 09 foreground color index
|
||||||
|
0028 , 01 : 00 fill pattern
|
||||||
|
0029 , 01 : 00 auto fill, bit0 = 1 if the automatic fill is turned on
|
||||||
|
002a , 01 : 08 line color index
|
||||||
|
002b , 01 : ff line style index
|
||||||
|
002c , 01 : 01 line weight
|
||||||
|
002d , 01 : 00 auto border, bit0 = 1 if the automatic borderis turned on
|
||||||
|
002e , 02 : 00 00 frame style
|
||||||
|
bit0 : =1 , if the rectangle has rounded corners
|
||||||
|
bit1 : =1 , if the rectangle has a shadow border
|
||||||
|
bit2..9 : diameter of the oval (actualy a circle) that defines the rounded corners (if bit1 set)
|
||||||
|
bit10..15 : unused
|
||||||
|
0030 , 02 : 09 00 image format
|
||||||
|
0032 , 04 : b9 10 05 37 reserved, must be zero ? wtf ???
|
||||||
|
0036 , 02 : 00 00 length of the picture FMLA structure
|
||||||
|
0038 , 02 : 00 00 reserved
|
||||||
|
003a , 02 : 01 00 grbit
|
||||||
|
bit0 : =0 if user manualy sizes picture by dragging a handle
|
||||||
|
bit1 : =1 if FMLA structure is a DDE reference
|
||||||
|
bit2 : =1 if the picture is from a DDE link, and the only available representation of the picture is an icon
|
||||||
|
bit3..15 : unused, must be zero ...
|
||||||
|
003c , 04 : 00 00 00 00 reserved
|
||||||
|
0040 , 01 : 05 length of the name
|
||||||
|
0041 , nn : 4b e9 70 20 31 name ,maybe contain a padding byte to force word boundary allignment (=Kép 1)
|
||||||
|
|
||||||
|
0000 , 02 : 7f 00 biff type, ImageData
|
||||||
|
0002 , 02 : 44 00 record length
|
||||||
|
0004 , 02 : 09 00 image format, 9 = windows bitmap format , 24bit truecolor
|
||||||
|
0006 , 02 : 01 00 enviroment from which file was written, 1= windows
|
||||||
|
0008 , 04 : 3c 00 00 00 image data length
|
||||||
|
000a .... image data
|
||||||
|
|
||||||
|
0c 00 00 00 04 00 04 00 01 00 18 00
|
||||||
|
ff 00 00 ff ff ff ff ff ff 00 00 00
|
||||||
|
ff ff ff ff 00 00 00 00 00 ff ff ff
|
||||||
|
ff ff ff 00 00 ff 00 ff 00 ff ff ff
|
||||||
|
00 00 ff ff ff ff ff ff ff 00 ff 00
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
class xls_picture {
|
||||||
|
var $picture_array = null;
|
||||||
|
var $filename = null;
|
||||||
|
var $bgcolor = null;
|
||||||
|
var $bgcolorrgb = null;
|
||||||
|
var $fgcolor = null;
|
||||||
|
var $objectid = null;
|
||||||
|
var $firstrow = null;
|
||||||
|
var $firstcol = null;
|
||||||
|
var $lastrow = null;
|
||||||
|
var $lastcol = null;
|
||||||
|
var $imageright = null;
|
||||||
|
var $imagebottom = null;
|
||||||
|
var $imagewidth = null;
|
||||||
|
var $imageheight = null;
|
||||||
|
|
||||||
|
function xls_picture($afilename, $abgcolor, $afgcolor, $abgcolorrgb, $aobjectid, $arow, $acol) {
|
||||||
|
$this->picture_array = array();
|
||||||
|
$this->filename = $afilename;
|
||||||
|
|
||||||
|
$tmp = explode(".",$afilename);
|
||||||
|
if (count($tmp)<2) { die("missing filename extension."); }
|
||||||
|
if (!file_exists($afilename)) { die("file does not exist."); }
|
||||||
|
|
||||||
|
$this->bgcolor = $abgcolor;
|
||||||
|
$this->bgcolorrgb = $abgcolorrgb;
|
||||||
|
$this->fgcolor = $afgcolor;
|
||||||
|
$this->objectid = $aobjectid;
|
||||||
|
$this->firstrow = $arow;
|
||||||
|
$this->firstcol = $acol;
|
||||||
|
}
|
||||||
|
|
||||||
|
function scanimgline($imagehd, $line, $width, $bgcolor) {
|
||||||
|
for ($x=0; $x!=$width; $x++) {
|
||||||
|
$colorindex = imagecolorat($imagehd, $x, $line);
|
||||||
|
$rgb = imagecolorsforindex($imagehd, $colorindex);
|
||||||
|
if ($rgb["alpha"]!=0) {
|
||||||
|
$dstR = $bgcolor >> 16 & 0xFF;
|
||||||
|
$dstG = $bgcolor >> 8 & 0xFF;
|
||||||
|
$dstB = $bgcolor & 0xFF;
|
||||||
|
|
||||||
|
$rgb["red"] = (($rgb["red"] * (0xFF-$rgb["alpha"])) >> 8) + (($dstR * $rgb["alpha"]) >> 8);
|
||||||
|
$rgb["green"] = (($rgb["green"] * (0xFF-$rgb["alpha"])) >> 8) + (($dstG * $rgb["alpha"]) >> 8);
|
||||||
|
$rgb["blue"] = (($rgb["blue"] * (0xFF-$rgb["alpha"])) >> 8) + (($dstB * $rgb["alpha"]) >> 8);
|
||||||
|
}
|
||||||
|
$this->picture_array[] = $rgb["blue"];
|
||||||
|
$this->picture_array[] = $rgb["green"];
|
||||||
|
$this->picture_array[] = $rgb["red"];
|
||||||
|
/*
|
||||||
|
$this->picture_array[] = ($colorindex >> 16) & 0x0ff;
|
||||||
|
$this->picture_array[] = ($colorindex >> 8) & 0x0ff;
|
||||||
|
$this->picture_array[] = $colorindex & 0x0ff;
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
if ((count($this->picture_array) & 0x3)!=0) {
|
||||||
|
$fsize = count($this->picture_array) & 0x3;
|
||||||
|
$reqbytes = 0x4 - $fsize;
|
||||||
|
while ($reqbytes>0) {
|
||||||
|
$this->picture_array[] = 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
function loaddata() {
|
||||||
|
$tmp = explode(".",$this->filename);
|
||||||
|
$ext = strtolower($tmp[count($tmp)-1]);
|
||||||
|
switch ($ext) {
|
||||||
|
case "bmp" : die("Windows BitMaP file not supported.");
|
||||||
|
break;
|
||||||
|
case "gif" : $img=imagecreatefromgif($this->filename);
|
||||||
|
break;
|
||||||
|
case "jpg" :
|
||||||
|
case "jpeg" : $img=imagecreatefromjpeg($this->filename);
|
||||||
|
break;
|
||||||
|
case "png" : $img=imagecreatefrompng($this->filename);
|
||||||
|
break;
|
||||||
|
case "xbm" : $img=imagecreatefromxbm($this->filename);
|
||||||
|
break;
|
||||||
|
case "xpm" : $img=imagecreatefromxpm($this->filename);
|
||||||
|
break;
|
||||||
|
default : die("Invalid / unknown filetype (extension).");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$this->imagewidth = imagesx($img);
|
||||||
|
$this->imageheight = imagesy($img);
|
||||||
|
$y=$this->imageheight;
|
||||||
|
while ($y>0) {
|
||||||
|
$y--;
|
||||||
|
$this->scanimgline($img, $y, $this->imagewidth, $this->bgcolorrgb);
|
||||||
|
}
|
||||||
|
imagedestroy($img);
|
||||||
|
}
|
||||||
|
|
||||||
|
function save($filehandle,$xls_biffobject) {
|
||||||
|
$xls_biffobject->clear(BIFF_OBJECT);
|
||||||
|
$xls_biffobject->append(XLSDATA_LONG,1); // one object
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,8); // obj,type = picture
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$this->objectid);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0x0614);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$this->firstcol);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$this->firstrow);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$this->lastcol);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$this->imageright);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$this->lastrow);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$this->imagebottom);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0);
|
||||||
|
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0x0005);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0);
|
||||||
|
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$this->bgcolor);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$this->fgcolor);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,0);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,0);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,8);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,0xff);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,1);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,0);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0x0009);
|
||||||
|
//$xls_biffobject->append(XLSDATA_LONG,0x370510b9);
|
||||||
|
$xls_biffobject->append(XLSDATA_LONG,0x00000000);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0x0001);
|
||||||
|
$xls_biffobject->append(XLSDATA_LONG,0x0000);
|
||||||
|
|
||||||
|
$s = "Picture".$this->objectid;
|
||||||
|
$xls_biffobject->append(XLSDATA_STRING,$s);
|
||||||
|
$xls_biffobject->save($filehandle);
|
||||||
|
|
||||||
|
$xls_biffobject->clear(BIFF_IMAGEDATA);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0x0009);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,0x0001);
|
||||||
|
$xls_biffobject->append(XLSDATA_LONG,count($this->picture_array)+12);
|
||||||
|
|
||||||
|
if (defined("PICTUREDEBUG")) {
|
||||||
|
echo "picture size : ".count($this->picture_array)." (".dechex(count($this->picture_array)).")<br>\n";
|
||||||
|
}
|
||||||
|
$xls_biffobject->append(XLSDATA_LONG,0x0000000c);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$this->imagewidth);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$this->imageheight);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,1);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,24);
|
||||||
|
|
||||||
|
foreach ($this->picture_array as $data) {
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$data);
|
||||||
|
}
|
||||||
|
$xls_biffobject->save($filehandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
238
vendor/xf.php
vendored
Normal file
238
vendor/xf.php
vendored
Normal file
@ -0,0 +1,238 @@
|
|||||||
|
<?php
|
||||||
|
define ("XLSXF_TYPE_PROT_CELLLOCKED", 0x01);
|
||||||
|
define ("XLSXF_TYPE_PROT_FORMULAHIDDEN", 0x02);
|
||||||
|
define ("XLSXF_TYPE_PROT_STYLEXF", 0x04);
|
||||||
|
define ("XLSXF_TYPE_PROT_F123PREFIX", 0x08);
|
||||||
|
|
||||||
|
define ("XLSXF_USEDATTRIB_ATRNUM" ,0x04);
|
||||||
|
define ("XLSXF_USEDATTRIB_ATRFONT" ,0x08);
|
||||||
|
define ("XLSXF_USEDATTRIB_ATRALC" ,0x10);
|
||||||
|
define ("XLSXF_USEDATTRIB_ATRBDR" ,0x20);
|
||||||
|
define ("XLSXF_USEDATTRIB_ATRPAT" ,0x40);
|
||||||
|
define ("XLSXF_USEDATTRIB_ATRPROT" ,0x80);
|
||||||
|
|
||||||
|
// horizontal allignment
|
||||||
|
define ("XLSXF_HALLIGN_GENERAL", 0x00);
|
||||||
|
define ("XLSXF_HALLIGN_LEFT" , 0x01);
|
||||||
|
define ("XLSXF_HALLIGN_CENTER" , 0x02);
|
||||||
|
define ("XLSXF_HALLIGN_RIGHT" , 0x03);
|
||||||
|
define ("XLSXF_HALLIGN_FILL" , 0x04);
|
||||||
|
define ("XLSXF_HALLIGN_JUSTIFY", 0x05);
|
||||||
|
define ("XLSXF_HALLIGN_CACROSS", 0x06); // center across selection
|
||||||
|
//define ("XLSXF_HALLIGN_DISTRIBUTED", 0x07); not used in BIFF5 , available in Excel 10.0 (Excel XP) and later
|
||||||
|
|
||||||
|
// vertical allignment
|
||||||
|
define ("XLSXF_VALLIGN_TOP" , 0x00);
|
||||||
|
define ("XLSXF_VALLIGN_CENTER" , 0x10);
|
||||||
|
define ("XLSXF_VALLIGN_BOTTOM" , 0x20);
|
||||||
|
define ("XLSXF_VALLIGN_JUSTIFY", 0x30);
|
||||||
|
//define ("XLSXF_VALLIGN_DISTRIBUTED", 0x40); not used in BIFF5 , available in Excel 10.0 (Excel XP) and later
|
||||||
|
|
||||||
|
define ("XLSXF_WRAPTEXT", 0x08); // wrap text at right border
|
||||||
|
|
||||||
|
define ("XLSXF_TEXTROTATION_NOROTATION", 0x00);
|
||||||
|
define ("XLSXF_TEXTROTATION_UPRIGHT", 0x01); // text appears top-to-bottom; letters are upright.
|
||||||
|
define ("XLSXF_TEXTROTATION_COUNTERCLOCKWISE", 0x02); // text is rotated 90 degrees counterclockwise
|
||||||
|
define ("XLSXF_TEXTROTATION_CLOCKWISE", 0x03); // text is rotated 90 degrees clockwise
|
||||||
|
|
||||||
|
define ("XLSXF_BORDER_NOBORDER", 0x00);
|
||||||
|
define ("XLSXF_BORDER_THIN", 0x01);
|
||||||
|
define ("XLSXF_BORDER_MEDIUM", 0x02);
|
||||||
|
define ("XLSXF_BORDER_DASHED", 0x03);
|
||||||
|
define ("XLSXF_BORDER_DOTTED", 0x04);
|
||||||
|
define ("XLSXF_BORDER_THICK", 0x05);
|
||||||
|
define ("XLSXF_BORDER_DOUBLE", 0x06);
|
||||||
|
define ("XLSXF_BORDER_HAIR", 0x07);
|
||||||
|
|
||||||
|
/*
|
||||||
|
not used in BIFF5 , available in BIFF8 (Excel 10.0 / Excel XP) and later
|
||||||
|
define ("XLSXF_BORDER_MEDIUMDASHED", 0x08);
|
||||||
|
define ("XLSXF_BORDER_THINDASHDOT", 0x09);
|
||||||
|
define ("XLSXF_BORDER_MEDIUMDASHDOT", 0x0a);
|
||||||
|
define ("XLSXF_BORDER_THINDASHDOTDOT", 0x0b);
|
||||||
|
define ("XLSXF_BORDER_MEDIUMDASHDOTDOT", 0x0c);
|
||||||
|
define ("XLSXF_BORDER_SLANTEDDASHDOT", 0x0d);
|
||||||
|
*/
|
||||||
|
|
||||||
|
class xls_xf {
|
||||||
|
var $xf_array = null;
|
||||||
|
var $defaultxf = null;
|
||||||
|
|
||||||
|
public function xls_xf() {
|
||||||
|
$this->xf_array = array();
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4, "fontindex" => 1));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4, "fontindex" => 1));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4, "fontindex" => 2));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4, "fontindex" => 2));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf4));
|
||||||
|
$this->append(array("forced"=>1));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf8, "fontindex" => 1, "formatindex" => 0x2b));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf8, "fontindex" => 1, "formatindex" => 0x29));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf8, "fontindex" => 1, "formatindex" => 0x2c));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf8, "fontindex" => 1, "formatindex" => 0x2a));
|
||||||
|
$this->append(array("forced"=>1, "parentxfindex" => 0xffffff, "xftype" => XLSXF_TYPE_PROT_STYLEXF, "flagsforce" => 0xf8, "fontindex" => 1, "formatindex" => 0x09));
|
||||||
|
$this->defaultxf = $this->append(array("forced"=>1, "flagsforce" => 0x50, "patternbgcolor" => 0x88, "patterncolor" => 0x08, "fillpattern" => 0));
|
||||||
|
}
|
||||||
|
|
||||||
|
public function append($params) {
|
||||||
|
$xf = array("fontindex" => 0x00,
|
||||||
|
"formatindex" => 0x00,
|
||||||
|
"parentxfindex" => 0x0,
|
||||||
|
"xftype" => XLSXF_TYPE_PROT_CELLLOCKED,
|
||||||
|
"allign" => XLSXF_VALLIGN_BOTTOM | XLSXF_HALLIGN_GENERAL,
|
||||||
|
"flags" => 0x00,
|
||||||
|
"rotate" => XLSXF_TEXTROTATION_NOROTATION,
|
||||||
|
"patterncolor" => 0x40,
|
||||||
|
"patternbgcolor" => 0xc0,
|
||||||
|
"fillpattern" => 0x00,
|
||||||
|
"bordertop" => XLSXF_BORDER_NOBORDER,
|
||||||
|
"bordertopcolor" => 0x0000,
|
||||||
|
"borderbottom" => XLSXF_BORDER_NOBORDER,
|
||||||
|
"borderbottomcolor" => 0x0000,
|
||||||
|
"borderleft" => XLSXF_BORDER_NOBORDER,
|
||||||
|
"borderleftcolor" => 0x0000,
|
||||||
|
"borderright" => XLSXF_BORDER_NOBORDER,
|
||||||
|
"borderrightcolor" => 0x0000
|
||||||
|
);
|
||||||
|
if (is_array($params)) {
|
||||||
|
foreach ($params as $key => $param) {
|
||||||
|
switch ($key) {
|
||||||
|
case "formatindex" : $xf[$key]=$param;
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRNUM;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "fontindex" : $xf[$key]=$param;
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRFONT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "rotate" : $xf[$key]=$param;
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRALC;
|
||||||
|
break;
|
||||||
|
case "xftype" :
|
||||||
|
$xf[$key]=$xf[$key] | $param;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "parentxfindex" : $xf[$key]=$param;
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRNUM;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "patterncolor" : $xf[$key] = $param; // foreground color definied with font
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "patternbgcolor" : $xf[$key]=$param;
|
||||||
|
$xf["patterncolor"]=0x08;
|
||||||
|
if ($xf["fillpattern"]==0x00) { $xf["fillpattern"]=0x01; }
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRPAT | XLSXF_USEDATTRIB_ATRALC;
|
||||||
|
break;
|
||||||
|
case "fillpattern" : $xf[$key]=$param;
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRPAT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "hallign" :
|
||||||
|
$i = $xf["allign"]&0xf8;
|
||||||
|
$i = $i | $param;
|
||||||
|
$xf["allign"] = $i;
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRFONT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "vallign" : $i = $xf["allign"]&0x1f;
|
||||||
|
$i = $i | $param;
|
||||||
|
$xf["allign"] = $i;
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRFONT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "textwrap" : $xf["allign"]=$xf["allign"] | XLSXF_WRAPTEXT;
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRFONT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "border" : $xf["bordertop"]=$param;
|
||||||
|
$xf["borderbottom"]=$param;
|
||||||
|
$xf["borderleft"]=$param;
|
||||||
|
$xf["borderright"]=$param;
|
||||||
|
$param=0x0008; // default border color = black
|
||||||
|
case "bordercolor" : $xf["bordertopcolor"]=$param;
|
||||||
|
$xf["borderbottomcolor"]=$param;
|
||||||
|
$xf["borderleftcolor"]=$param;
|
||||||
|
$xf["borderrightcolor"]=$param;
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRBDR;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "bordertop" :
|
||||||
|
case "borderbottom" :
|
||||||
|
case "borderleft" :
|
||||||
|
case "borderright" :
|
||||||
|
$xf[$key]=$param;
|
||||||
|
$colorkey = $key."color";
|
||||||
|
if ($xf[$colorkey]==0x0000) { $xf[$colorkey]=0x0009; }
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRBDR;
|
||||||
|
break;
|
||||||
|
case "bordertopcolor" :
|
||||||
|
case "borderbottomcolor":
|
||||||
|
case "borderleftcolor":
|
||||||
|
case "borderrightcolor":
|
||||||
|
$xf[$key]=$param;
|
||||||
|
$xf["flags"]=$xf["flags"] | XLSXF_USEDATTRIB_ATRBDR;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (count($this->xf_array)==0) {
|
||||||
|
$xf["flags"] = 0;
|
||||||
|
}
|
||||||
|
if ($xf["parentxfindex"]==0xffffff) {
|
||||||
|
$xf["flags"] = $xf["flags"] & 0xf7;
|
||||||
|
}
|
||||||
|
if (isset($params["flagsforce"])) {
|
||||||
|
$xf["flags"] = $params["flagsforce"];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
$s = serialize($xf);
|
||||||
|
$xfindex = array_search($s,$this->xf_array);
|
||||||
|
if (($xfindex===false) || (isset($params["forced"]))) {
|
||||||
|
$xfindex = count($this->xf_array);
|
||||||
|
$this->xf_array[] = $s;
|
||||||
|
if (defined("XFDEBUG")) {
|
||||||
|
$xfindex = array_search($s,$this->xf_array);
|
||||||
|
echo "new XF record , index : $xfindex\n";
|
||||||
|
echo "new XF record : $s \n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $xfindex;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function save($filehandle,$xls_biffobject) {
|
||||||
|
foreach ($this->xf_array as $xfindex => $tmp) {
|
||||||
|
$xfrec = unserialize($tmp);
|
||||||
|
$xls_biffobject->clear(BIFF_XFRECORD);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$xfrec["fontindex"]);
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$xfrec["formatindex"]);
|
||||||
|
$i = ($xfrec["parentxfindex"]<<4) | $xfrec["xftype"];
|
||||||
|
$xls_biffobject->append(XLSDATA_SHORT,$i);
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$xfrec["allign"]);
|
||||||
|
$i = $xfrec["rotate"] | $xfrec["flags"];
|
||||||
|
$xls_biffobject->append(XLSDATA_BYTE,$i);
|
||||||
|
|
||||||
|
$i = $xfrec["patternbgcolor"] | ($xfrec["patterncolor"] << 7);
|
||||||
|
$i = (($i == 0) ? 0x20c0 : $i); // magic number if no colors defined
|
||||||
|
$i = $i | ($xfrec["fillpattern"] << 16);
|
||||||
|
$i = $i | ($xfrec["borderbottom"] << 22);
|
||||||
|
$i = $i | ($xfrec["borderbottomcolor"] << 25);
|
||||||
|
$xls_biffobject->append(XLSDATA_LONG,$i);
|
||||||
|
|
||||||
|
$i = $xfrec["bordertop"] | ($xfrec["borderleft"] << 3) | ($xfrec["borderright"] << 6);
|
||||||
|
$i = $i | ($xfrec["bordertopcolor"] << 9) | ($xfrec["borderleftcolor"] << 16) | ($xfrec["borderrightcolor"] << 23);
|
||||||
|
$xls_biffobject->append(XLSDATA_LONG,$i);
|
||||||
|
$xls_biffobject->save($filehandle);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
?>
|
1414
vendor/xls_export.php
vendored
Normal file
1414
vendor/xls_export.php
vendored
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user