Forum


Replies: 1   Views: 293
Using embedhtml wordstyles with images
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 dannyguest  · 03-12-2021 - 11:45

We are using EmbedHTML to display a image in a report which is working fine. As an additional piece of functionality we now want to optionally set and outer border to the image. We have created a WordStyle and are trying to apply it to the image.

private function generate_chart_fragment($docx,$image){
    $chart_fragment = new WordFragment($docx, 'document');
    $chart_fragment->embedHTML('<img src="' . $image . '" id="chartborder">',array('wordStyles'=>array('#chartborder'=>'ChartWithBorder')));
    return $chart_fragment;
}

It appears the wordStyles option is not functioning as we expected.

We have tried adding style="border: 1px solid #000" which did add a border to the image but the top and bottom ones were thinner than the ones on the left and right for some reason. 

Any help would be appreciated.