PHPWord
PHPWord copied to clipboard
.doc file can not be read
Describe the Bug
I am reading a .doc file, and the code is following:
IOFactory::load($filePath, 'MsDoc')
I run it and show the error: Uninitialized string offset: 3648
otherwise: 1.the .docx file is always can be read ! 2. similar common issue i had read, but the bug is Still exists
Steps to Reproduce
Please provide a code sample that reproduces the issue.
<?php
require __DIR__ . '/vendor/autoload.php';
use PhpOffice\PhpWord\IOFactory;
$filePath = __DIR__ . '/../../../public/zzz97.doc';
$loader = IOFactory::load($filePath, 'MsDoc');
Expected Behavior
have no error
Current Behavior
Uninitialized string offset: 3648
Context
Please fill in your environment information:
- PHP Version:7.1.33
- PHPWord Version:0.18.3
Convert your .doc into .docx. Since .doc is only supported by Word, you should maybe open it from there and save it as .docx.
The DOCX format was introduced with the launch of the MS Word 2007 and is still the file format up to now. PhpWord use Word2007 "logic" by default.
Could you please using the unoconv to convert from .doc to .pdf
@liuts-plane Could you send us a sample file ?
Hello,
Here is a sample test file (i renamed it.zip because .doc is not supported in the attach files feature of github) offset.doc.zip
I think that bugs #1474, #1318 and #853 are quite similar. I use the workaround https://github.com/PHPOffice/PHPWord/issues/1474#issuecomment-1302882245 and no more bug