public function PHPExcel_Reader_HTML::loadIntoExisting in Loft Data Grids 6.2
Same name and namespace in other branches
- 7.2 vendor/phpoffice/phpexcel/Classes/PHPExcel/Reader/HTML.php \PHPExcel_Reader_HTML::loadIntoExisting()
Loads PHPExcel from file into PHPExcel instance
Parameters
string $pFilename:
PHPExcel $objPHPExcel:
Return value
Throws
1 call to PHPExcel_Reader_HTML::loadIntoExisting()
- PHPExcel_Reader_HTML::load in vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ HTML.php - Loads PHPExcel from file
File
- vendor/
phpoffice/ phpexcel/ Classes/ PHPExcel/ Reader/ HTML.php, line 458
Class
- PHPExcel_Reader_HTML
- PHPExcel_Reader_HTML
Code
public function loadIntoExisting($pFilename, PHPExcel $objPHPExcel) {
// Open file to validate
$this
->_openFile($pFilename);
if (!$this
->_isValidFormat()) {
fclose($this->_fileHandle);
throw new PHPExcel_Reader_Exception($pFilename . " is an Invalid HTML file.");
}
// Close after validating
fclose($this->_fileHandle);
// Create new PHPExcel
while ($objPHPExcel
->getSheetCount() <= $this->_sheetIndex) {
$objPHPExcel
->createSheet();
}
$objPHPExcel
->setActiveSheetIndex($this->_sheetIndex);
// Create a new DOM object
$dom = new domDocument();
// Reload the HTML file into the DOM object
$loaded = $dom
->loadHTML($this
->securityScanFile($pFilename));
if ($loaded === FALSE) {
throw new PHPExcel_Reader_Exception('Failed to load ', $pFilename, ' as a DOM Document');
}
// Discard white space
$dom->preserveWhiteSpace = false;
$row = 0;
$column = 'A';
$content = '';
$this
->_processDomElement($dom, $objPHPExcel
->getActiveSheet(), $row, $column, $content);
// Return
return $objPHPExcel;
}