ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
Spreadsheet_Excel_Reader Class Reference
+ Collaboration diagram for Spreadsheet_Excel_Reader:

Public Member Functions

 myHex ($d)
 
 dumpHexData ($data, $pos, $length)
 
 getCol ($col)
 
 val ($row, $col, $sheet=0)
 
 value ($row, $col, $sheet=0)
 
 info ($row, $col, $type='', $sheet=0)
 
 type ($row, $col, $sheet=0)
 
 raw ($row, $col, $sheet=0)
 
 rowspan ($row, $col, $sheet=0)
 
 colspan ($row, $col, $sheet=0)
 
 hyperlink ($row, $col, $sheet=0)
 
 rowcount ($sheet=0)
 
 colcount ($sheet=0)
 
 colwidth ($col, $sheet=0)
 
 colhidden ($col, $sheet=0)
 
 rowheight ($row, $sheet=0)
 
 rowhidden ($row, $sheet=0)
 
 style ($row, $col, $sheet=0, $properties='')
 
 format ($row, $col, $sheet=0)
 
 formatIndex ($row, $col, $sheet=0)
 
 formatColor ($row, $col, $sheet=0)
 
 xfRecord ($row, $col, $sheet=0)
 
 xfProperty ($row, $col, $sheet, $prop)
 
 align ($row, $col, $sheet=0)
 
 bgColor ($row, $col, $sheet=0)
 
 borderLeft ($row, $col, $sheet=0)
 
 borderRight ($row, $col, $sheet=0)
 
 borderTop ($row, $col, $sheet=0)
 
 borderBottom ($row, $col, $sheet=0)
 
 borderLeftColor ($row, $col, $sheet=0)
 
 borderRightColor ($row, $col, $sheet=0)
 
 borderTopColor ($row, $col, $sheet=0)
 
 borderBottomColor ($row, $col, $sheet=0)
 
 fontRecord ($row, $col, $sheet=0)
 
 fontProperty ($row, $col, $sheet=0, $prop)
 
 fontIndex ($row, $col, $sheet=0)
 
 color ($row, $col, $sheet=0)
 
 rawColor ($ci)
 
 bold ($row, $col, $sheet=0)
 
 italic ($row, $col, $sheet=0)
 
 underline ($row, $col, $sheet=0)
 
 height ($row, $col, $sheet=0)
 
 font ($row, $col, $sheet=0)
 
 dump ($row_numbers=false, $col_letters=false, $sheet=0, $table_class='excel')
 
 read16bitstring ($data, $start)
 
 _format_value ($format, $num, $f)
 
 Spreadsheet_Excel_Reader ($file='', $store_extended_info=true, $outputEncoding='')
 Constructor. More...
 
 setOutputEncoding ($encoding)
 Set the encoding method. More...
 
 setUTFEncoder ($encoder='iconv')
 $encoder = 'iconv' or 'mb' set iconv if you would like use 'iconv' for encode UTF-16LE to your encoding set mb if you would like use 'mb_convert_encoding' for encode UTF-16LE to your encoding More...
 
 setRowColOffset ($iOffset)
 
 setDefaultFormat ($sFormat)
 Set the default number format. More...
 
 setColumnFormat ($column, $sFormat)
 Force a column to use a certain format. More...
 
 read ($sFileName)
 Read the spreadsheet file using OLE, then parse. More...
 
 _parse ()
 Parse a workbook. More...
 
 _parsesheet ($spos)
 Parse a worksheet. More...
 
 isDate ($spos)
 
 _getCellDetails ($spos, $numValue, $column)
 
 createNumber ($spos)
 
 addcell ($row, $col, $string, $info=null)
 
 _GetIEEE754 ($rknum)
 
 _encodeUTF16 ($string)
 
 _GetInt4d ($data, $pos)
 

Data Fields

 $colnames = array()
 
 $colindexes = array()
 
 $standardColWidth = 0
 
 $defaultColWidth = 0
 
 $boundsheets = array()
 
 $formatRecords = array()
 
 $fontRecords = array()
 
 $xfRecords = array()
 
 $colInfo = array()
 
 $rowInfo = array()
 
 $sst = array()
 
 $sheets = array()
 
 $data
 
 $_ole
 
 $_defaultEncoding = "UTF-8"
 
 $_defaultFormat = SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT
 
 $_columnsFormat = array()
 
 $_rowoffset = 1
 
 $_coloffset = 1
 
 $dateFormats
 List of default date formats used by Excel. More...
 
 $numberFormats
 Default number formats used by Excel. More...
 
 $colors
 
 $lineStyles
 
 $lineStylesCss
 

Detailed Description

Definition at line 312 of file excel_reader2.php.

Member Function Documentation

◆ _encodeUTF16()

Spreadsheet_Excel_Reader::_encodeUTF16 (   $string)

Definition at line 1714 of file excel_reader2.php.

1714 {
1715 $result = $string;
1716 if ($this->_defaultEncoding){
1717 switch ($this->_encoderFunction){
1718 case 'iconv' : $result = iconv('UTF-16LE', $this->_defaultEncoding, $string);
1719 break;
1720 case 'mb_convert_encoding' : $result = mb_convert_encoding($string, $this->_defaultEncoding, 'UTF-16LE' );
1721 break;
1722 }
1723 }
1724 return $result;
1725 }
$result

References $result.

Referenced by _parse(), and _parsesheet().

+ Here is the caller graph for this function:

◆ _format_value()

Spreadsheet_Excel_Reader::_format_value (   $format,
  $num,
  $f 
)

Definition at line 835 of file excel_reader2.php.

835 {
836 // 49==TEXT format
837 // http://code.google.com/p/php-excel-reader/issues/detail?id=7
838 if ( (!$f && $format=="%s") || ($f==49) || ($format=="GENERAL") ) {
839 return array('string'=>$num, 'formatColor'=>null);
840 }
841
842 // Custom pattern can be POSITIVE;NEGATIVE;ZERO
843 // The "text" option as 4th parameter is not handled
844 $parts = split(";",$format);
845 $pattern = $parts[0];
846 // Negative pattern
847 if (count($parts)>2 && $num==0) {
848 $pattern = $parts[2];
849 }
850 // Zero pattern
851 if (count($parts)>1 && $num<0) {
852 $pattern = $parts[1];
853 $num = abs($num);
854 }
855
856 $color = "";
857 $matches = array();
858 $color_regex = "/^\[(BLACK|BLUE|CYAN|GREEN|MAGENTA|RED|WHITE|YELLOW)\]/i";
859 if (preg_match($color_regex,$pattern,$matches)) {
860 $color = strtolower($matches[1]);
861 $pattern = preg_replace($color_regex,"",$pattern);
862 }
863
864 // In Excel formats, "_" is used to add spacing, which we can't do in HTML
865 $pattern = preg_replace("/_./","",$pattern);
866
867 // Some non-number characters are escaped with \, which we don't need
868 $pattern = preg_replace("/\\\/","",$pattern);
869
870 // Some non-number strings are quoted, so we'll get rid of the quotes
871 $pattern = preg_replace("/\"/","",$pattern);
872
873 // TEMPORARY - Convert # to 0
874 $pattern = preg_replace("/\#/","0",$pattern);
875
876 // Find out if we need comma formatting
877 $has_commas = preg_match("/,/",$pattern);
878 if ($has_commas) {
879 $pattern = preg_replace("/,/","",$pattern);
880 }
881
882 // Handle Percentages
883 if (preg_match("/\d(\%)([^\%]|$)/",$pattern,$matches)) {
884 $num = $num * 100;
885 $pattern = preg_replace("/(\d)(\%)([^\%]|$)/","$1%$3",$pattern);
886 }
887
888 // Handle the number itself
889 $number_regex = "/(\d+)(\.?)(\d*)/";
890 if (preg_match($number_regex,$pattern,$matches)) {
891 $left = $matches[1];
892 $dec = $matches[2];
893 $right = $matches[3];
894 if ($has_commas) {
895 $formatted = number_format($num,strlen($right));
896 }
897 else {
898 $sprintf_pattern = "%1.".strlen($right)."f";
899 $formatted = sprintf($sprintf_pattern, $num);
900 }
901 $pattern = preg_replace($number_regex, $formatted, $pattern);
902 }
903
904 return array(
905 'string'=>$pattern,
906 'formatColor'=>$color
907 );
908 }

Referenced by _getCellDetails().

+ Here is the caller graph for this function:

◆ _getCellDetails()

Spreadsheet_Excel_Reader::_getCellDetails (   $spos,
  $numValue,
  $column 
)

Definition at line 1597 of file excel_reader2.php.

1597 {
1598 $xfindex = ord($this->data[$spos+4]) | ord($this->data[$spos+5]) << 8;
1599 $xfrecord = $this->xfRecords[$xfindex];
1600 $type = $xfrecord['type'];
1601
1602 $format = $xfrecord['format'];
1603 $formatIndex = $xfrecord['formatIndex'];
1604 $fontIndex = $xfrecord['fontIndex'];
1605 $formatColor = "";
1606 $rectype = '';
1607 $string = '';
1608 $raw = '';
1609
1610 if (isset($this->_columnsFormat[$column + 1])){
1611 $format = $this->_columnsFormat[$column + 1];
1612 }
1613
1614 if ($type == 'date') {
1615 // See http://groups.google.com/group/php-excel-reader-discuss/browse_frm/thread/9c3f9790d12d8e10/f2045c2369ac79de
1616 $rectype = 'date';
1617 // Convert numeric value into a date
1618 $utcDays = floor($numValue - ($this->nineteenFour ? SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904 : SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS));
1619 $utcValue = ($utcDays) * SPREADSHEET_EXCEL_READER_MSINADAY;
1620 $dateinfo = gmgetdate($utcValue);
1621
1622 $raw = $numValue;
1623 $fractionalDay = $numValue - floor($numValue) + .0000001; // The .0000001 is to fix for php/excel fractional diffs
1624
1625 $totalseconds = floor(SPREADSHEET_EXCEL_READER_MSINADAY * $fractionalDay);
1626 $secs = $totalseconds % 60;
1627 $totalseconds -= $secs;
1628 $hours = floor($totalseconds / (60 * 60));
1629 $mins = floor($totalseconds / 60) % 60;
1630 $string = date ($format, mktime($hours, $mins, $secs, $dateinfo["mon"], $dateinfo["mday"], $dateinfo["year"]));
1631 } else if ($type == 'number') {
1632 $rectype = 'number';
1633 $formatted = $this->_format_value($format, $numValue, $formatIndex);
1634 $string = $formatted['string'];
1635 $formatColor = $formatted['formatColor'];
1636 $raw = $numValue;
1637 } else{
1638 if ($format=="") {
1639 $format = $this->_defaultFormat;
1640 }
1641 $rectype = 'unknown';
1642 $formatted = $this->_format_value($format, $numValue, $formatIndex);
1643 $string = $formatted['string'];
1644 $formatColor = $formatted['formatColor'];
1645 $raw = $numValue;
1646 }
1647
1648 return array(
1649 'string'=>$string,
1650 'raw'=>$raw,
1651 'rectype'=>$rectype,
1652 'format'=>$format,
1653 'formatIndex'=>$formatIndex,
1654 'fontIndex'=>$fontIndex,
1655 'formatColor'=>$formatColor,
1656 'xfIndex'=>$xfindex
1657 );
1658
1659 }
_format_value($format, $num, $f)
const SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS
gmgetdate($ts=null)
const SPREADSHEET_EXCEL_READER_MSINADAY
const SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904

