Skip to content

is not recognised as an OLE file #656

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
guiramadasa opened this issue Nov 8, 2015 · 2 comments
Closed

is not recognised as an OLE file #656

guiramadasa opened this issue Nov 8, 2015 · 2 comments

Comments

@guiramadasa
Copy link

guiramadasa commented Nov 8, 2015

Hi,

I am trying to develop a solution for template processing. I tried with following code.

<?php
    require_once 'includes/PhpWord/Autoloader.php';
    \PhpOffice\PhpWord\Autoloader::register();

    $templateProcessor = new \PhpOffice\PhpWord\TemplateProcessor($target_file);
?>

But I get following when I tried to read a word file with permission 0644. File path is correct.

Fatal error: Uncaught exception 'PhpOffice\PhpWord\Exception\Exception' with message 'The filename uploads/input/2748cv.docx is not recognised as an OLE file' in /home2//public_html/xxx.xx/FL/xxx/sc/includes/PhpWord/Shared/OLERead.php:80 Stack trace: #0
/home2//public_html/xxx.xx/FL/xxx/sc/includes/PhpWord/Reader/MsDoc.php(131): PhpOffice\PhpWord\Shared\OLERead->read('uploads/input/2...') #1
/home2//public_html/xxx.xx/FL/xxx/sc/includes/PhpWord/Reader/MsDoc.php(115): PhpOffice\PhpWord\Reader\MsDoc->loadOLE('uploads/input/2...') #2
/home2//public_html/xxx.xx/FL/xxx/sc/includes/PhpWord/IOFactory.php(78): PhpOffice\PhpWord\Reader\MsDoc->load('uploads/input/2...') #3
/home2//public_html/xxx.xx/FL/xxx/sc/download.php(49): PhpOffice\PhpWord\IOFactory::load('uploads/input/2...', 'MsDoc') #4 {main} thrown in
/home2//public_html/xxx.xx/FL/xxx/sc/includes/PhpWord/Shared/OLERead.php on line 80

It will be a great help if you can help me to overcome this issue. Also the solution must support both *.doc and *.docx formats.

Thank you.

@guiramadasa
Copy link
Author

Above issue is fixed, found that in code it was expecting (as per the existed code) a *.doc and a *.docx was passed.

@troosan troosan closed this as completed Jul 11, 2017
@akshaykatale99
Copy link

Is there any way to read .docx files using this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants