Skip to main content
Solved

HTMLReportGenerator - Map position

  • November 2, 2018
  • 2 replies
  • 33 views

Forum|alt.badge.img

Hi All,

Hopefully an easy one. Using the leaflet map option from the HTML report generator. Is there a simple way to position the maps centrally instead of width 100%?

 

Thanks

Best answer by gerhardatsafe

Hi @lemzip,

The HTMLReportGenerator adds an HTML style attribute to the div container of the map. You can easily modify this attribute by replacing it with a StringReplacer. The default HTML attribute looks like this:

style="width:100%;height:500px;"

If you add a StringReplacer searching for this string in the html_content attribute and replace it with, for example, this:

style="position:fixed;
      top: 50%;
      left: 50%;
      width:30em;
      height:18em;
      margin-top: -9em;
      margin-left: -15em;"

you will end up with a map in the center of the window. This is an easy way to change the style of the default map output of the HTMLReportGenerator.

I hope this helps!

This post is closed to further activity.
It may be an old question, an answered question, an implemented idea, or a notification-only post.
Please check post dates before relying on any information in a question or answer.
For follow-up or related questions, please post a new question or idea.
If there is a genuine update to be made, please contact us and request that the post is reopened.

2 replies

Forum|alt.badge.img
  • 288 replies
  • Best Answer
  • November 2, 2018

Hi @lemzip,

The HTMLReportGenerator adds an HTML style attribute to the div container of the map. You can easily modify this attribute by replacing it with a StringReplacer. The default HTML attribute looks like this:

style="width:100%;height:500px;"

If you add a StringReplacer searching for this string in the html_content attribute and replace it with, for example, this:

style="position:fixed;
      top: 50%;
      left: 50%;
      width:30em;
      height:18em;
      margin-top: -9em;
      margin-left: -15em;"

you will end up with a map in the center of the window. This is an easy way to change the style of the default map output of the HTMLReportGenerator.

I hope this helps!


Forum|alt.badge.img
  • Author
  • 13 replies
  • November 7, 2018

thanks, works as required.

 

cheers