References $_defaultFormat, _format_value(), gmgetdate(), SPREADSHEET_EXCEL_READER_MSINADAY, SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS, and SPREADSHEET_EXCEL_READER_UTCOFFSETDAYS1904.

Referenced by _parsesheet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _GetIEEE754()

Spreadsheet_Excel_Reader::_GetIEEE754 (   $rknum)

Definition at line 1689 of file excel_reader2.php.

1689 {
1690 if (($rknum & 0x02) != 0) {
1691 $value = $rknum >> 2;
1692 } else {
1693 //mmp
1694 // I got my info on IEEE754 encoding from
1695 // http://research.microsoft.com/~hollasch/cgindex/coding/ieeefloat.html
1696 // The RK format calls for using only the most significant 30 bits of the
1697 // 64 bit floating point value. The other 34 bits are assumed to be 0
1698 // So, we use the upper 30 bits of $rknum as follows...
1699 $sign = ($rknum & 0x80000000) >> 31;
1700 $exp = ($rknum & 0x7ff00000) >> 20;
1701 $mantissa = (0x100000 | ($rknum & 0x000ffffc));
1702 $value = $mantissa / pow( 2 , (20- ($exp - 1023)));
1703 if ($sign) {
1704 $value = -1 * $value;
1705 }
1706 //end of changes by mmp
1707 }
1708 if (($rknum & 0x01) != 0) {
1709 $value /= 100;
1710 }
1711 return $value;
1712 }

Referenced by _parsesheet().

+ Here is the caller graph for this function:

◆ _GetInt4d()

Spreadsheet_Excel_Reader::_GetInt4d (   $data,
  $pos 
)

Definition at line 1727 of file excel_reader2.php.

1727 {
1728 $value = ord($data[$pos]) | (ord($data[$pos+1]) << 8) | (ord($data[$pos+2]) << 16) | (ord($data[$pos+3]) << 24);
1729 if ($value>=4294967294) {
1730 $value=-2;
1731 }
1732 return $value;
1733 }

References $data.

Referenced by _parse(), _parsesheet(), and createNumber().

+ Here is the caller graph for this function:

◆ _parse()

Spreadsheet_Excel_Reader::_parse ( )

Parse a workbook.

@access private

Returns
bool

Definition at line 997 of file excel_reader2.php.

