Get a Free Trial
GrabzIt's Online Community

docx documents cause only error when opening in Word

Ask questions on how to capture or convert web pages or HTML into images, MP4. CSV, PDF or DOCX documents as well on how to convert videos into animated GIF's using our API.

There are no forum posts on this topic! Why don't you write one?

We create docx documents with the following function:

 

require('grabzit/lib/GrabzItClient.class.php');
// require("grabzit/config.php");

$grabzIt = new GrabzItClient("...xxx...");

$grabzIt->HTMLtoDOCX("some content here");

header('Content-Type: application/octet-stream');
header('Content-Disposition: attachment; filename="'.$GLOBALS{TSFE}->id.'.docx"');
$GLOBALS['TSFE']->content = $grabzIt->SaveTo();

 

Documents are saved but when a docx is opened Word shows " error when opening the document ..."

What can be wrong?

Asked by Jens Liesegang on the 11th of November 2019

Please can you go to this page: https://grabz.it/html-to-word-docx-api.aspx

Then create a capture with the HTML in the box and open the file.

Does the error occur?

Answered by GrabzIt Support on the 11th of November 2019

Also it doesn't look like $GLOBALS['TSFE'] is being output into the response.

Answered by GrabzIt Support on the 11th of November 2019

The example from the API page causes the same error. $GLOBALS['TSFE']->content outputs the content correctly into the saved docx so that the docx can be opened with wordpad correctly. Only MS Word causes this error.

Answered by Jens Liesegang on the 11th of November 2019

you can try it here https://www.liesegang-partner.de/print/mustervertraege/unternehmenskauf/unternehmenskaufvertrag-share-deal-gmbh.html?doctype=word&attachment=1

Answered by Jens Liesegang on the 11th of November 2019

What is the html you are converting? Maybe that is the issue.

Answered by GrabzIt Support on the 11th of November 2019

see here as an example https://www.liesegang-partner.de/print/mustervertraege/unternehmenskauf/unternehmenskaufvertrag-share-deal-gmbh.html

Answered by Jens Liesegang on the 11th of November 2019

We have identified what the issue is and will release a software fix soon.

Answered by GrabzIt Support on the 11th of November 2019

The fix for this issue should be live in the next 30 minutes.

Answered by GrabzIt Support on the 11th of November 2019

Perfect! Thx for your help!!

Answered by Jens Liesegang on the 11th of November 2019