Forum


Replies: 4   Views: 2325
"domdocument::loadxml() expects parameter 1 to be string, object given" in embedhtml
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by Simon87  · 13-12-2019 - 12:47

Hi,

We have another problem with 9.5 version. We provide string and optional array for embedHTML and get "DOMDocument::loadXML() expects parameter 1 to be string, object given" error. Here's the code: https://www.dropbox.com/s/8hr1lhgkka81e8w/phpdocx-embedHTML-error.php?dl=0

We tried same markup and parameters without call_user_func_array, same thing happens.

Posted by admin  · 13-12-2019 - 14:08

Hello,

UPDATE: phpdocx 10 added support to apply custom list styles with ol and ul tags.

To apply custom list styles, you need to use ul tags, not ol:

<ul class="list-style-number-3">
    <li style="text-align: justify;">Ñтõÿõýь ÑþþтòõтÑÑ‚Ã²Ã¸Ñ ÃžÃ±ÑŠÃµÃºÑ‚Ã° Ã¡Ã¾Ã³Ã»Ã°ÑˆÃµÃ½Ã¸Ñ Ã¢Ñ€ÃµÃ±Ã¾Ã²Ã°Ã½Ã¸Ñü ú ÿõрõôðчõ;</li>
    <li style="text-align: justify;">ýõþñхþôøüыõ ôõùÑÑ‚Ã²Ã¸Ñ Ã´ÃȄ Ã¿Ñ€Ã¸Ã²ÃµÃ´ÃµÃ½Ã¸Ñ ÃžÃ±ÑŠÃµÃºÑ‚Ã° Ã¡Ã¾Ã³Ã»Ã°ÑˆÃµÃ½Ã¸Ñ Ã² ÑþþтòõтÑтòøõ Ñ Ã¢Ñ€ÃµÃ±Ã¾Ã²Ã°Ã½Ã¸Ñüø ú ÿõрõôðчõ (õÑûø Þñъõúт Ã¡Ã¾Ã³Ã»Ã°ÑˆÃµÃ½Ã¸Ñ Ã½Ãµ ÑþþтòõтÑтòуõт тðúøü трõñþòðýøÑü), Ñрþúø øх þÑущõÑтòûõýøÑ, ÿþрÑôþú фøýðýÑøрþòðýøÑ, þтòõтÑтòõýýых ÿрõôÑтðòøтõûõù áтþрþý;</li>
    <li style="text-align: justify;">ôðту фðúтøчõÑúþù ÿõрõôðчø (òþ÷òрðтð) Þñъõúтð Ã¡Ã¾Ã³Ã»Ã°ÑˆÃµÃ½Ã¸Ñ Ãšþýцõôõýту;</li>
    <li style="text-align: justify;">ÿþрÑôþú ø уÑÃ»Ã¾Ã²Ã¸Ñ Ã¿ÃµÑ€ÃµÃ´Ã°Ñ‡Ã¸ (òþ÷òрðтð) Þñъõúтð áþóûðшõýøÑ;</li>
    <li style="text-align: justify;">ÑþÑтðò ôþúуüõýтþò, ÿþôûõöðщøх ÿõрõôðчõ Úþýцõôõýту ò ÑþþтòõтÑтòøø Ñ Ã¿ÑƒÃ½ÃºÑ‚Ã¾Ã¼ <a href="#heading-999">29.1</a> áþóûðшõýøÑ;</li>
    <li style="text-align: justify;">ÿþрÑôþú ôõùÑтòøù áтþрþý ò цõûÑÑ… óþÑуôðрÑтòõýýþù рõóøÑтрðцøø Ã¿Ñ€ÃµÃºÑ€Ã°Ñ‰ÃµÃ½Ã¸Ñ Ã¿Ñ€Ã°Ã² ÚþýцÃ楥øþýõрð ò þтýþшõýøø Þñъõúтð Ã¡Ã¾Ã³Ã»Ã°ÑˆÃµÃ½Ã¸Ñ ÃºÃ°Ãº Ã¾Ã±Ñ€ÃµÃ¼ÃµÃ½ÃµÃ½Ã¸Ñ Ã¿Ñ€Ã°Ã²Ã° ÑþñÑтòõýýþÑтø Úþýцõôõýтð.</li>
</ul>

Regards.

Posted by Simon87  · 13-12-2019 - 15:40

Then how can we set OL list item padding?

Posted by admin  · 13-12-2019 - 15:54

Hello,

In DOCX documents, list items are paragraphs with an extra tag to set the numbering style. So you can apply almost the same styles as regular paragraphs.

Also, note that you can generate ordered lists using ul tags and custom list styles.

Regards.

Posted by admin  · 06-06-2020 - 09:47

Hello,

UPDATE: phpdocx 10 added support to apply custom list styles with ol and ul tags.

Please follow the following steps:

1. Edit CreateDocx.php (Classes/Phpdocx/Create folder in the namespaces package).

2. embedHTML method.

3. Replace the following line:

if (isset($value['attributes'])) {

by:

if (isset($value['attributes']) && $newNumberingDOM) {

That allows adding customListStyles with ol tags.

Regards.