997 {
998 $pos = 0;
1000
1001 $code = v($data,$pos);
1002 $length = v($data,$pos+2);
1003 $version = v($data,$pos+4);
1004 $substreamType = v($data,$pos+6);
1005
1006 $this->version = $version;
1007
1008 if (($version != SPREADSHEET_EXCEL_READER_BIFF8) &&
1009 ($version != SPREADSHEET_EXCEL_READER_BIFF7)) {
1010 return false;
1011 }
1012
1013 if ($substreamType != SPREADSHEET_EXCEL_READER_WORKBOOKGLOBALS){
1014 return false;
1015 }
1016
1017 $pos += $length + 4;
1018
1019 $code = v($data,$pos);
1020 $length = v($data,$pos+2);
1021
1023 switch ($code) {
1025 $spos = $pos + 4;
1026 $limitpos = $spos + $length;
1027 $uniqueStrings = $this->_GetInt4d($data, $spos+4);
1028 $spos += 8;
1029 for ($i = 0; $i < $uniqueStrings; $i++) {
1030 // Read in the number of characters
1031 if ($spos == $limitpos) {
1032 $opcode = v($data,$spos);
1033 $conlength = v($data,$spos+2);
1034 if ($opcode != 0x3c) {
1035 return -1;
1036 }
1037 $spos += 4;
1038 $limitpos = $spos + $conlength;
1039 }
1040 $numChars = ord($data[$spos]) | (ord($data[$spos+1]) << 8);
1041 $spos += 2;
1042 $optionFlags = ord($data[$spos]);
1043 $spos++;
1044 $asciiEncoding = (($optionFlags & 0x01) == 0) ;
1045 $extendedString = ( ($optionFlags & 0x04) != 0);
1046
1047 // See if string contains formatting information
1048 $richString = ( ($optionFlags & 0x08) != 0);
1049
1050 if ($richString) {
1051 // Read in the crun
1052 $formattingRuns = v($data,$spos);
1053 $spos += 2;
1054 }
1055
1056 if ($extendedString) {
1057 // Read in cchExtRst
1058 $extendedRunLength = $this->_GetInt4d($data, $spos);
1059 $spos += 4;
1060 }
1061
1062 $len = ($asciiEncoding)? $numChars : $numChars*2;
1063 if ($spos + $len < $limitpos) {
1064 $retstr = substr($data, $spos, $len);
1065 $spos += $len;
1066 }
1067 else{
1068 // found countinue
1069 $retstr = substr($data, $spos, $limitpos - $spos);
1070 $bytesRead = $limitpos - $spos;
1071 $charsLeft = $numChars - (($asciiEncoding) ? $bytesRead : ($bytesRead / 2));
1072 $spos = $limitpos;
1073
1074 while ($charsLeft > 0){
1075 $opcode = v($data,$spos);
1076 $conlength = v($data,$spos+2);
1077 if ($opcode != 0x3c) {
1078 return -1;
1079 }
1080 $spos += 4;
1081 $limitpos = $spos + $conlength;
1082 $option = ord($data[$spos]);
1083 $spos += 1;
1084 if ($asciiEncoding && ($option == 0)) {
1085 $len = min($charsLeft, $limitpos - $spos); // min($charsLeft, $conlength);
1086 $retstr .= substr($data, $spos, $len);
1087 $charsLeft -= $len;
1088 $asciiEncoding = true;
1089 }
1090 elseif (!$asciiEncoding && ($option != 0)) {
1091 $len = min($charsLeft * 2, $limitpos - $spos); // min($charsLeft, $conlength);
1092 $retstr .= substr($data, $spos, $len);
1093 $charsLeft -= $len/2;
1094 $asciiEncoding = false;
1095 }
1096 elseif (!$asciiEncoding && ($option == 0)) {
1097 // Bummer - the string starts off as Unicode, but after the
1098 // continuation it is in straightforward ASCII encoding
1099 $len = min($charsLeft, $limitpos - $spos); // min($charsLeft, $conlength);
1100 for ($j = 0; $j < $len; $j++) {
1101 $retstr .= $data[$spos + $j].chr(0);
1102 }
1103 $charsLeft -= $len;
1104 $asciiEncoding = false;
1105 }
1106 else{
1107 $newstr = '';
1108 for ($j = 0; $j < strlen($retstr); $j++) {
1109 $newstr = $retstr[$j].chr(0);
1110 }
1111 $retstr = $newstr;
1112 $len = min($charsLeft * 2, $limitpos - $spos); // min($charsLeft, $conlength);
1113 $retstr .= substr($data, $spos, $len);
1114 $charsLeft -= $len/2;
1115 $asciiEncoding = false;
1116 }
1117 $spos += $len;
1118 }
1119 }
1120 $retstr = ($asciiEncoding) ? $retstr : $this->_encodeUTF16($retstr);
1121
1122 if ($richString){
1123 $spos += 4 * $formattingRuns;
1124 }
1125
1126 // For extended strings, skip over the extended string data
1127 if ($extendedString) {
1128 $spos += $extendedRunLength;
1129 }
1130 $this->sst[]=$retstr;
1131 }
1132 break;
1134 return false;
1135 break;
1137 break;
1139 $indexCode = v($data,$pos+4);
1140 if ($version == SPREADSHEET_EXCEL_READER_BIFF8) {
1141 $numchars = v($data,$pos+6);
1142 if (ord($data[$pos+8]) == 0){
1143 $formatString = substr($data, $pos+9, $numchars);
1144 } else {
1145 $formatString = substr($data, $pos+9, $numchars*2);
1146 }
1147 } else {
1148 $numchars = ord($data[$pos+6]);
1149 $formatString = substr($data, $pos+7, $numchars*2);
1150 }
1151 $this->formatRecords[$indexCode] = $formatString;
1152 break;
1154 $height = v($data,$pos+4);
1155 $option = v($data,$pos+6);
1156 $color = v($data,$pos+8);
1157 $weight = v($data,$pos+10);
1158 $under = ord($data[$pos+14]);
1159 $font = "";
1160 // Font name
1161 $numchars = ord($data[$pos+18]);
1162 if ((ord($data[$pos+19]) & 1) == 0){
1163 $font = substr($data, $pos+20, $numchars);
1164 } else {
1165 $font = substr($data, $pos+20, $numchars*2);
1166 $font = $this->_encodeUTF16($font);
1167 }
1168 $this->fontRecords[] = array(
1169 'height' => $height / 20,
1170 'italic' => !!($option & 2),
1171 'color' => $color,
1172 'under' => !($under==0),
1173 'bold' => ($weight==700),
1174 'font' => $font,
1175 'raw' => $this->dumpHexData($data, $pos+3, $length)
1176 );
1177 break;
1178
1180 $colors = ord($data[$pos+4]) | ord($data[$pos+5]) << 8;
1181 for ($coli = 0; $coli < $colors; $coli++) {
1182 $colOff = $pos + 2 + ($coli * 4);
1183 $colr = ord($data[$colOff]);
1184 $colg = ord($data[$colOff+1]);
1185 $colb = ord($data[$colOff+2]);
1186 $this->colors[0x07 + $coli] = '#' . $this->myhex($colr) . $this->myhex($colg) . $this->myhex($colb);
1187 }
1188 break;
1189
1191 $fontIndexCode = (ord($data[$pos+4]) | ord($data[$pos+5]) << 8) - 1;
1192 $fontIndexCode = max(0,$fontIndexCode);
1193 $indexCode = ord($data[$pos+6]) | ord($data[$pos+7]) << 8;
1194 $alignbit = ord($data[$pos+10]) & 3;
1195 $bgi = (ord($data[$pos+22]) | ord($data[$pos+23]) << 8) & 0x3FFF;
1196 $bgcolor = ($bgi & 0x7F);
1197// $bgcolor = ($bgi & 0x3f80) >> 7;
1198 $align = "";
1199 if ($alignbit==3) { $align="right"; }
1200 if ($alignbit==2) { $align="center"; }
1201
1202 $fillPattern = (ord($data[$pos+21]) & 0xFC) >> 2;
1203 if ($fillPattern == 0) {
1204 $bgcolor = "";
1205 }
1206
1207 $xf = array();
1208 $xf['formatIndex'] = $indexCode;
1209 $xf['align'] = $align;
1210 $xf['fontIndex'] = $fontIndexCode;
1211 $xf['bgColor'] = $bgcolor;
1212 $xf['fillPattern'] = $fillPattern;
1213
1214 $border = ord($data[$pos+14]) | (ord($data[$pos+15]) << 8) | (ord($data[$pos+16]) << 16) | (ord($data[$pos+17]) << 24);
1215 $xf['borderLeft'] = $this->lineStyles[($border & 0xF)];
1216 $xf['borderRight'] = $this->lineStyles[($border & 0xF0) >> 4];
1217 $xf['borderTop'] = $this->lineStyles[($border & 0xF00) >> 8];
1218 $xf['borderBottom'] = $this->lineStyles[($border & 0xF000) >> 12];
1219
1220 $xf['borderLeftColor'] = ($border & 0x7F0000) >> 16;
1221 $xf['borderRightColor'] = ($border & 0x3F800000) >> 23;
1222 $border = (ord($data[$pos+18]) | ord($data[$pos+19]) << 8);
1223
1224 $xf['borderTopColor'] = ($border & 0x7F);
1225 $xf['borderBottomColor'] = ($border & 0x3F80) >> 7;
1226
1227 if (array_key_exists($indexCode, $this->dateFormats)) {
1228 $xf['type'] = 'date';
1229 $xf['format'] = $this->dateFormats[$indexCode];
1230 if ($align=='') { $xf['align'] = 'right'; }
1231 }elseif (array_key_exists($indexCode, $this->numberFormats)) {
1232 $xf['type'] = 'number';
1233 $xf['format'] = $this->numberFormats[$indexCode];
1234 if ($align=='') { $xf['align'] = 'right'; }
1235 }else{
1236 $isdate = FALSE;
1237 $formatstr = '';
1238 if ($indexCode > 0){
1239 if (isset($this->formatRecords[$indexCode]))
1240 $formatstr = $this->formatRecords[$indexCode];
1241 if ($formatstr!="") {
1242 $tmp = preg_replace("/\;.*/","",$formatstr);
1243 $tmp = preg_replace("/^\[[^\]]*\]/","",$tmp);
1244 if (preg_match("/[^hmsday\/\-:\s\\\,AMP]/i", $tmp) == 0) { // found day and time format
1245 $isdate = TRUE;
1246 $formatstr = $tmp;
1247 $formatstr = str_replace(array('AM/PM','mmmm','mmm'), array('a','F','M'), $formatstr);
1248 // m/mm are used for both minutes and months - oh SNAP!
1249 // This mess tries to fix for that.
1250 // 'm' == minutes only if following h/hh or preceding s/ss
1251 $formatstr = preg_replace("/(h:?)mm?/","$1i", $formatstr);
1252 $formatstr = preg_replace("/mm?(:?s)/","i$1", $formatstr);
1253 // A single 'm' = n in PHP
1254 $formatstr = preg_replace("/(^|[^m])m([^m]|$)/", '$1n$2', $formatstr);
1255 $formatstr = preg_replace("/(^|[^m])m([^m]|$)/", '$1n$2', $formatstr);
1256 // else it's months
1257 $formatstr = str_replace('mm', 'm', $formatstr);
1258 // Convert single 'd' to 'j'
1259 $formatstr = preg_replace("/(^|[^d])d([^d]|$)/", '$1j$2', $formatstr);
1260 $formatstr = str_replace(array('dddd','ddd','dd','yyyy','yy','hh','h'), array('l','D','d','Y','y','H','g'), $formatstr);
1261 $formatstr = preg_replace("/ss?/", 's', $formatstr);
1262 }
1263 }
1264 }
1265 if ($isdate){
1266 $xf['type'] = 'date';
1267 $xf['format'] = $formatstr;
1268 if ($align=='') { $xf['align'] = 'right'; }
1269 }else{
1270 // If the format string has a 0 or # in it, we'll assume it's a number
1271 if (preg_match("/[0#]/", $formatstr)) {
1272 $xf['type'] = 'number';
1273 if ($align=='') { $xf['align']='right'; }
1274 }
1275 else {
1276 $xf['type'] = 'other';
1277 }
1278 $xf['format'] = $formatstr;
1279 $xf['code'] = $indexCode;
1280 }
1281 }
1282 $this->xfRecords[] = $xf;
1283 break;
1285 $this->nineteenFour = (ord($data[$pos+4]) == 1);
1286 break;
1288 $rec_offset = $this->_GetInt4d($data, $pos+4);
1289 $rec_typeFlag = ord($data[$pos+8]);
1290 $rec_visibilityFlag = ord($data[$pos+9]);
1291 $rec_length = ord($data[$pos+10]);
1292
1293 if ($version == SPREADSHEET_EXCEL_READER_BIFF8){
1294 $chartype = ord($data[$pos+11]);
1295 if ($chartype == 0){
1296 $rec_name = substr($data, $pos+12, $rec_length);
1297 } else {
1298 $rec_name = $this->_encodeUTF16(substr($data, $pos+12, $rec_length*2));
1299 }
1300 }elseif ($version == SPREADSHEET_EXCEL_READER_BIFF7){
1301 $rec_name = substr($data, $pos+11, $rec_length);
1302 }
1303 $this->boundsheets[] = array('name'=>$rec_name,'offset'=>$rec_offset);
1304 break;
1305
1306 }
1307
1308 $pos += $length + 4;
1309 $code = ord($data[$pos]) | ord($data[$pos+1])<<8;
1310 $length = ord($data[$pos+2]) | ord($data[$pos+3])<<8;
1311 }
1312
1313 foreach ($this->boundsheets as $key=>$val){
1314 $this->sn = $key;
1315 $this->_parsesheet($val['offset']);
1316 }
1317 return true;
1318 }
dumpHexData($data, $pos, $length)
_parsesheet($spos)
Parse a worksheet.
$code
Definition: example_050.php:99
$border
const SPREADSHEET_EXCEL_READER_TYPE_XF
const SPREADSHEET_EXCEL_READER_TYPE_PALETTE
const SPREADSHEET_EXCEL_READER_TYPE_NAME
const SPREADSHEET_EXCEL_READER_TYPE_NINETEENFOUR
v($data, $pos)
const SPREADSHEET_EXCEL_READER_BIFF7
const SPREADSHEET_EXCEL_READER_TYPE_FILEPASS
const SPREADSHEET_EXCEL_READER_TYPE_SST
const SPREADSHEET_EXCEL_READER_TYPE_FONT
const SPREADSHEET_EXCEL_READER_TYPE_FORMAT
const SPREADSHEET_EXCEL_READER_TYPE_EOF
const SPREADSHEET_EXCEL_READER_BIFF8
const SPREADSHEET_EXCEL_READER_TYPE_BOUNDSHEET
const SPREADSHEET_EXCEL_READER_WORKBOOKGLOBALS

References $border, $code, $colors, $data, _encodeUTF16(), _GetInt4d(), _parsesheet(), dumpHexData(), SPREADSHEET_EXCEL_READER_BIFF7, SPREADSHEET_EXCEL_READER_BIFF8, SPREADSHEET_EXCEL_READER_TYPE_BOUNDSHEET, SPREADSHEET_EXCEL_READER_TYPE_EOF, SPREADSHEET_EXCEL_READER_TYPE_FILEPASS, SPREADSHEET_EXCEL_READER_TYPE_FONT, SPREADSHEET_EXCEL_READER_TYPE_FORMAT, SPREADSHEET_EXCEL_READER_TYPE_NAME, SPREADSHEET_EXCEL_READER_TYPE_NINETEENFOUR, SPREADSHEET_EXCEL_READER_TYPE_PALETTE, SPREADSHEET_EXCEL_READER_TYPE_SST, SPREADSHEET_EXCEL_READER_TYPE_XF, SPREADSHEET_EXCEL_READER_WORKBOOKGLOBALS, and v().

Referenced by read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ _parsesheet()

Spreadsheet_Excel_Reader::_parsesheet (   $spos)

Parse a worksheet.

Definition at line 1323 of file excel_reader2.php.

