如何从xlsx阅读器获取特殊字符的单元格数据

我正在使用Simplexlsx php类从xlsx文件读取数据并导入到数据库中。

我面临的一个问题,我还没有find谷歌之后,它的问题是,有像在100%,$ 300 xlsx列中的一些值,但库parsing数据,并给出这样的输出:1,300 – 像它的评价值和删除符号。

Excel文件: 在这里输入图像说明

parsing库输出后是:

[10] => SimpleXMLElement Object ( [v] => 5 ) [11] => SimpleXMLElement Object ( [v] => 1.2 ) [12] => SimpleXMLElement Object ( [v] => 1.1000000000000001 ) [13] => SimpleXMLElement Object ( [v] => 1 ) 

我的预期应该是这样的:

 [10] => SimpleXMLElement Object ( [v] => 2.5% ) [11] => SimpleXMLElement Object ( [v] => 2% ) [12] => SimpleXMLElement Object ( [v] => 1.50% ) [13] => SimpleXMLElement Object ( [v] => 1% ) 

这里是我使用的类链接: http : //www.phpclasses.org/package/6279-PHP-Parse-and-retrieve-data-from-Excel-XLS-files.html

也可用于Git,但旧版本: https : //github.com/raulferras/simplexlsx

这里是我的文件parsing函数,上面的输出我是从echo声明中得到的,你在$ sheetparsing条件下面看到下面的函数:

 function _parse() { // Document data holders $this->sharedstrings = array(); $this->sheets = array(); // $this->styles = array(); // Read relations and search for officeDocument if ( $relations = $this->getEntryXML("_rels/.rels" ) ) { foreach ($relations->Relationship as $rel) { if ($rel["Type"] == SimpleXLSX::SCHEMA_REL_OFFICEDOCUMENT) { // echo 'workbook found<br />'; // Found office document! Read workbook & relations... // Workbook if ( $this->workbook = $this->getEntryXML( $rel['Target'] )) { // echo 'workbook read<br />'; if ( $workbookRelations = $this->getEntryXML( dirname($rel['Target']) . '/_rels/workbook.xml.rels' )) { // echo 'workbook relations<br />'; // Loop relations for workbook and extract sheets... foreach ($workbookRelations->Relationship as $workbookRelation) { $path = dirname($rel['Target']) . '/' . $workbookRelation['Target']; if ($workbookRelation['Type'] == SimpleXLSX::SCHEMA_REL_WORKSHEET) { // Sheets // echo 'sheet<br />'; if ( $sheet = $this->getEntryXML( $path ) ) { $this->sheets[ str_replace( 'rId', '', (string) $workbookRelation['Id']) ] = $sheet; echo '<pre>'.htmlspecialchars( print_r( $sheet, true ) ).'</pre>'; } } else if ($workbookRelation['Type'] == SimpleXLSX::SCHEMA_REL_SHAREDSTRINGS && $this->entryExists( $path )) { // 0.6.6 // echo 'sharedstrings<br />'; if ( $sharedStrings = $this->getEntryXML( $path ) ) { foreach ($sharedStrings->si as $val) { if (isset($val->t)) { $this->sharedstrings[] = (string)$val->t; } elseif (isset($val->r)) { $this->sharedstrings[] = $this->_parseRichText($val); } } } } else if ($workbookRelation['Type'] == SimpleXLSX::SCHEMA_REL_STYLES) { $this->styles = $this->getEntryXML( $path ); $nf = array(); if ( $this->styles->numFmts->numFmt != NULL ) foreach( $this->styles->numFmts->numFmt as $v ) $nf[ (int) $v['numFmtId'] ] = (string) $v['formatCode']; if ( $this->styles->cellXfs->xf != NULL ) foreach( $this->styles->cellXfs->xf as $v ) { $v = (array) $v->attributes(); $v = $v['@attributes']; if (isset($this->built_in_cell_formats[ $v['numFmtId'] ]) ) $v['format'] = $this->built_in_cell_formats[ $v['numFmtId'] ]; else if (isset($nf[ $v['numFmtId'] ])) $v['format'] = $nf[ $v['numFmtId'] ]; else $v['format'] = ''; $this->workbook_cell_formats[] = $v; } //print_r( $this->workbook_cell_formats ); exit; } } break; } } } } } // Sort sheets ksort($this->sheets); } 

任何帮助将非常感激。 提前致谢。