Hi
I have below code and I want that Header should have BackGround color.
C#
htmlTable.Append("");
// Add headers to the table
htmlTable.Append("");
htmlTable.Append("Transaction ID");
htmlTable.Append("Doc. No");
htmlTable.Append("Doc. Date");
htmlTable.Append("");
while (!oRecordSet.EoF)
{
htmlTable.Append("");
htmlTable.Append("" + oRecordSet.Fields.Item("TransId").Value.ToString() + "");
htmlTable.Append("" + oRecordSet.Fields.Item("DocNum").Value.ToString() + "");
htmlTable.Append("" + oRecordSet.Fields.Item("DocDate").Value.ToString() + "");
htmlTable.Append("");
oRecordSet.MoveNext();
}
htmlTable.Append("");Font Name - Calibri
Font Size - 8
Thanks

Muhammad Imran AnsariRank #326 · 7.6K reputationPosted Feb 7, 2025, 1:23 PM EST
Hello Ramco,
Instead of using inline styles, you can define a
block in your HTML to keep the structure clean. Here’s how you can do it:htmlTable.Append(""); htmlTable.Append(""); htmlTable.Append("table { border-collapse: collapse; font-family: Calibri; font-size: 8pt; }"); htmlTable.Append("th { background-color: #F2F2F2; padding: 5px; }"); // You can change the color code to your preferred color htmlTable.Append("td { padding: 5px; }"); // Adds spacing for better readability htmlTable.Append(""); htmlTable.Append(""); htmlTable.Append(""); // Add headers to the table htmlTable.Append(""); htmlTable.Append("Transaction ID"); htmlTable.Append("Doc. No"); htmlTable.Append("Doc. Date"); htmlTable.Append(""); while (!oRecordSet.EoF) { htmlTable.Append(""); htmlTable.Append("" + oRecordSet.Fields.Item("TransId").Value.ToString() + ""); htmlTable.Append("" + oRecordSet.Fields.Item("DocNum").Value.ToString() + ""); htmlTable.Append("" + oRecordSet.Fields.Item("DocDate").Value.ToString() + ""); htmlTable.Append(""); oRecordSet.MoveNext(); } htmlTable.Append("");Sarthak VarshneyRank #46 · 32K reputationPosted Feb 7, 2025, 8:59 AM EST
htmlTable.Append(""); // Add headers to the table with background color htmlTable.Append(""); // Light Gray Background htmlTable.Append("Transaction ID"); htmlTable.Append("Doc. No"); htmlTable.Append("Doc. Date"); htmlTable.Append(""); while (!oRecordSet.EoF) { htmlTable.Append(""); htmlTable.Append("" + oRecordSet.Fields.Item("TransId").Value.ToString() + ""); htmlTable.Append("" + oRecordSet.Fields.Item("DocNum").Value.ToString() + ""); htmlTable.Append("" + oRecordSet.Fields.Item("DocDate").Value.ToString() + ""); htmlTable.Append(""); oRecordSet.MoveNext(); } htmlTable.Append("");