1323 {
1324 $cont = true;
1326 // read BOF
1327 $code = ord($data[$spos]) | ord($data[$spos+1])<<8;
1328 $length = ord($data[$spos+2]) | ord($data[$spos+3])<<8;
1329
1330 $version = ord($data[$spos + 4]) | ord($data[$spos + 5])<<8;
1331 $substreamType = ord($data[$spos + 6]) | ord($data[$spos + 7])<<8;
1332
1333 if (($version != SPREADSHEET_EXCEL_READER_BIFF8) && ($version != SPREADSHEET_EXCEL_READER_BIFF7)) {
1334 return -1;
1335 }
1336
1337 if ($substreamType != SPREADSHEET_EXCEL_READER_WORKSHEET){
1338 return -2;
1339 }
1340 $spos += $length + 4;
1341 while($cont) {
1342 $lowcode = ord($data[$spos]);
1343 if ($lowcode == SPREADSHEET_EXCEL_READER_TYPE_EOF) break;
1344 $code = $lowcode | ord($data[$spos+1])<<8;
1345 $length = ord($data[$spos+2]) | ord($data[$spos+3])<<8;
1346 $spos += 4;
1347 $this->sheets[$this->sn]['maxrow'] = $this->_rowoffset - 1;
1348 $this->sheets[$this->sn]['maxcol'] = $this->_coloffset - 1;
1349 unset($this->rectype);
1350 switch ($code) {
1352 if (!isset($this->numRows)) {
1353 if (($length == 10) || ($version == SPREADSHEET_EXCEL_READER_BIFF7)){
1354 $this->sheets[$this->sn]['numRows'] = ord($data[$spos+2]) | ord($data[$spos+3]) << 8;
1355 $this->sheets[$this->sn]['numCols'] = ord($data[$spos+6]) | ord($data[$spos+7]) << 8;
1356 } else {
1357 $this->sheets[$this->sn]['numRows'] = ord($data[$spos+4]) | ord($data[$spos+5]) << 8;
1358 $this->sheets[$this->sn]['numCols'] = ord($data[$spos+10]) | ord($data[$spos+11]) << 8;
1359 }
1360 }
1361 break;
1363 $cellRanges = ord($data[$spos]) | ord($data[$spos+1])<<8;
1364 for ($i = 0; $i < $cellRanges; $i++) {
1365 $fr = ord($data[$spos + 8*$i + 2]) | ord($data[$spos + 8*$i + 3])<<8;
1366 $lr = ord($data[$spos + 8*$i + 4]) | ord($data[$spos + 8*$i + 5])<<8;
1367 $fc = ord($data[$spos + 8*$i + 6]) | ord($data[$spos + 8*$i + 7])<<8;
1368 $lc = ord($data[$spos + 8*$i + 8]) | ord($data[$spos + 8*$i + 9])<<8;
1369 if ($lr - $fr > 0) {
1370 $this->sheets[$this->sn]['cellsInfo'][$fr+1][$fc+1]['rowspan'] = $lr - $fr + 1;
1371 }
1372 if ($lc - $fc > 0) {
1373 $this->sheets[$this->sn]['cellsInfo'][$fr+1][$fc+1]['colspan'] = $lc - $fc + 1;
1374 }
1375 }
1376 break;
1379 $row = ord($data[$spos]) | ord($data[$spos+1])<<8;
1380 $column = ord($data[$spos+2]) | ord($data[$spos+3])<<8;
1381 $rknum = $this->_GetInt4d($data, $spos + 6);
1382 $numValue = $this->_GetIEEE754($rknum);
1383 $info = $this->_getCellDetails($spos,$numValue,$column);
1384 $this->addcell($row, $column, $info['string'],$info);
1385 break;
1387 $row = ord($data[$spos]) | ord($data[$spos+1])<<8;
1388 $column = ord($data[$spos+2]) | ord($data[$spos+3])<<8;
1389 $xfindex = ord($data[$spos+4]) | ord($data[$spos+5])<<8;
1390 $index = $this->_GetInt4d($data, $spos + 6);
1391 $this->addcell($row, $column, $this->sst[$index], array('xfIndex'=>$xfindex) );
1392 break;
1394 $row = ord($data[$spos]) | ord($data[$spos+1])<<8;
1395 $colFirst = ord($data[$spos+2]) | ord($data[$spos+3])<<8;
1396 $colLast = ord($data[$spos + $length - 2]) | ord($data[$spos + $length - 1])<<8;
1397 $columns = $colLast - $colFirst + 1;
1398 $tmppos = $spos+4;
1399 for ($i = 0; $i < $columns; $i++) {
1400 $numValue = $this->_GetIEEE754($this->_GetInt4d($data, $tmppos + 2));
1401 $info = $this->_getCellDetails($tmppos-4,$numValue,$colFirst + $i + 1);
1402 $tmppos += 6;
1403 $this->addcell($row, $colFirst + $i, $info['string'], $info);
1404 }
1405 break;
1407 $row = ord($data[$spos]) | ord($data[$spos+1])<<8;
1408 $column = ord($data[$spos+2]) | ord($data[$spos+3])<<8;
1409 $tmp = unpack("ddouble", substr($data, $spos + 6, 8)); // It machine machine dependent
1410 if ($this->isDate($spos)) {
1411 $numValue = $tmp['double'];
1412 }
1413 else {
1414 $numValue = $this->createNumber($spos);
1415 }
1416 $info = $this->_getCellDetails($spos,$numValue,$column);
1417 $this->addcell($row, $column, $info['string'], $info);
1418 break;
1419
1422 $row = ord($data[$spos]) | ord($data[$spos+1])<<8;
1423 $column = ord($data[$spos+2]) | ord($data[$spos+3])<<8;
1424 if ((ord($data[$spos+6])==0) && (ord($data[$spos+12])==255) && (ord($data[$spos+13])==255)) {
1425 //String formula. Result follows in a STRING record
1426 // This row/col are stored to be referenced in that record
1427 // http://code.google.com/p/php-excel-reader/issues/detail?id=4
1428 $previousRow = $row;
1429 $previousCol = $column;
1430 } elseif ((ord($data[$spos+6])==1) && (ord($data[$spos+12])==255) && (ord($data[$spos+13])==255)) {
1431 //Boolean formula. Result is in +2; 0=false,1=true
1432 // http://code.google.com/p/php-excel-reader/issues/detail?id=4
1433 if (ord($this->data[$spos+8])==1) {
1434 $this->addcell($row, $column, "TRUE");
1435 } else {
1436 $this->addcell($row, $column, "FALSE");
1437 }
1438 } elseif ((ord($data[$spos+6])==2) && (ord($data[$spos+12])==255) && (ord($data[$spos+13])==255)) {
1439 //Error formula. Error code is in +2;
1440 } elseif ((ord($data[$spos+6])==3) && (ord($data[$spos+12])==255) && (ord($data[$spos+13])==255)) {
1441 //Formula result is a null string.
1442 $this->addcell($row, $column, '');
1443 } else {
1444 // result is a number, so first 14 bytes are just like a _NUMBER record
1445 $tmp = unpack("ddouble", substr($data, $spos + 6, 8)); // It machine machine dependent
1446 if ($this->isDate($spos)) {
1447 $numValue = $tmp['double'];
1448 }
1449 else {
1450 $numValue = $this->createNumber($spos);
1451 }
1452 $info = $this->_getCellDetails($spos,$numValue,$column);
1453 $this->addcell($row, $column, $info['string'], $info);
1454 }
1455 break;
1457 $row = ord($data[$spos]) | ord($data[$spos+1])<<8;
1458 $column = ord($data[$spos+2]) | ord($data[$spos+3])<<8;
1459 $string = ord($data[$spos+6]);
1460 $this->addcell($row, $column, $string);
1461 break;
1463 // http://code.google.com/p/php-excel-reader/issues/detail?id=4
1464 if ($version == SPREADSHEET_EXCEL_READER_BIFF8){
1465 // Unicode 16 string, like an SST record
1466 $xpos = $spos;
1467 $numChars =ord($data[$xpos]) | (ord($data[$xpos+1]) << 8);
1468 $xpos += 2;
1469 $optionFlags =ord($data[$xpos]);
1470 $xpos++;
1471 $asciiEncoding = (($optionFlags &0x01) == 0) ;
1472 $extendedString = (($optionFlags & 0x04) != 0);
1473 // See if string contains formatting information
1474 $richString = (($optionFlags & 0x08) != 0);
1475 if ($richString) {
1476 // Read in the crun
1477 $formattingRuns =ord($data[$xpos]) | (ord($data[$xpos+1]) << 8);
1478 $xpos += 2;
1479 }
1480 if ($extendedString) {
1481 // Read in cchExtRst
1482 $extendedRunLength =$this->_GetInt4d($this->data, $xpos);
1483 $xpos += 4;
1484 }
1485 $len = ($asciiEncoding)?$numChars : $numChars*2;
1486 $retstr =substr($data, $xpos, $len);
1487 $xpos += $len;
1488 $retstr = ($asciiEncoding)? $retstr : $this->_encodeUTF16($retstr);
1489 }
1490 elseif ($version == SPREADSHEET_EXCEL_READER_BIFF7){
1491 // Simple byte string
1492 $xpos = $spos;
1493 $numChars =ord($data[$xpos]) | (ord($data[$xpos+1]) << 8);
1494 $xpos += 2;
1495 $retstr =substr($data, $xpos, $numChars);
1496 }
1497 $this->addcell($previousRow, $previousCol, $retstr);
1498 break;
1500 $row = ord($data[$spos]) | ord($data[$spos+1])<<8;
1501 $rowInfo = ord($data[$spos + 6]) | ((ord($data[$spos+7]) << 8) & 0x7FFF);
1502 if (($rowInfo & 0x8000) > 0) {
1503 $rowHeight = -1;
1504 } else {
1505 $rowHeight = $rowInfo & 0x7FFF;
1506 }
1507 $rowHidden = (ord($data[$spos + 12]) & 0x20) >> 5;
1508 $this->rowInfo[$this->sn][$row+1] = Array('height' => $rowHeight / 20, 'hidden'=>$rowHidden );
1509 break;
1511 break;
1513 $row = ord($data[$spos]) | ord($data[$spos+1])<<8;
1514 $column = ord($data[$spos+2]) | ord($data[$spos+3])<<8;
1515 $cols = ($length / 2) - 3;
1516 for ($c = 0; $c < $cols; $c++) {
1517 $xfindex = ord($data[$spos + 4 + ($c * 2)]) | ord($data[$spos + 5 + ($c * 2)])<<8;
1518 $this->addcell($row, $column + $c, "", array('xfIndex'=>$xfindex));
1519 }
1520 break;
1522 $row = ord($data[$spos]) | ord($data[$spos+1])<<8;
1523 $column = ord($data[$spos+2]) | ord($data[$spos+3])<<8;
1524 $this->addcell($row, $column, substr($data, $spos + 8, ord($data[$spos + 6]) | ord($data[$spos + 7])<<8));
1525 break;
1527 $cont = false;
1528 break;
1530 // Only handle hyperlinks to a URL
1531 $row = ord($this->data[$spos]) | ord($this->data[$spos+1])<<8;
1532 $row2 = ord($this->data[$spos+2]) | ord($this->data[$spos+3])<<8;
1533 $column = ord($this->data[$spos+4]) | ord($this->data[$spos+5])<<8;
1534 $column2 = ord($this->data[$spos+6]) | ord($this->data[$spos+7])<<8;
1535 $linkdata = Array();
1536 $flags = ord($this->data[$spos + 28]);
1537 $udesc = "";
1538 $ulink = "";
1539 $uloc = 32;
1540 $linkdata['flags'] = $flags;
1541 if (($flags & 1) > 0 ) { // is a type we understand
1542 // is there a description ?
1543 if (($flags & 0x14) == 0x14 ) { // has a description
1544 $uloc += 4;
1545 $descLen = ord($this->data[$spos + 32]) | ord($this->data[$spos + 33]) << 8;
1546 $udesc = substr($this->data, $spos + $uloc, $descLen * 2);
1547 $uloc += 2 * $descLen;
1548 }
1549 $ulink = $this->read16bitstring($this->data, $spos + $uloc + 20);
1550 if ($udesc == "") {
1551 $udesc = $ulink;
1552 }
1553 }
1554 $linkdata['desc'] = $udesc;
1555 $linkdata['link'] = $this->_encodeUTF16($ulink);
1556 for ($r=$row; $r<=$row2; $r++) {
1557 for ($c=$column; $c<=$column2; $c++) {
1558 $this->sheets[$this->sn]['cellsInfo'][$r+1][$c+1]['hyperlink'] = $linkdata;
1559 }
1560 }
1561 break;
1563 $this->defaultColWidth = ord($data[$spos+4]) | ord($data[$spos+5]) << 8;
1564 break;
1566 $this->standardColWidth = ord($data[$spos+4]) | ord($data[$spos+5]) << 8;
1567 break;
1569 $colfrom = ord($data[$spos+0]) | ord($data[$spos+1]) << 8;
1570 $colto = ord($data[$spos+2]) | ord($data[$spos+3]) << 8;
1571 $cw = ord($data[$spos+4]) | ord($data[$spos+5]) << 8;
1572 $cxf = ord($data[$spos+6]) | ord($data[$spos+7]) << 8;
1573 $co = ord($data[$spos+8]);
1574 for ($coli = $colfrom; $coli <= $colto; $coli++) {
1575 $this->colInfo[$this->sn][$coli+1] = Array('width' => $cw, 'xf' => $cxf, 'hidden' => ($co & 0x01), 'collapsed' => ($co & 0x1000) >> 12);
1576 }
1577 break;
1578
1579 default:
1580 break;
1581 }
1582 $spos += $length;
1583 }
1584
1585 if (!isset($this->sheets[$this->sn]['numRows']))
1586 $this->sheets[$this->sn]['numRows'] = $this->sheets[$this->sn]['maxrow'];
1587 if (!isset($this->sheets[$this->sn]['numCols']))
1588 $this->sheets[$this->sn]['numCols'] = $this->sheets[$this->sn]['maxcol'];
1589 }
if(! $in) $columns
Definition: Utf8Test.php:46
read16bitstring($data, $start)
addcell($row, $col, $string, $info=null)
_getCellDetails($spos, $numValue, $column)
$r
Definition: example_031.php:79
$info
Definition: example_052.php:80
const SPREADSHEET_EXCEL_READER_TYPE_STRING
const SPREADSHEET_EXCEL_READER_TYPE_LABELSST
const SPREADSHEET_EXCEL_READER_TYPE_MULRK
const SPREADSHEET_EXCEL_READER_TYPE_FORMULA
const SPREADSHEET_EXCEL_READER_TYPE_RK
const SPREADSHEET_EXCEL_READER_TYPE_FORMULA2
const SPREADSHEET_EXCEL_READER_TYPE_NUMBER
const SPREADSHEET_EXCEL_READER_TYPE_ROW
const SPREADSHEET_EXCEL_READER_TYPE_HYPER
const SPREADSHEET_EXCEL_READER_TYPE_MULBLANK
const SPREADSHEET_EXCEL_READER_TYPE_MERGEDCELLS
const SPREADSHEET_EXCEL_READER_TYPE_LABEL
const SPREADSHEET_EXCEL_READER_WORKSHEET
const SPREADSHEET_EXCEL_READER_TYPE_DBCELL
const SPREADSHEET_EXCEL_READER_TYPE_STANDARDWIDTH
const SPREADSHEET_EXCEL_READER_TYPE_DEFCOLWIDTH
const SPREADSHEET_EXCEL_READER_TYPE_RK2
const SPREADSHEET_EXCEL_READER_TYPE_BOOLERR
const SPREADSHEET_EXCEL_READER_TYPE_DIMENSION
const SPREADSHEET_EXCEL_READER_TYPE_COLINFO

