国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > PHP > 正文

php實(shí)現(xiàn)的操作excel類詳解

2020-03-22 19:28:54
字體:
供稿:網(wǎng)友
$this- worksheet=$this- excel- WorkSheets[$this- sheetnum]; $this- maxcols=$this- maxCols(); $this- maxrows=$this- maxRows(); $this- getCells(); //取得表所有值并寫進(jìn)數(shù)組 private function getCells() for($i=1;$i $this- maxcols;$i++) for($j=2;$j $this- maxrows;$j++) $this- cells[$this- worksheet- Cells(1,$i)- html' target='_blank'>value][]=(string)$this- worksheet- Cells($j,$i)- value; return $this- cells; //返回表格內(nèi)容數(shù)組 public function getAllData() return $this- cells; //返回制定單元格內(nèi)容 public function Cell($row,$col) return $this- worksheet- Cells($row,$col)- Value; //取得表格字段名數(shù)組 public function getFields() for($i=1;$i $this- maxcols;$i++) $this- fields[]=$this- worksheet- Cells(1,$i)- value; return $this- fields; //修改制定單元格內(nèi)容 public function editCell($row,$col,$value) if($this- workbook==null || $this- worksheet==null) echo "Error:Did Not Connect!"; }else{ $this- worksheet- Cells($row,$col)- Value=$value; $this- workbook- Save(); //修改一行數(shù)據(jù) public function editOneRow($row,$arr) if($this- workbook==null || $this- worksheet==null || $row =2) echo "Error:Did Not Connect!"; }else{ if(count($arr)==$this- maxcols-1) $i=1; foreach($arr as $val) $this- worksheet- Cells($row,$i)- Value=$val; $i++; $this- workbook- Save(); //取得總列數(shù) private function maxCols() $i=1; while(true) if(0==$this- worksheet- Cells(1,$i)) return $i; break; $i++; //取得總行數(shù) private function maxRows() $i=1; while(true) if(0==$this- worksheet- Cells($i,1)) return $i; break; $i++; //讀取制定行數(shù)據(jù) public function getOneRow($row=2) if($row =2) for($i=1;$i $this- maxcols;$i++) $arr[]=$this- worksheet- Cells($row,$i)- Value; return $arr; //關(guān)閉對(duì)象 public function Close() $this- excel- WorkBooks- Close(); $this- excel=null; $this- workbook=null; $this- worksheet=null; self::$instance=null;$excel = new COM("Excel.Application");$workbook = $excel- WorkBooks- Open('D://Apache2//htdocs//wwwroot//MyExcel.xls');$worksheet = $excel- WorkSheets(1);echo $worksheet- Cells(2,6)- Value;$excel- WorkBooks- Close();$excel=Excel::getInstance();$excel- setFile("D://kaka.xls");$excel- Open();$excel- setSheet();for($i=1;$i $i++ ) $arr[]=$i;//$excel- editOneRow(2,$arr);//print_r($excel- getAllData()); $str=$excel- getAllData(); include_once('mail.class.php'); $smtpserver="smtp.yeah.net"; $smtpserverport=25; $smtpuseremail="yanqihu58@yeah.net"; $smtpemailto="yanqihu@139.com"; $smtpuser="yanqihu58"; $smtppwd="123456789"; $mailtype="HTML"; $smtp=new smtp($smtpserver,$smtpserverport,true,$smtpuser,$smtppwd); $message="你好"; //$message.="首頁連接地址為:".$this- link_url." br //$message.="電子郵箱為:".$this- link_email." br //$message.="商務(wù)聯(lián)系QQ:".$this- link_qq." br //$message.="商務(wù)電話QQ:".$this- link_tel." br //$message.="聯(lián)系人:".$this- link_people." br $smtp- debug=false; foreach($str['email'] as $key= $value){ $smtpemailto=$value; @$smtp- sendmail($smtpemailto,$smtpuseremail,$mailsubject,$message,$mailtype); exit; //exit;$excel- Close();
更多關(guān)于PHP操作Excel相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《php操作office文檔技巧總結(jié)(包括word,excel,access,ppt)》希望本文所述對(duì)大家PHP程序設(shè)計(jì)有所幫助。PHP教程

鄭重聲明:本文版權(quán)歸原作者所有,轉(zhuǎn)載文章僅為傳播更多信息之目的,如作者信息標(biāo)記有誤,請(qǐng)第一時(shí)間聯(lián)系我們修改或刪除,多謝。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 什邡市| 迁安市| 阿拉善盟| 南雄市| 威海市| 青海省| 沙河市| 泌阳县| 达拉特旗| 吉木萨尔县| 荥阳市| 民和| 霞浦县| 苍山县| 沾化县| 湖州市| 龙井市| 海口市| 绩溪县| 夏邑县| 青冈县| 沾益县| 塘沽区| 赞皇县| 高邮市| 岳普湖县| 安化县| 屏东市| 舟山市| 如东县| 贺兰县| 嘉荫县| 临泉县| 澄迈县| 佳木斯市| 和平区| 英德市| 巴青县| 大名县| 柳河县| 五原县|