sp; for($j=2;$j<$this->maxrows;$j++) { $this->cells[$this->worksheet->Cells(1,$i)->value][]=(string)$this->worksheet->Cells($j,$i)->value; } } return $this->cells; }
//返回表格内容数组 public function getAllData() { return $this->cells; }
//返回制定单元格内容 public function Cell($row,$col) { return $this->worksheet->Cells($row,$col)->Value; }
//取得表格字段名数组 public function getFields() { for($i=1;$i<$this->maxcols;$i++) { $this->fields[]=$this->worksheet->Cells(1,$i)->value; } return $this->fields; }
//修改制定单元格内容 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(); } }
//修改一行数据 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) &nb |