Fix issue #218
This commit is contained in:
parent
b4724906c4
commit
895a52a31e
@ -23,6 +23,7 @@ class CellValueFormatter
|
||||
/** Definition of XML nodes names used to parse data */
|
||||
const XML_NODE_P = 'p';
|
||||
const XML_NODE_S = 'text:s';
|
||||
const XML_NODE_A = 'text:a';
|
||||
|
||||
/** Definition of XML attribute used to parse data */
|
||||
const XML_ATTRIBUTE_TYPE = 'office:value-type';
|
||||
@ -98,6 +99,8 @@ class CellValueFormatter
|
||||
$spaceAttribute = $childNode->getAttribute(self::XML_ATTRIBUTE_C);
|
||||
$numSpaces = (!empty($spaceAttribute)) ? intval($spaceAttribute) : 1;
|
||||
$currentPValue .= str_repeat(' ', $numSpaces);
|
||||
} else if ($childNode->nodeName === self::XML_NODE_A) {
|
||||
$currentPValue .= $childNode->nodeValue;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -436,6 +436,23 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
||||
$this->assertEquals($expectedRows, $allRows, 'Cell values should not be trimmed');
|
||||
}
|
||||
|
||||
/**
|
||||
* https://github.com/box/spout/issues/218
|
||||
* @return void
|
||||
*/
|
||||
public function testReaderShouldReadTextInHyperlinks()
|
||||
{
|
||||
$allRows = $this->getAllRowsForFile('sheet_with_hyperlinks.ods');
|
||||
|
||||
$expectedRows = [
|
||||
['email', 'text'],
|
||||
['1@example.com', 'text'],
|
||||
['2@example.com', 'text and https://github.com/box/spout/issues/218 and text'],
|
||||
];
|
||||
|
||||
$this->assertEquals($expectedRows, $allRows, 'Text in hyperlinks should be read');
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $fileName
|
||||
* @return array All the read rows the given file
|
||||
|
BIN
tests/resources/ods/sheet_with_hyperlinks.ods
Normal file
BIN
tests/resources/ods/sheet_with_hyperlinks.ods
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user