References $code, $columns, $data, $info, $r, $row, $rowInfo, _encodeUTF16(), _getCellDetails(), _GetIEEE754(), _GetInt4d(), addcell(), createNumber(), isDate(), read16bitstring(), SPREADSHEET_EXCEL_READER_BIFF7, SPREADSHEET_EXCEL_READER_BIFF8, SPREADSHEET_EXCEL_READER_TYPE_BOOLERR, SPREADSHEET_EXCEL_READER_TYPE_COLINFO, SPREADSHEET_EXCEL_READER_TYPE_DBCELL, SPREADSHEET_EXCEL_READER_TYPE_DEFCOLWIDTH, SPREADSHEET_EXCEL_READER_TYPE_DIMENSION, SPREADSHEET_EXCEL_READER_TYPE_EOF, SPREADSHEET_EXCEL_READER_TYPE_FORMULA, SPREADSHEET_EXCEL_READER_TYPE_FORMULA2, SPREADSHEET_EXCEL_READER_TYPE_HYPER, SPREADSHEET_EXCEL_READER_TYPE_LABEL, SPREADSHEET_EXCEL_READER_TYPE_LABELSST, SPREADSHEET_EXCEL_READER_TYPE_MERGEDCELLS, SPREADSHEET_EXCEL_READER_TYPE_MULBLANK, SPREADSHEET_EXCEL_READER_TYPE_MULRK, SPREADSHEET_EXCEL_READER_TYPE_NUMBER, SPREADSHEET_EXCEL_READER_TYPE_RK, SPREADSHEET_EXCEL_READER_TYPE_RK2, SPREADSHEET_EXCEL_READER_TYPE_ROW, SPREADSHEET_EXCEL_READER_TYPE_STANDARDWIDTH, SPREADSHEET_EXCEL_READER_TYPE_STRING, and SPREADSHEET_EXCEL_READER_WORKSHEET.

Referenced by _parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addcell()

Spreadsheet_Excel_Reader::addcell (   $row,
  $col,
  $string,
  $info = null 
)

Definition at line 1677 of file excel_reader2.php.

1677 {
1678 $this->sheets[$this->sn]['maxrow'] = max($this->sheets[$this->sn]['maxrow'], $row + $this->_rowoffset);
1679 $this->sheets[$this->sn]['maxcol'] = max($this->sheets[$this->sn]['maxcol'], $col + $this->_coloffset);
1680 $this->sheets[$this->sn]['cells'][$row + $this->_rowoffset][$col + $this->_coloffset] = $string;
1681 if ($this->store_extended_info && $info) {
1682 foreach ($info as $key=>$val) {
1683 $this->sheets[$this->sn]['cellsInfo'][$row + $this->_rowoffset][$col + $this->_coloffset][$key] = $val;
1684 }
1685 }
1686 }

References $_coloffset, $_rowoffset, $info, and $row.

Referenced by _parsesheet().

+ Here is the caller graph for this function:

◆ align()

Spreadsheet_Excel_Reader::align (   $row,
  $col,
  $sheet = 0 
)

Definition at line 502 of file excel_reader2.php.

502 {
503 return $this->xfProperty($row,$col,$sheet,'align');
504 }
xfProperty($row, $col, $sheet, $prop)

References $row, and xfProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bgColor()

Spreadsheet_Excel_Reader::bgColor (   $row,
  $col,
  $sheet = 0 
)

Definition at line 505 of file excel_reader2.php.

505 {
506 return $this->xfProperty($row,$col,$sheet,'bgColor');
507 }

References $row, and xfProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ bold()

Spreadsheet_Excel_Reader::bold (   $row,
  $col,
  $sheet = 0 
)

Definition at line 569 of file excel_reader2.php.

569 {
570 return $this->fontProperty($row,$col,$sheet,'bold');
571 }
fontProperty($row, $col, $sheet=0, $prop)

References $row, and fontProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ borderBottom()

Spreadsheet_Excel_Reader::borderBottom (   $row,
  $col,
  $sheet = 0 
)

Definition at line 517 of file excel_reader2.php.

517 {
518 return $this->xfProperty($row,$col,$sheet,'borderBottom');
519 }

References $row, and xfProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ borderBottomColor()

Spreadsheet_Excel_Reader::borderBottomColor (   $row,
  $col,
  $sheet = 0 
)

Definition at line 529 of file excel_reader2.php.

529 {
530 return $this->colors[$this->xfProperty($row,$col,$sheet,'borderBottomColor')];
531 }

References $row, and xfProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ borderLeft()

Spreadsheet_Excel_Reader::borderLeft (   $row,
  $col,
  $sheet = 0 
)

Definition at line 508 of file excel_reader2.php.

508 {
509 return $this->xfProperty($row,$col,$sheet,'borderLeft');
510 }

References $row, and xfProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ borderLeftColor()

Spreadsheet_Excel_Reader::borderLeftColor (   $row,
  $col,
  $sheet = 0 
)

Definition at line 520 of file excel_reader2.php.

520 {
521 return $this->colors[$this->xfProperty($row,$col,$sheet,'borderLeftColor')];
522 }

References $row, and xfProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ borderRight()

Spreadsheet_Excel_Reader::borderRight (   $row,
  $col,
  $sheet = 0 
)

Definition at line 511 of file excel_reader2.php.

511 {
512 return $this->xfProperty($row,$col,$sheet,'borderRight');
513 }

References $row, and xfProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ borderRightColor()

Spreadsheet_Excel_Reader::borderRightColor (   $row,
  $col,
  $sheet = 0 
)

Definition at line 523 of file excel_reader2.php.

523 {
524 return $this->colors[$this->xfProperty($row,$col,$sheet,'borderRightColor')];
525 }

References $row, and xfProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ borderTop()

Spreadsheet_Excel_Reader::borderTop (   $row,
  $col,
  $sheet = 0 
)

Definition at line 514 of file excel_reader2.php.

514 {
515 return $this->xfProperty($row,$col,$sheet,'borderTop');
516 }

References $row, and xfProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ borderTopColor()

Spreadsheet_Excel_Reader::borderTopColor (   $row,
  $col,
  $sheet = 0 
)

Definition at line 526 of file excel_reader2.php.

526 {
527 return $this->colors[$this->xfProperty($row,$col,$sheet,'borderTopColor')];
528 }

References $row, and xfProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ colcount()

Spreadsheet_Excel_Reader::colcount (   $sheet = 0)

Definition at line 392 of file excel_reader2.php.

392 {
393 return $this->sheets[$sheet]['numCols'];
394 }

Referenced by dump().

+ Here is the caller graph for this function:

◆ colhidden()

