c# - Any way to convert excel cell value in to html format? -


any way convert excel cell value in html format?

i want convert excel cell value in html. ie: excell cell value: 'am programmer' wanna convert like: am <b>programmer</b>

am reading excel using excel interop. can check whether entire value in excel cell bold/italic add html tags accordingly unable check whether text bold\italic in between cell value.

any way?

you can use this method whether each character bold or not.

a strategy think use stringbuilder build html:

    stringbuilder html = new stringbuilder();     (int index = 1; index <= cell.text.tostring().length; index++)     {         //cell here range object         characters ch = cell.get_characters(index, 1);         bool bold = (bool) ch.font.bold;         if(bold){                  if (html.length == 0)                       html.append("<b>");                  html.append(ch.text);          }     }     if (html.length !=0) html.append("</b>") 

that strategy text 1 bold word. (just figure out algorithm close open tags , make new stringbuilder when non-bold character read or when entire cell has been read)


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -