Loop through each character in excel then check the format.
StringBuilder html = new StringBuilder();
for (int index1 = 1; index1 <= MySheet.get_Range("B" + index, "B" + index).Cells.Text.ToString().Length; index1++)
{
Microsoft.Office.Interop.Excel.Characters ch = MySheet.get_Range("B" + index, "B" + index).Cells.get_Characters(index1, 1);
bool bold = (bool) ch.Font.Bold;
bool italic = (bool)ch.Font.Italic;
if (bold && italic)
{
html.Append("<b><i>");
html.Append(ch.Text);
html.Append("</b></i>");
}
else if (bold)
{
html.Append("<b>");
html.Append(ch.Text);
html.Append("</b>");
}
else if (italic)
{
html.Append("<i>");
html.Append(ch.Text);
html.Append("</i>");
}
else
{
html.Append(ch.Text);
}
}
The final html will be like am a <<b>programmer<</b>