Spreadsheet_Excel_Reader::colhidden (   $col,
  $sheet = 0 
)

Definition at line 399 of file excel_reader2.php.

399 {
400 return !!$this->colInfo[$sheet][$col]['hidden'];
401 }

Referenced by dump().

+ Here is the caller graph for this function:

◆ color()

Spreadsheet_Excel_Reader::color (   $row,
  $col,
  $sheet = 0 
)

Definition at line 555 of file excel_reader2.php.

555 {
556 $formatColor = $this->formatColor($row,$col,$sheet);
557 if ($formatColor!="") {
558 return $formatColor;
559 }
560 $ci = $this->fontProperty($row,$col,$sheet,'color');
561 return $this->rawColor($ci);
562 }
formatColor($row, $col, $sheet=0)

References $row, fontProperty(), formatColor(), and rawColor().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ colspan()

Spreadsheet_Excel_Reader::colspan (   $row,
  $col,
  $sheet = 0 
)

Definition at line 377 of file excel_reader2.php.

377 {
378 $val = $this->info($row,$col,'colspan',$sheet);
379 if ($val=="") { return 1; }
380 return $val;
381 }
info($row, $col, $type='', $sheet=0)

References $row, and info().

Referenced by dump().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ colwidth()

Spreadsheet_Excel_Reader::colwidth (   $col,
  $sheet = 0 
)

Definition at line 395 of file excel_reader2.php.

395 {
396 // Col width is actually the width of the number 0. So we have to estimate and come close
397 return $this->colInfo[$sheet][$col]['width']/9142*200;
398 }

Referenced by dump().

+ Here is the caller graph for this function:

◆ createNumber()

Spreadsheet_Excel_Reader::createNumber (   $spos)

Definition at line 1662 of file excel_reader2.php.

1662 {
1663 $rknumhigh = $this->_GetInt4d($this->data, $spos + 10);
1664 $rknumlow = $this->_GetInt4d($this->data, $spos + 6);
1665 $sign = ($rknumhigh & 0x80000000) >> 31;
1666 $exp = ($rknumhigh & 0x7ff00000) >> 20;
1667 $mantissa = (0x100000 | ($rknumhigh & 0x000fffff));
1668 $mantissalow1 = ($rknumlow & 0x80000000) >> 31;
1669 $mantissalow2 = ($rknumlow & 0x7fffffff);
1670 $value = $mantissa / pow( 2 , (20- ($exp - 1023)));
1671 if ($mantissalow1 != 0) $value += 1 / pow (2 , (21 - ($exp - 1023)));
1672 $value += $mantissalow2 / pow (2 , (52 - ($exp - 1023)));
1673 if ($sign) {$value = -1 * $value;}
1674 return $value;
1675 }

References _GetInt4d().

Referenced by _parsesheet().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ dump()

Spreadsheet_Excel_Reader::dump (   $row_numbers = false,
  $col_letters = false,
  $sheet = 0,
  $table_class = 'excel' 
)

Definition at line 587 of file excel_reader2.php.

587 {
588 $out = "<table class=\"$table_class\" cellspacing=0>";
589 if ($col_letters) {
590 $out .= "<thead>\n\t<tr>";
591 if ($row_numbers) {
592 $out .= "\n\t\t<th>&nbsp</th>";
593 }
594 for($i=1;$i<=$this->colcount($sheet);$i++) {
595 $style = "width:" . ($this->colwidth($i,$sheet)*1) . "px;";
596 if ($this->colhidden($i,$sheet)) {
597 $style .= "display:none;";
598 }
599 $out .= "\n\t\t<th style=\"$style\">" . strtoupper($this->colindexes[$i]) . "</th>";
600 }
601 $out .= "</tr></thead>\n";
602 }
603
604 $out .= "<tbody>\n";
605 for($row=1;$row<=$this->rowcount($sheet);$row++) {
606 $rowheight = $this->rowheight($row,$sheet);
607 $style = "height:" . ($rowheight*(4/3)) . "px;";
608 if ($this->rowhidden($row,$sheet)) {
609 $style .= "display:none;";
610 }
611 $out .= "\n\t<tr style=\"$style\">";
612 if ($row_numbers) {
613 $out .= "\n\t\t<th>$row</th>";
614 }
615 for($col=1;$col<=$this->colcount($sheet);$col++) {
616 // Account for Rowspans/Colspans
617 $rowspan = $this->rowspan($row,$col,$sheet);
618 $colspan = $this->colspan($row,$col,$sheet);
619 for($i=0;$i<$rowspan;$i++) {
620 for($j=0;$j<$colspan;$j++) {
621 if ($i>0 || $j>0) {
622 $this->sheets[$sheet]['cellsInfo'][$row+$i][$col+$j]['dontprint']=1;
623 }
624 }
625 }
626 if(!$this->sheets[$sheet]['cellsInfo'][$row][$col]['dontprint']) {
627 $style = $this->style($row,$col,$sheet);
628 if ($this->colhidden($col,$sheet)) {
629 $style .= "display:none;";
630 }
631 $out .= "\n\t\t<td style=\"$style\"" . ($colspan > 1?" colspan=$colspan":"") . ($rowspan > 1?" rowspan=$rowspan":"") . ">";
632 $val = $this->val($row,$col,$sheet);
633 if ($val=='') { $val="&nbsp;"; }
634 else {
635 $val = htmlentities($val);
636 $link = $this->hyperlink($row,$col,$sheet);
637 if ($link!='') {
638 $val = "<a href=\"$link\">$val</a>";
639 }
640 }
641 $out .= "<nobr>".nl2br($val)."</nobr>";
642 $out .= "</td>";
643 }
644 }
645 $out .= "</tr>\n";
646 }
647 $out .= "</tbody></table>";
648 return $out;
649 }
rowhidden($row, $sheet=0)
colhidden($col, $sheet=0)
rowspan($row, $col, $sheet=0)
hyperlink($row, $col, $sheet=0)
style($row, $col, $sheet=0, $properties='')
colspan($row, $col, $sheet=0)
colwidth($col, $sheet=0)
val($row, $col, $sheet=0)
rowheight($row, $sheet=0)
$style
Definition: example_012.php:70

References $out, $row, $style, colcount(), colhidden(), colspan(), colwidth(), hyperlink(), rowcount(), rowheight(), rowhidden(), rowspan(), style(), and val().

+ Here is the call graph for this function:

◆ dumpHexData()

Spreadsheet_Excel_Reader::dumpHexData (   $data,
  $pos,
  $length 
)

Definition at line 325 of file excel_reader2.php.

325 {
326 $info = "";
327 for ($i = 0; $i <= $length; $i++) {
328 $info .= ($i==0?"":" ") . $this->myHex(ord($data[$pos + $i])) . (ord($data[$pos + $i])>31? "[" . $data[$pos + $i] . "]":'');
329 }
330 return $info;
331 }

References $data, $info, and myHex().

Referenced by _parse().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ font()

Spreadsheet_Excel_Reader::font (   $row,
  $col,
  $sheet = 0 
)

Definition at line 581 of file excel_reader2.php.

581 {
582 return $this->fontProperty($row,$col,$sheet,'font');
583 }

References $row, and fontProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fontIndex()

Spreadsheet_Excel_Reader::fontIndex (   $row,
  $col,
  $sheet = 0 
)

Definition at line 552 of file excel_reader2.php.

552 {
553 return $this->xfProperty($row,$col,$sheet,'fontIndex');
554 }

References $row, and xfProperty().

+ Here is the call graph for this function:

◆ fontProperty()

Spreadsheet_Excel_Reader::fontProperty (   $row,
  $col,
  $sheet = 0,
  $prop 
)

Definition at line 545 of file excel_reader2.php.

545 {
546 $font = $this->fontRecord($row,$col,$sheet);
547 if ($font!=null) {
548 return $font[$prop];
549 }
550 return false;
551 }
fontRecord($row, $col, $sheet=0)

References $row, and fontRecord().

Referenced by bold(), color(), font(), height(), italic(), and underline().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ fontRecord()

Spreadsheet_Excel_Reader::fontRecord (   $row,
  $col,
  $sheet = 0 
)

Definition at line 535 of file excel_reader2.php.

535 {
536 $xfRecord = $this->xfRecord($row,$col,$sheet);
537 if ($xfRecord!=null) {
538 $font = $xfRecord['fontIndex'];
539 if ($font!=null) {
540 return $this->fontRecords[$font];
541 }
542 }
543 return null;
544 }
xfRecord($row, $col, $sheet=0)

References $row, and xfRecord().

Referenced by fontProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ format()

Spreadsheet_Excel_Reader::format (   $row,
  $col,
  $sheet = 0 
)

Definition at line 476 of file excel_reader2.php.

476 {
477 return $this->info($row,$col,'format',$sheet);
478 }

References $row, and info().

+ Here is the call graph for this function:

◆ formatColor()

Spreadsheet_Excel_Reader::formatColor (   $row,
  $col,
  $sheet = 0 
)

Definition at line 482 of file excel_reader2.php.

482 {
483 return $this->info($row,$col,'formatColor',$sheet);
484 }

References $row, and info().

Referenced by color().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ formatIndex()

Spreadsheet_Excel_Reader::formatIndex (   $row,
  $col,
  $sheet = 0 
)

Definition at line 479 of file excel_reader2.php.

479 {
480 return $this->info($row,$col,'formatIndex',$sheet);
481 }

References $row, and info().

+ Here is the call graph for this function:

◆ getCol()

Spreadsheet_Excel_Reader::getCol (   $col)

Definition at line 333 of file excel_reader2.php.

333 {
334 if (is_string($col)) {
335 $col = strtolower($col);
336 if (array_key_exists($col,$this->colnames)) {
337 $col = $this->colnames[$col];
338 }
339 }
340 return $col;
341 }

Referenced by info(), and val().

+ Here is the caller graph for this function:

◆ height()

Spreadsheet_Excel_Reader::height (   $row,
  $col,
  $sheet = 0 
)

Definition at line 578 of file excel_reader2.php.

578 {
579 return $this->fontProperty($row,$col,$sheet,'height');
580 }

References $row, and fontProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ hyperlink()

Spreadsheet_Excel_Reader::hyperlink (   $row,
  $col,
  $sheet = 0 
)

Definition at line 382 of file excel_reader2.php.

382 {
383 $link = $this->sheets[$sheet]['cellsInfo'][$row][$col]['hyperlink'];
384 if ($link) {
385 return $link['link'];
386 }
387 return '';
388 }

References $row.

Referenced by dump().

