NWC - storing HTML table in a variable changes the formatting of the table

  • 24 August 2022
  • 6 replies
  • 1 view

I have a large form that is used to start a workflow.  The form has one section that is a repeating section which collects contact information for 1 or more people.  I am sending the content of this form in an HTML formatted email (Exchange Online connector). 



 



Because of the repeating section, I am creating a loop prior to sending the email that dynamically builds the tables used to display the contact information for the 1+ people.  The variable that is storing this HTML is then inserted into the email along with other html tables.



 



When I place the HTML directly into the email body field the HTML paints properly with tight spacing on the HTML table. When I insert the dynamically created table into this same field the spacing is twice as large as the other tables.  I have tried pasting in just the HTML template and not modifying it at all and the same issue occurs.  Whenever the HTML is stored into a variable and then re-used, the formatting is off. 



 



Any suggestions on how to resolve or work around this issue? 



 



The "Injury Information" section in the screenshot is the area I'm struggling with.  The HTML below and above that section are formatted properly (HTML inserted directly into Exchange Online connector Body field instead of being stored in a NWC variable prior to the email). 



 



Example of HTML for repeating section:



<table style="border-collapse: collapse; width: 80%; height: 126px;" border="1">
<tbody>
<tr style="height: 18px;">
<td>Name</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr style="height: 18px;">
<td>Address&nbsp;1</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr style="height: 18px;">
<td>Address&nbsp;2</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr style="height: 18px;">
<td>City</td>
<td>&nbsp;</td>
<td>State</td>
<td>&nbsp;</td>
</tr>
<tr style="height: 18px;">
<td>Zip</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
<td>&nbsp;</td>
</tr>
<tr style="height: 18px;">
<td>Phone&nbsp;Number</td>
<td>&nbsp;</td>
<td>Email</td>
<td>&nbsp;</td>
</tr>
<tr style="height: 18px;">
<td>Description</td>
<td colspan="3">&nbsp;</td>
</tr>
</tbody>
</table>



 


6 replies

Get the raw message content from your email application and look at the HTML in the body.  Compare the tables that are formatted correctly versus the one inserted via a variable.  Do the correctly formatted ones have any additional styles applied? Do they have a CSS class? Are they nested inside other HTML elements that have style applied? If so, you will want to apply those differences to your generated table.

Userlevel 5
Badge +13

Hi @Ken_T 



 



How are you building the HTML Table? You have a For-Each Loop.





What is inside the Loop?



 



Are you using Modify String - Replace substring in string?





 



I have noticed that when I use the "Modify String - Replace substring in string", artifacts are introduced into the HTML Table when used in Send Email.







 



So, I switch to using "Create a Text String" and this is the result.





 



I have describe the steps in the following article - https://community.nintex.com/t5/Nintex-Workflow-Cloud-Forum/NWC-Storing-HTML-Table-in-a-Variable-changes-the-formatting-of/td-p/224902 



 



Cheers

Hi David, thanks for the idea - I will try that out.  That being said, I'm not applying any CSS or anything like that, its a simple set of HTML tables so the behavior is unexpected. 



 



Ill let you know if I find anything interesting.

Thanks, Ill take a look at your example using modify string.   I'm currently looping through and just using the default "set a variable" action and concatenating the previous value with the new table for the current item from the loop. 



 



 

Userlevel 5
Badge +13

Hi @Ken_T 



 



I have written a detailed example. Do have a look at https://community.nintex.com/t5/Nintex-Workflow-Cloud-Forum/NWC-Storing-HTML-Table-in-a-Variable-changes-the-formatting-of/td-p/224902



 



Cheers

Thanks Garrett, 



 



I did look at your example, and I'm following a very similar process already.   



 



I also tested putting the entire email into a variable and as soon as I do that the formatting is impacted - there is something unique happening to the html once it's placed in an NWC variable.    I'll keep playing with it, I'm pretty sure Ill be able to override this behavior within the HTML itself. 




Thanks for the tips

Reply