Vytvoření docx z html pomocí PhpWord

Allconius
Člen | 313
+
0
-

Ahoj,

chtěl jsem si hromadně přeuložit dokumenty v html do docx s použitím PhpWord


namespace App\Presenters;

use Nette;
use App\Model\DbManager;
use Tracy\Debugger;
use Nette\Utils\Html;

*********************
            $phpWord = new \PhpOffice\PhpWord\PhpWord();
            $section = $phpWord->addSection();
            $html = $str;
            Html::addHtml($section, $html);
            $objWriter = IOFactory::createWriter($phpWord, 'Word2007');
            $objWriter->save($adr. '/'.$file.'.docx');

ale ta Html třída mi pořád hlásí:

Error
Non-static method Nette\Utils\Html::addHtml() cannot be called statically

co tam mám špatně ?

nightfish
Člen | 474
+
0
-

@Allconius Máš naimportovánu špatnou Html třídu – chceš PhpOffice\PhpWord\Shared\Html, nikoliv Nette\Utils\Html.

Viz příklad

Allconius
Člen | 313
+
0
-

nightfish napsal(a):

@Allconius Máš naimportovánu špatnou Html třídu – chceš PhpOffice\PhpWord\Shared\Html, nikoliv Nette\Utils\Html.

Viz příklad

Ahoj, to bylo ono , moc díky už mi chybí jen ten zip :-D

Error
Class "ZipArchive" not found
Allconius
Člen | 313
+
0
-

Allconius napsal(a):

nightfish napsal(a):

@Allconius Máš naimportovánu špatnou Html třídu – chceš PhpOffice\PhpWord\Shared\Html, nikoliv Nette\Utils\Html.

Viz příklad

Ahoj, to bylo ono , moc díky už mi chybí jen ten zip :-D

Error
Class "ZipArchive" not found

zip už tam je:

Deprecated
Return type of PhpOffice\PhpWord\Shared\XMLWriter::writeAttribute($name, $value) should either be compatible with XMLWriter::writeAttribute(string $name, string $value): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice
Allconius
Člen | 313
+
0
-

Allconius napsal(a):

Allconius napsal(a):

nightfish napsal(a):

@Allconius Máš naimportovánu špatnou Html třídu – chceš PhpOffice\PhpWord\Shared\Html, nikoliv Nette\Utils\Html.

Viz příklad

Ahoj, to bylo ono , moc díky už mi chybí jen ten zip :-D

Error
Class "ZipArchive" not found

zip už tam je:

Deprecated
Return type of PhpOffice\PhpWord\Shared\XMLWriter::writeAttribute($name, $value) should either be compatible with XMLWriter::writeAttribute(string $name, string $value): bool, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice

https://github.com/…/issues/2204