java - Set two styles for a single cell -


how can set 2 different styles single cell? showing cell value in

  1. bold
  2. currency format eg: 2,300.

expected o/p: 2,300

but last style overrides earlier one, , can later property.

xssfcellstyle my_style = (xssfcellstyle) wb.createcellstyle();     xssffont my_font=(xssffont) wb.createfont();     my_font.setboldweight(xssffont.boldweight_bold);     my_style.setfont(my_font); xssfcellstyle currencyformat = (xssfcellstyle) wb.createcellstyle();     xssfdataformat df =(xssfdataformat) wb.createdataformat();      currencyformat.setdataformat(df.getformat("#,##0")); 

setting data here

                rowsavingstotal.createcell(a).setcellvalue(2300);                  rowsavingstotal.getcell(a).setcellstyle(my_style);                 rowsavingstotal.getcell(a).setcellstyle(currencyformat); 

you can put 1 style on cell. merge 2 of them :

xssfcellstyle my_style = (xssfcellstyle) wb.createcellstyle(); xssffont my_font=(xssffont) wb.createfont(); my_font.setboldweight(xssffont.boldweight_bold); my_style.setfont(my_font); xssfdataformat df =(xssfdataformat) wb.createdataformat();  my_style.setdataformat(df.getformat("#,##0")); 

rowsavingstotal.createcell(a).setcellvalue(2300);  rowsavingstotal.getcell(a).setcellstyle(my_style); 

Popular posts from this blog

c# - ODP.NET Oracle.ManagedDataAccess causes ORA-12537 network session end of file -

matlab - Compression and Decompression of ECG Signal using HUFFMAN ALGORITHM -

utf 8 - split utf-8 string into bytes in python -