+ Here is the caller graph for this function:

◆ info()

Spreadsheet_Excel_Reader::info (   $row,
  $col,
  $type = '',
  $sheet = 0 
)

Definition at line 356 of file excel_reader2.php.

356 {
357 $col = $this->getCol($col);
358 if (array_key_exists('cellsInfo',$this->sheets[$sheet])
359 && array_key_exists($row,$this->sheets[$sheet]['cellsInfo'])
360 && array_key_exists($col,$this->sheets[$sheet]['cellsInfo'][$row])
361 && array_key_exists($type,$this->sheets[$sheet]['cellsInfo'][$row][$col])) {
362 return $this->sheets[$sheet]['cellsInfo'][$row][$col][$type];
363 }
364 return "";
365 }

References $row, and getCol().

Referenced by colspan(), format(), formatColor(), formatIndex(), raw(), rowspan(), type(), and xfRecord().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isDate()

Spreadsheet_Excel_Reader::isDate (   $spos)

Definition at line 1591 of file excel_reader2.php.

1591 {
1592 $xfindex = ord($this->data[$spos+4]) | ord($this->data[$spos+5]) << 8;
1593 return ($this->xfRecords[$xfindex]['type'] == 'date');
1594 }

Referenced by _parsesheet().

+ Here is the caller graph for this function:

◆ italic()

Spreadsheet_Excel_Reader::italic (   $row,
  $col,
  $sheet = 0 
)

Definition at line 572 of file excel_reader2.php.

572 {
573 return $this->fontProperty($row,$col,$sheet,'italic');
574 }

References $row, and fontProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ myHex()

Spreadsheet_Excel_Reader::myHex (   $d)

Definition at line 320 of file excel_reader2.php.

320 {
321 if ($d < 16) return "0" . dechex($d);
322 return dechex($d);
323 }

References $d.

Referenced by dumpHexData().

+ Here is the caller graph for this function:

◆ raw()

Spreadsheet_Excel_Reader::raw (   $row,
  $col,
  $sheet = 0 
)

Definition at line 369 of file excel_reader2.php.

369 {
370 return $this->info($row,$col,'raw',$sheet);
371 }

References $row, and info().

+ Here is the call graph for this function:

◆ rawColor()

Spreadsheet_Excel_Reader::rawColor (   $ci)

Definition at line 563 of file excel_reader2.php.

563 {
564 if (($ci <> 0x7FFF) && ($ci <> '')) {
565 return $this->colors[$ci];
566 }
567 return "";
568 }

Referenced by color().

+ Here is the caller graph for this function:

◆ read()

Spreadsheet_Excel_Reader::read (   $sFileName)

Read the spreadsheet file using OLE, then parse.

Definition at line 975 of file excel_reader2.php.

975 {
976 $res = $this->_ole->read($sFileName);
977
978 // oops, something goes wrong (Darko Miljanovic)
979 if($res === false) {
980 // check error code
981 if($this->_ole->error == 1) {
982 // bad file
983 throw new Exception('The filename ' . $sFileName . ' is not readable');
984 }
985 // check other error codes here (eg bad fileformat, etc...)
986 }
987 $this->data = $this->_ole->getWorkBook();
988 $this->_parse();
989 }
_parse()
Parse a workbook.

References $res, and _parse().

Referenced by Spreadsheet_Excel_Reader().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ read16bitstring()

Spreadsheet_Excel_Reader::read16bitstring (   $data,
  $start 
)

Definition at line 828 of file excel_reader2.php.

828 {
829 $len = 0;
830 while (ord($data[$start + $len]) + ord($data[$start + $len + 1]) > 0) $len++;
831 return substr($data, $start, $len);
832 }

References $data.

Referenced by _parsesheet().

+ Here is the caller graph for this function:

◆ rowcount()

Spreadsheet_Excel_Reader::rowcount (   $sheet = 0)

Definition at line 389 of file excel_reader2.php.

389 {
390 return $this->sheets[$sheet]['numRows'];
391 }

Referenced by dump().

+ Here is the caller graph for this function:

◆ rowheight()

Spreadsheet_Excel_Reader::rowheight (   $row,
  $sheet = 0 
)

Definition at line 402 of file excel_reader2.php.

402 {
403 return $this->rowInfo[$sheet][$row]['height'];
404 }

References $row.

Referenced by dump().

+ Here is the caller graph for this function:

◆ rowhidden()

Spreadsheet_Excel_Reader::rowhidden (   $row,
  $sheet = 0 
)

Definition at line 405 of file excel_reader2.php.

405 {
406 return !!$this->rowInfo[$sheet][$row]['hidden'];
407 }

References $row.

Referenced by dump().

+ Here is the caller graph for this function:

◆ rowspan()

Spreadsheet_Excel_Reader::rowspan (   $row,
  $col,
  $sheet = 0 
)

Definition at line 372 of file excel_reader2.php.

372 {
373 $val = $this->info($row,$col,'rowspan',$sheet);
374 if ($val=="") { return 1; }
375 return $val;
376 }

References $row, and info().

Referenced by dump().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setColumnFormat()

Spreadsheet_Excel_Reader::setColumnFormat (   $column,
  $sFormat 
)

Force a column to use a certain format.

Definition at line 968 of file excel_reader2.php.

968 {
969 $this->_columnsFormat[$column] = $sFormat;
970 }

◆ setDefaultFormat()

Spreadsheet_Excel_Reader::setDefaultFormat (   $sFormat)

Set the default number format.

Definition at line 961 of file excel_reader2.php.

961 {
962 $this->_defaultFormat = $sFormat;
963 }

◆ setOutputEncoding()

Spreadsheet_Excel_Reader::setOutputEncoding (   $encoding)

Set the encoding method.

Definition at line 935 of file excel_reader2.php.

935 {
936 $this->_defaultEncoding = $encoding;
937 }

Referenced by Spreadsheet_Excel_Reader().

+ Here is the caller graph for this function:

◆ setRowColOffset()

Spreadsheet_Excel_Reader::setRowColOffset (   $iOffset)

Definition at line 953 of file excel_reader2.php.

953 {
954 $this->_rowoffset = $iOffset;
955 $this->_coloffset = $iOffset;
956 }

◆ setUTFEncoder()

Spreadsheet_Excel_Reader::setUTFEncoder (   $encoder = 'iconv')

$encoder = 'iconv' or 'mb' set iconv if you would like use 'iconv' for encode UTF-16LE to your encoding set mb if you would like use 'mb_convert_encoding' for encode UTF-16LE to your encoding

Definition at line 944 of file excel_reader2.php.

944 {
945 $this->_encoderFunction = '';
946 if ($encoder == 'iconv') {
947 $this->_encoderFunction = function_exists('iconv') ? 'iconv' : '';
948 } elseif ($encoder == 'mb') {
949 $this->_encoderFunction = function_exists('mb_convert_encoding') ? 'mb_convert_encoding' : '';
950 }
951 }

Referenced by Spreadsheet_Excel_Reader().

+ Here is the caller graph for this function:

◆ Spreadsheet_Excel_Reader()

Spreadsheet_Excel_Reader::Spreadsheet_Excel_Reader (   $file = '',
  $store_extended_info = true,
  $outputEncoding = '' 
)

Constructor.

Some basic initialisation

Definition at line 915 of file excel_reader2.php.

915 {
916 $this->_ole =& new OLERead();
917 $this->setUTFEncoder('iconv');
918 if ($outputEncoding != '') {
919 $this->setOutputEncoding($outputEncoding);
920 }
921 for ($i=1; $i<245; $i++) {
922 $name = strtolower(( (($i-1)/26>=1)?chr(($i-1)/26+64):'') . chr(($i-1)%26+65));
923 $this->colnames[$name] = $i;
924 $this->colindexes[$i] = $name;
925 }
926 $this->store_extended_info = $store_extended_info;
927 if ($file!="") {
928 $this->read($file);
929 }
930 }
print $file
read($sFileName)
Read the spreadsheet file using OLE, then parse.
setOutputEncoding($encoding)
Set the encoding method.
setUTFEncoder($encoder='iconv')
$encoder = 'iconv' or 'mb' set iconv if you would like use 'iconv' for encode UTF-16LE to your encodi...

References $file, read(), setOutputEncoding(), and setUTFEncoder().

+ Here is the call graph for this function:

◆ style()

Spreadsheet_Excel_Reader::style (   $row,
  $col,
  $sheet = 0,
  $properties = '' 
)

Definition at line 411 of file excel_reader2.php.

411 {
412 $css = "";
413 $font=$this->font($row,$col,$sheet);
414 if ($font!="") {
415 $css .= "font-family:$font;";
416 }
417 $align=$this->align($row,$col,$sheet);
418 if ($align!="") {
419 $css .= "text-align:$align;";
420 }
421 $height=$this->height($row,$col,$sheet);
422 if ($height!="") {
423 $css .= "font-size:$height"."px;";
424 }
425 $bgcolor=$this->bgColor($row,$col,$sheet);
426 if ($bgcolor!="") {
427 $bgcolor = $this->colors[$bgcolor];
428 $css .= "background-color:$bgcolor;";
429 }
430 $color=$this->color($row,$col,$sheet);
431 if ($color!="") {
432 $css .= "color:$color;";
433 }
434 $bold=$this->bold($row,$col,$sheet);
435 if ($bold) {
436 $css .= "font-weight:bold;";
437 }
438 $italic=$this->italic($row,$col,$sheet);
439 if ($italic) {
440 $css .= "font-style:italic;";
441 }
442 $underline=$this->underline($row,$col,$sheet);
443 if ($underline) {
444 $css .= "text-decoration:underline;";
445 }
446 // Borders
447 $bLeft = $this->borderLeft($row,$col,$sheet);
448 $bRight = $this->borderRight($row,$col,$sheet);
449 $bTop = $this->borderTop($row,$col,$sheet);
450 $bBottom = $this->borderBottom($row,$col,$sheet);
451 $bLeftCol = $this->borderLeftColor($row,$col,$sheet);
452 $bRightCol = $this->borderRightColor($row,$col,$sheet);
453 $bTopCol = $this->borderTopColor($row,$col,$sheet);
454 $bBottomCol = $this->borderBottomColor($row,$col,$sheet);
455 // Try to output the minimal required style
456 if ($bLeft!="" && $bLeft==$bRight && $bRight==$bTop && $bTop==$bBottom) {
457 $css .= "border:" . $this->lineStylesCss[$bLeft] .";";
458 }
459 else {
460 if ($bLeft!="") { $css .= "border-left:" . $this->lineStylesCss[$bLeft] .";"; }
461 if ($bRight!="") { $css .= "border-right:" . $this->lineStylesCss[$bRight] .";"; }
462 if ($bTop!="") { $css .= "border-top:" . $this->lineStylesCss[$bTop] .";"; }
463 if ($bBottom!="") { $css .= "border-bottom:" . $this->lineStylesCss[$bBottom] .";"; }
464 }
465 // Only output border colors if there is an actual border specified
466 if ($bLeft!="" && $bLeftCol!="") { $css .= "border-left-color:" . $bLeftCol .";"; }
467 if ($bRight!="" && $bRightCol!="") { $css .= "border-right-color:" . $bRightCol .";"; }
468 if ($bTop!="" && $bTopCol!="") { $css .= "border-top-color:" . $bTopCol . ";"; }
469 if ($bBottom!="" && $bBottomCol!="") { $css .= "border-bottom-color:" . $bBottomCol .";"; }
470
471 return $css;
472 }
align($row, $col, $sheet=0)
height($row, $col, $sheet=0)
borderLeftColor($row, $col, $sheet=0)
bgColor($row, $col, $sheet=0)
borderRight($row, $col, $sheet=0)
borderRightColor($row, $col, $sheet=0)
underline($row, $col, $sheet=0)
borderTop($row, $col, $sheet=0)
borderBottom($row, $col, $sheet=0)
bold($row, $col, $sheet=0)
borderTopColor($row, $col, $sheet=0)
font($row, $col, $sheet=0)
color($row, $col, $sheet=0)
borderLeft($row, $col, $sheet=0)
borderBottomColor($row, $col, $sheet=0)
italic($row, $col, $sheet=0)

