Table Formatting in HTML

I am using below code for formatting.

table,td{{text-align:center;}}

It gives Center text value for entire table. But I want left alignment for my first column and Center alignment for second column. Plz suggest.

Hi,

Try below css

table tr:nth-child(even) {
  text-align:center;
}

table tr:nth-child(odd) td {
  text-align:left;
} 

Regards,
Arivu

@arivu96 it didn’t work. i used nth only. should i replace it with something?

@arivu96 now it also shows an error that your string format is not correct.

Hi @kapildarmoda,

Can you send me the screenshot of what u have done?

Regards,
Arivu

Try this:

th:nth-child(2),
td:nth-child(2) {
    text-align: center;
}

Sample-JSFIDDLE

Regards…!!
Aksh

Main.xaml (22.9 KB)

didn’t work.

Hey @kapildarmoda

There was problem with your Html Conent. just learn about Html too :slight_smile:

tag should be close too like and end tag too

Find below sample reference for your better understanding -KapilSample.xaml (26.0 KB)

Regards…!!
Aksh

In your screenshot, column 2 is still left aligned. and when i use your code, it throws me an error “string format is not correct”.

<table style=“width:100%”>
<tr>
<th>Firstname</th>
<th>Lastname</th>
<th>Age</th>
</tr>
<tr>
<td>Jill</td>
<td>Smith</td>
<td>50</td>
</tr>
<tr>
<td>Eve</td>
<td>Jackson</td>
<td>94</td>
</tr>
</table>

@misha I want to format (text alignment) columns of table.

Hey @kapildarmoda

Have a look with this: KapilSample.xaml (26.0 KB)

Regards…!!
Aksh

Hi @aksh1yadav, thanks for your response. if I use your code then I need to remove assign activity and without that I can pass {0}. you can see in your screenshot.

@sarathi125 @arivu96 @aksh1yadav can you see whats the problem.

actual output: all table content left aligned
desired output: middle column content must be center aligned

if i use- th:nth-child(2),td:nth-child(2) {text-align: center;} it will give me error in assign activity.
if i use- th:nth-child(2),td:nth-child(2) {{text-align: center;}} it will make no change.

Main.xaml (22.9 KB)

@nimin

@lakshman can you please help.

@kapildarmoda,

You want center alignment for second column only right ? And also please send me your table data.

@lakshman yes, this time i want it for second column only. However, want to learn logic also, so that i can use it with multiple columns later.

Main.xaml (22.9 KB)
Feedback12345.xlsx (8.1 KB)

I used assign activity at the end so to pass dynamic name in each email.

@kapildarmoda,

Please find the attached File.

ExcelToMail.xaml (26.3 KB)

If you want text alignment for other columns then you can change here:
image

If you have any doubts then please let me know.