Инструменты для захвата и конвертирования Интернета
Интернет-сообщество GrabzIt

Документы docx вызывают только ошибку при открытии в Word

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 ..."

Что может быть не так?

Asked by Jens Liesegang on Monday, 11 November, 2019 01:33:39 PM

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 Monday, 11 November, 2019 01:43:59 PM

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

Answered by GrabzIt Support on Monday, 11 November, 2019 01:47:13 PM

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

Answered by Jens Liesegang on Monday, 11 November, 2019 02:35:21 PM

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 Monday, 11 November, 2019 02:37:33 PM

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

Answered by GrabzIt Support on Monday, 11 November, 2019 02:48:01 PM

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

Answered by Jens Liesegang on Monday, 11 November, 2019 02:53:11 PM

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

Answered by GrabzIt Support on Monday, 11 November, 2019 03:13:28 PM

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

Answered by GrabzIt Support on Monday, 11 November, 2019 04:16:14 PM

Perfect! Thx for your help!!

Answered by Jens Liesegang on Monday, 11 November, 2019 05:00:14 PM