PHPWord icon indicating copy to clipboard operation
PHPWord copied to clipboard

Docx read with images

Open rubjewa opened this issue 7 years ago • 8 comments

When using phpword to read a word file without images, i dont run into any problems. As soon as it contains an image i get the error:

DOMXPath::query(): Undefined namespace prefix (View: C:\xampp\htdocs\App\resources\views\pages\wordconvert.blade.php)

My code for running PhpWord:

<?php
  require_once base_path('vendor/autoload.php');
  
  /* Filename */
  $fileheader = 'test';
  
  $phpWord = \PhpOffice\PhpWord\IOFactory::load(storage_path('app/uploaded/files/'. $fileheader .'.docx'));
  $htmlWriter = \PhpOffice\PhpWord\IOFactory::createWriter($phpWord, 'HTML');
  $htmlWriter->save(storage_path('app/uploaded/convert/'. $fileheader .'.html'));

rubjewa avatar Mar 14 '18 09:03 rubjewa

I guess this is linked to #464. Recent Word documents store images as w:drawing instead of w:pict

troosan avatar Mar 17 '18 20:03 troosan

Hello, I have used PHPWord for converting docx file to html and pdf, But when I convert docx file with images in it, images are getting removed after conversion. I took a reference of "Sample_11_ReadWord2007.php". Please help me on this, urgenlty.

I have attached my sample docx file demo.docx

Thanks in advance!

jigneshpotenza avatar May 02 '18 09:05 jigneshpotenza

Me too!

mynukeviet avatar Jan 21 '19 14:01 mynukeviet

This still hasn't been fixed in version 0.16

adam-godfrey avatar Mar 27 '19 16:03 adam-godfrey

any updates on Images not getting displayed in .docx to .pdf conversion? I am still facing the issue with version 0.16

raj-uimatic avatar Apr 01 '19 13:04 raj-uimatic

PHPWord can't read images from docx

dhirajpatra avatar May 10 '19 08:05 dhirajpatra

i ran into the same issue. Is there any tool or package or library in Laravel that can read images from docs. I actually want to convert .docs file containing images and tables to PDF. Any help would be highly appreciated. Thanks.

ch-dani avatar Dec 30 '21 13:12 ch-dani

i had the same problem does any one got any solution for this

mohammedsiraj avatar Apr 05 '24 06:04 mohammedsiraj