Skip to content

fix MsDoc reader #612

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/PhpWord/Reader/MsDoc.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ private function loadOLE($filename)
// Get Summary Information data
$this->_SummaryInformation = $ole->getStream($ole->summaryInformation);
// Get Document Summary Information data
$this->_DocumentSummaryInformation = $ole->getStream($ole->documentSummaryInformation);
$this->_DocumentSummaryInformation = $ole->getStream($ole->docSummaryInfos);
}

private function getNumInLcb($lcb, $iSize)
Expand Down
60 changes: 60 additions & 0 deletions tests/PhpWord/Tests/Reader/MsDocTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
<?php
/**
* This file is part of PHPWord - A pure PHP library for reading and writing
* word processing documents.
*
* PHPWord is free software distributed under the terms of the GNU Lesser
* General Public License version 3 as published by the Free Software Foundation.
*
* For the full copyright and license information, please read the LICENSE
* file that was distributed with this source code. For the full list of
* contributors, visit https://github.com/PHPOffice/PHPWord/contributors.
*
* @link https://github.com/PHPOffice/PHPWord
* @copyright 2010-2014 PHPWord contributors
* @license http://www.gnu.org/licenses/lgpl.txt LGPL version 3
*/

namespace PhpOffice\PhpWord\Tests\Reader;

use PhpOffice\PhpWord\IOFactory;
use PhpOffice\PhpWord\Reader\MsDoc;

/**
* Test class for PhpOffice\PhpWord\Reader\MsDoc
*
* @coversDefaultClass \PhpOffice\PhpWord\Reader\MsDoc
* @runTestsInSeparateProcesses
*/
class MsDocTest extends \PHPUnit_Framework_TestCase
{
/**
* Test canRead() method
*/
public function testCanRead()
{
$object = new MsDoc();
$filename = __DIR__ . '/../_files/documents/reader.doc';
$this->assertTrue($object->canRead($filename));
}

/**
* Can read exception
*/
public function testCanReadFailed()
{
$object = new MsDoc();
$filename = __DIR__ . '/../_files/documents/foo.doc';
$this->assertFalse($object->canRead($filename));
}

/**
* Load
*/
public function testLoad()
{
$filename = __DIR__ . '/../_files/documents/reader.doc';
$phpWord = IOFactory::load($filename, 'MsDoc');
$this->assertInstanceOf('PhpOffice\\PhpWord\\PhpWord', $phpWord);
}
}
Binary file added tests/PhpWord/Tests/_files/documents/reader.doc
Binary file not shown.