For one of my projects, I need to send a report in mail as a table which I included in my mail as a HTML table. I still need to reduce the column size of the table as whatever table I attach its size remains the same. I don’t need a big table for just 2 or 3 columns. The steps I followed are;
Create a text file as mail template using HTML Tags and variable fields. ({0},{1})
Convert the required data table into HTML table using activity (Data Table To Html Table)
Attach the HTML table to the body of the mail, in the variable field. (say, {0})
This method gives me only a specific table size which I couldn’t alter.
Kindly help me out to change the size of the table. Should I follow a different way?
I’m not sure whether this is the normal way that people use. However, when formatting emails, I use a online html editor to get the format as a HTML code. There, I have created tables just like what you need and I have adjusted the column sizes and stuff like that. The code automatically generates in the site. Then what I do is, after everything is done, I get the code and copy it to a text file and save it. In the send mail activity, for the body, I mention the text I have in the text file in HTML format. This is the best approach that I have tried out and it works perfect for me.
Below is the site I use,
Check the below sample code I created for a table with different column widths.
I used the same activity to convert the Datatable to Html and added to the mail. But the issue is, the table that I get in the mail has a much bigger size than needed. How can I define the table size?
If the datatable you originally have it too big , i.e. too many columns. You can remove extra columns using Remove Data Column, if you know the columns as the table in the original question.
You can use a for each loop using the column names and if it is not in the list that you want to keep, remove it.