Solved

Add Image to table in HTMLReportGenerator

  • 12 October 2017
  • 5 replies
  • 14 views

Badge +2

Would it be possible to add an image to a table with the HTML Report Generator. I have an url with an image. When I add this to the table-option it show the url instead of the image. Which makes sense but that is not my goal.

I tried using the custom html option but then only one row is used. I used the following code. 

    <table>
 <thead> 
        <tr>
            <th>Name</th>
            <th>Image</th>
        </tr>
 </thead>
 </tbody>
        <tr>
            <td>@Value(Name)</td>
            <td><img src="@Value(Image)" alt="" border=3 height=100 width=100></img></td>
        </tr>
</tbody>
    </table>

icon

Best answer by redgeographics 13 October 2017, 12:57

View original

5 replies

Badge +3

I'm not sure if it causes the display problem but <img> tag is not closed in HTML5:

<td><img src="@Value(Image)" alt="" border=3 height=100 width=100></td>
Badge +2

I'm not sure if it causes the display problem but <img> tag is not closed in HTML5:

<td><img src="@Value(Image)" alt="" border=3 height=100 width=100></td>
Thanks for the reply. Unfortunately this does not solve the issue. Any other ideas?

 

Userlevel 4
Badge +25

It doesn't seem to work with the HTMLReportGenerator, it seems to not treat the table cell contents as HTML.

You can work around this by using an XMLTemplater to set up the table yourself and then include that in the HTMLReportGenerator as a block of custom HTML. I made a quick sample of that.

none2html.fmw

Badge +10

If you are using the table option, the html tags are replaced. You will need to put them back in so that the code is read correctly, in a similar way to that suggested here

https://knowledge.safe.com/questions/46052/how-to-use-hyperlinks-with-attribute-value-in-html.html

Sample workbench

html-table-images.fmw

If you have 2017 there are other options with the custom html

Badge +2

It doesn't seem to work with the HTMLReportGenerator, it seems to not treat the table cell contents as HTML.

You can work around this by using an XMLTemplater to set up the table yourself and then include that in the HTMLReportGenerator as a block of custom HTML. I made a quick sample of that.

none2html.fmw

@redgeographics

 

Thanks for this answer. This works perfect.

 

It seems that CSS must be put in the html-tag instead of a <style> </style> option at the top of the html-page.

 

Is it possible to create a html-file (including style options) and use this in the HTML-report generator combined with the above solution?

 

Reply