示例#1
0
 public function testNumberCell()
 {
     $cell = $this->sheet->cell(1, 1);
     $this->assertEquals(XL_CELL_NUMBER, $cell->ctype);
     $this->assertEquals(100, $cell->value);
     $this->assertTrue($cell->xf_index > 0);
 }
示例#2
0
 public function testCellValue()
 {
     $this->assertEquals('PROFIL', $this->sheet->cell_value(0, 0));
     $this->assertEquals(100, $this->sheet->cell_value(1, 1));
     $this->assertEquals(113, $this->sheet->cell_value(2, 2));
     $this->assertEquals("2014-12-01 00:00:00", $this->sheet->cell_value(17, 2));
     $this->assertEquals('12:03:00', $this->sheet->cell_value(18, 2));
     $this->assertEquals('2015-12-01 13:37:01', $this->sheet->cell_value(19, 2));
     $this->assertEquals('1900-01-01 00:00:00', $this->sheet->cell_value(20, 2));
     $sheet = $this->book->getSheetByName('PROFILELEVELS');
     $this->assertEquals(0.025, $sheet->cell_value(1, 1), null, 0.001);
     $this->assertEquals(265.212, $sheet->cell_value(1, 2), null, 0.001);
     $this->assertEquals('PROFIL', $this->sheet[0][0]->value);
     $this->assertEquals(100, $this->sheet[1][1]->value);
     $this->assertEquals(113, $this->sheet[2][2]->value);
     $this->assertEquals("2014-12-01 00:00:00", $this->sheet[17][2]->value);
     $this->assertEquals('12:03:00', $this->sheet[18][2]->value);
     $this->assertEquals('2015-12-01 13:37:01', $this->sheet[19][2]->value);
     $this->assertEquals('1900-01-01 00:00:00', $this->sheet[20][2]->value);
     $sheet = $this->book->getSheetByName('PROFILELEVELS');
     $this->assertEquals(0.025, $sheet[1][1]->value, null, 0.001);
     $this->assertEquals(265.212, $sheet[1][2]->value, null, 0.001);
 }
示例#3
0
 /**
  * @param $sh_number
  * @param bool $update_pos
  * @return Sheet
  * @throws XLSParserException
  */
 public function readSheet($sh_number, $update_pos = true)
 {
     if ($update_pos) {
         $this->position = $this->sh_abs_posn[$sh_number];
     }
     # Advance BOF
     $this->readBOF(XL_WORKSHEET);
     # assert biff_version == $this->biff_version ### FAILS
     # Have an example where book is v7 but sheet reports v8!!!
     # It appears to work OK if the sheet version is ignored.
     # Confirmed by Daniel Rentz: happens when Excel does "save as"
     # creating an old version file; ignore version details on sheet BOF.
     $sh = new Sheet($this, $this->position, $this->sheet_names[$sh_number], $sh_number);
     $sh->read($this);
     $this->sheet_list[$sh_number] = $sh;
     return $sh;
 }