Skip to main content
Solved

Add Image to table in HTMLReportGenerator

  • October 12, 2017
  • 5 replies
  • 153 views

stefanh
Contributor
Forum|alt.badge.img+8

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>

Best answer by redgeographics

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

View original
Did this help you find an answer to your question?

5 replies

revesz
Contributor
Forum|alt.badge.img+14
  • Contributor
  • October 12, 2017

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>

stefanh
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • October 13, 2017
revesz wrote:

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?

 


redgeographics
Celebrity
Forum|alt.badge.img+48
  • Celebrity
  • Best Answer
  • October 13, 2017

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


ebygomm
Influencer
Forum|alt.badge.img+31
  • Influencer
  • October 13, 2017

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


stefanh
Contributor
Forum|alt.badge.img+8
  • Author
  • Contributor
  • October 13, 2017
redgeographics wrote:

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?

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings