Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
madflow authored and adrilo committed Jun 8, 2016
1 parent 70c81e8 commit cd38ba0
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/Spout/Reader/ODS/Helper/CellValueFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class CellValueFormatter
const XML_NODE_P = 'p';
const XML_NODE_S = 'text:s';
const XML_NODE_A = 'text:a';
const XML_NODE_SPAN = 'text:span';

/** Definition of XML attribute used to parse data */
const XML_ATTRIBUTE_TYPE = 'office:value-type';
Expand Down Expand Up @@ -104,7 +105,7 @@ protected function formatStringCellValue($node)
$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) {
} else if ($childNode->nodeName === self::XML_NODE_A || $childNode->nodeName === self::XML_NODE_SPAN) {
$currentPValue .= $childNode->nodeValue;
}
}
Expand Down
14 changes: 14 additions & 0 deletions tests/Spout/Reader/ODS/ReaderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -468,6 +468,20 @@ public function testReaderShouldReadTextInHyperlinks()
$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 bool|void $shouldFormatDates
Expand Down
Binary file not shown.

0 comments on commit cd38ba0

Please sign in to comment.