Forum


Replies: 8   Views: 4050
Header styles in wordstyles 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 HalloWelt  · 11-04-2013 - 12:13

Hi,

thanks for your advice! But it seems I found another suitable solution. I used PackageExplorer ([url]http://packageexplorer.codeplex.com/[/url]) to analyse my template. And I found that I have to use the IDs of a styling. And I had to set 'strictWordStyles' => true.

[code]
$oPHPDocX = new CreateDocx();
$oPHPDocX->addTemplate( $sUploadPath.'/template/Template.docx' );
$oPHPDocX->importStyles( $sUploadPath.'/template/Template.docx' );
foreach( $aPlaceholders as $sPlaceholder => $sHTMLContent ) {
$oPHPDocX->replaceTemplateVariableByHTML(
$sPlaceholder,
'block',
$sHTMLContent,
array(
'isFile' => false,
'parseDivsAsPs' => true,
'downloadImages' => true,
'wordStyles' =>array(
'<p>' => 'Standard',
'<h1>' => 'berschrift1',
'<h2>' => 'berschrift2',
'<h3>' => 'berschrift3',
'<h4>' => 'berschrift4',
.mytable' => 'Tabellenraster',
),
'strictWordStyles' => true
)
);
}
[/code]
I'v still got some trouble to get the mappings for table cells/headings and listentries working...
[code]
'<th>' => 'Tabellenberschrift',
'<td>' => 'TabellentextArial',
'<li>' => 'Listenabsatz'
[/code]