Files
oleibman 1d86675e04 Ods Xml Reader and Whitespace Text Nodes
Fix #804, opened in Dec. 2018, and closed as stale in Feb. 2019, and which I have re-opened to be closed properly by this PR. Better late than never, I suppose. A third party generated an ODS spreadsheet which PhpSpreadsheet could not read. By way of explanation, the xml in the file contained lots of whitespace between tags, which is wonderful for those humans among us who have to analyze it; but PhpSpreadsheet was not prepared for it. It is now.
2024-07-03 19:56:38 -07:00

39 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace PhpOffice\PhpSpreadsheetTests\Reader\Ods;
use PhpOffice\PhpSpreadsheet\Reader\Ods;
use PHPUnit\Framework\TestCase;
class Issue804Test extends TestCase
{
public function testPreliminaries(): void
{
$file = 'zip://';
$file .= 'tests/data/Reader/Ods/issue.804.ods';
$file .= '#content.xml';
$data = file_get_contents($file);
// confirm that file contains expected namespaced xml tag
if ($data === false) {
self::fail('Unable to read file');
} else {
self::assertStringContainsString('<table:table-row>
<table:table-cell office:value-type="string" table:number-rows-spanned="1" table:style-name="heading">
<text:p>Name</text:p>', $data);
}
}
public function testIssue2810(): void
{
// Whitespace between Xml nodes
$filename = 'tests/data/Reader/Ods/issue.804.ods';
$reader = new Ods();
$spreadsheet = $reader->load($filename);
$sheet = $spreadsheet->getActiveSheet();
self::assertSame('Straße', $sheet->getCell('G1')->getValue());
$spreadsheet->disconnectWorksheets();
}
}