parent
70c81e809f
commit
cd38ba093e
@ -24,6 +24,7 @@ class CellValueFormatter
|
|||||||
const XML_NODE_P = 'p';
|
const XML_NODE_P = 'p';
|
||||||
const XML_NODE_S = 'text:s';
|
const XML_NODE_S = 'text:s';
|
||||||
const XML_NODE_A = 'text:a';
|
const XML_NODE_A = 'text:a';
|
||||||
|
const XML_NODE_SPAN = 'text:span';
|
||||||
|
|
||||||
/** Definition of XML attribute used to parse data */
|
/** Definition of XML attribute used to parse data */
|
||||||
const XML_ATTRIBUTE_TYPE = 'office:value-type';
|
const XML_ATTRIBUTE_TYPE = 'office:value-type';
|
||||||
@ -104,7 +105,7 @@ class CellValueFormatter
|
|||||||
$spaceAttribute = $childNode->getAttribute(self::XML_ATTRIBUTE_C);
|
$spaceAttribute = $childNode->getAttribute(self::XML_ATTRIBUTE_C);
|
||||||
$numSpaces = (!empty($spaceAttribute)) ? intval($spaceAttribute) : 1;
|
$numSpaces = (!empty($spaceAttribute)) ? intval($spaceAttribute) : 1;
|
||||||
$currentPValue .= str_repeat(' ', $numSpaces);
|
$currentPValue .= str_repeat(' ', $numSpaces);
|
||||||
} else if ($childNode->nodeName === self::XML_NODE_A) {
|
} else if ($childNode->nodeName === self::XML_NODE_A || $childNode->nodeName === self::XML_NODE_SPAN) {
|
||||||
$currentPValue .= $childNode->nodeValue;
|
$currentPValue .= $childNode->nodeValue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -468,6 +468,20 @@ class ReaderTest extends \PHPUnit_Framework_TestCase
|
|||||||
$this->assertEquals($expectedRows, $allRows, 'Text in hyperlinks should be read');
|
$this->assertEquals($expectedRows, $allRows, 'Text in hyperlinks should be read');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function testReaderShouldReadInlineFontFormattingAsText()
|
||||||
|
{
|
||||||
|
$allRows = $this->getAllRowsForFile('sheet_with_inline_font_formatting.ods');
|
||||||
|
|
||||||
|
$expectedRows = [
|
||||||
|
['I am a yellow bird']
|
||||||
|
];
|
||||||
|
|
||||||
|
$this->assertEquals($expectedRows, $allRows, 'Text formatted inline should be read');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param string $fileName
|
* @param string $fileName
|
||||||
* @param bool|void $shouldFormatDates
|
* @param bool|void $shouldFormatDates
|
||||||
|
BIN
tests/resources/ods/sheet_with_inline_font_formatting.ods
Normal file
BIN
tests/resources/ods/sheet_with_inline_font_formatting.ods
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user