References $row, align(), bgColor(), bold(), borderBottom(), borderBottomColor(), borderLeft(), borderLeftColor(), borderRight(), borderRightColor(), borderTop(), borderTopColor(), color(), font(), height(), italic(), and underline().

Referenced by dump().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ type()

Spreadsheet_Excel_Reader::type (   $row,
  $col,
  $sheet = 0 
)

Definition at line 366 of file excel_reader2.php.

366 {
367 return $this->info($row,$col,'type',$sheet);
368 }

References $row, and info().

+ Here is the call graph for this function:

◆ underline()

Spreadsheet_Excel_Reader::underline (   $row,
  $col,
  $sheet = 0 
)

Definition at line 575 of file excel_reader2.php.

575 {
576 return $this->fontProperty($row,$col,$sheet,'under');
577 }

References $row, and fontProperty().

Referenced by style().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ val()

Spreadsheet_Excel_Reader::val (   $row,
  $col,
  $sheet = 0 
)

Definition at line 346 of file excel_reader2.php.

346 {
347 $col = $this->getCol($col);
348 if (array_key_exists($row,$this->sheets[$sheet]['cells']) && array_key_exists($col,$this->sheets[$sheet]['cells'][$row])) {
349 return $this->sheets[$sheet]['cells'][$row][$col];
350 }
351 return "";
352 }

References $row, and getCol().

Referenced by dump(), and value().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ value()

Spreadsheet_Excel_Reader::value (   $row,
  $col,
  $sheet = 0 
)

Definition at line 353 of file excel_reader2.php.

353 {
354 return $this->val($row,$col,$sheet);
355 }

References $row, and val().

+ Here is the call graph for this function:

◆ xfProperty()

Spreadsheet_Excel_Reader::xfProperty (   $row,
  $col,
  $sheet,
  $prop 
)

Definition at line 495 of file excel_reader2.php.

495 {
496 $xfRecord = $this->xfRecord($row,$col,$sheet);
497 if ($xfRecord!=null) {
498 return $xfRecord[$prop];
499 }
500 return "";
501 }

References $row, and xfRecord().

Referenced by align(), bgColor(), borderBottom(), borderBottomColor(), borderLeft(), borderLeftColor(), borderRight(), borderRightColor(), borderTop(), borderTopColor(), and fontIndex().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ xfRecord()

Spreadsheet_Excel_Reader::xfRecord (   $row,
  $col,
  $sheet = 0 
)

Definition at line 488 of file excel_reader2.php.

488 {
489 $xfIndex = $this->info($row,$col,'xfIndex',$sheet);
490 if ($xfIndex!="") {
491 return $this->xfRecords[$xfIndex];
492 }
493 return null;
494 }

References $row, and info().

Referenced by fontRecord(), and xfProperty().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $_coloffset

Spreadsheet_Excel_Reader::$_coloffset = 1

Definition at line 671 of file excel_reader2.php.

Referenced by addcell().

◆ $_columnsFormat

Spreadsheet_Excel_Reader::$_columnsFormat = array()

Definition at line 669 of file excel_reader2.php.

◆ $_defaultEncoding

Spreadsheet_Excel_Reader::$_defaultEncoding = "UTF-8"

Definition at line 667 of file excel_reader2.php.

◆ $_defaultFormat

Spreadsheet_Excel_Reader::$_defaultFormat = SPREADSHEET_EXCEL_READER_DEF_NUM_FORMAT

Definition at line 668 of file excel_reader2.php.

Referenced by _getCellDetails().

◆ $_ole

Spreadsheet_Excel_Reader::$_ole

Definition at line 666 of file excel_reader2.php.

◆ $_rowoffset

Spreadsheet_Excel_Reader::$_rowoffset = 1

Definition at line 670 of file excel_reader2.php.

Referenced by addcell().

◆ $boundsheets

Spreadsheet_Excel_Reader::$boundsheets = array()

Definition at line 655 of file excel_reader2.php.

◆ $colindexes

Spreadsheet_Excel_Reader::$colindexes = array()

Definition at line 316 of file excel_reader2.php.

◆ $colInfo

Spreadsheet_Excel_Reader::$colInfo = array()

Definition at line 659 of file excel_reader2.php.

◆ $colnames

Spreadsheet_Excel_Reader::$colnames = array()

Definition at line 315 of file excel_reader2.php.

◆ $colors

Spreadsheet_Excel_Reader::$colors

Definition at line 717 of file excel_reader2.php.

Referenced by _parse().

◆ $data

Spreadsheet_Excel_Reader::$data

Definition at line 665 of file excel_reader2.php.

Referenced by _GetInt4d(), _parse(), _parsesheet(), dumpHexData(), and read16bitstring().

◆ $dateFormats

Spreadsheet_Excel_Reader::$dateFormats
Initial value:
= array (
0xe => "m/d/Y",
0xf => "M-d-Y",
0x10 => "d-M",
0x11 => "M-Y",
0x12 => "h:i a",
0x13 => "h:i:s a",
0x14 => "H:i",
0x15 => "H:i:s",
0x16 => "d/m/Y H:i",
0x2d => "i:s",
0x2e => "H:i:s",
0x2f => "i:s.S"
)

List of default date formats used by Excel.

Definition at line 676 of file excel_reader2.php.

◆ $defaultColWidth

Spreadsheet_Excel_Reader::$defaultColWidth = 0

Definition at line 318 of file excel_reader2.php.

◆ $fontRecords

Spreadsheet_Excel_Reader::$fontRecords = array()

Definition at line 657 of file excel_reader2.php.

◆ $formatRecords

Spreadsheet_Excel_Reader::$formatRecords = array()

Definition at line 656 of file excel_reader2.php.

◆ $lineStyles

Spreadsheet_Excel_Reader::$lineStyles
Initial value:
= array(
0x00 => "",
0x01 => "Thin",
0x02 => "Medium",
0x03 => "Dashed",
0x04 => "Dotted",
0x05 => "Thick",
0x06 => "Double",
0x07 => "Hair",
0x08 => "Medium dashed",
0x09 => "Thin dash-dotted",
0x0A => "Medium dash-dotted",
0x0B => "Thin dash-dot-dotted",
0x0C => "Medium dash-dot-dotted",
0x0D => "Slanted medium dash-dotted"
)

Definition at line 795 of file excel_reader2.php.

◆ $lineStylesCss

Spreadsheet_Excel_Reader::$lineStylesCss
Initial value:
= array(
"Thin" => "1px solid",
"Medium" => "2px solid",
"Dashed" => "1px dashed",
"Dotted" => "1px dotted",
"Thick" => "3px solid",
"Double" => "double",
"Hair" => "1px solid",
"Medium dashed" => "2px dashed",
"Thin dash-dotted" => "1px dashed",
"Medium dash-dotted" => "2px dashed",
"Thin dash-dot-dotted" => "1px dashed",
"Medium dash-dot-dotted" => "2px dashed",
"Slanted medium dash-dotte" => "2px dashed"
)

Definition at line 812 of file excel_reader2.php.

◆ $numberFormats

Spreadsheet_Excel_Reader::$numberFormats
Initial value:
= array(
0x1 => "0",
0x2 => "0.00",
0x3 => "#,##0",
0x4 => "#,##0.00",
0x5 => "\$#,##0;(\$#,##0)",
0x6 => "\$#,##0;[Red](\$#,##0)",
0x7 => "\$#,##0.00;(\$#,##0.00)",
0x8 => "\$#,##0.00;[Red](\$#,##0.00)",
0x9 => "0%",
0xa => "0.00%",
0xb => "0.00E+00",
0x25 => "#,##0;(#,##0)",
0x26 => "#,##0;[Red](#,##0)",
0x27 => "#,##0.00;(#,##0.00)",
0x28 => "#,##0.00;[Red](#,##0.00)",
0x29 => "#,##0;(#,##0)",
0x2a => "\$#,##0;(\$#,##0)",
0x2b => "#,##0.00;(#,##0.00)",
0x2c => "\$#,##0.00;(\$#,##0.00)",
0x30 => "##0.0E+0"
)

Default number formats used by Excel.

Definition at line 694 of file excel_reader2.php.

◆ $rowInfo

Spreadsheet_Excel_Reader::$rowInfo = array()

Definition at line 660 of file excel_reader2.php.

Referenced by _parsesheet().

◆ $sheets

Spreadsheet_Excel_Reader::$sheets = array()

Definition at line 663 of file excel_reader2.php.

◆ $sst

Spreadsheet_Excel_Reader::$sst = array()

Definition at line 662 of file excel_reader2.php.

◆ $standardColWidth

Spreadsheet_Excel_Reader::$standardColWidth = 0

Definition at line 317 of file excel_reader2.php.

◆ $xfRecords

Spreadsheet_Excel_Reader::$xfRecords = array()

Definition at line 658 of file excel_reader2.php.


The documentation for this class was generated from the following file: