1

When I set format of a cell as %, and Export it automatically multiply the value with 100 & show the value. So 1.9 becomes 190%, I have use this code to add Symbol of %.

worksheet.Cell(2, 2).Style.NumberFormat.SetFormat("0.00%");

Can anybody help me to solve this?

Smit Patel
  • 2,992
  • 1
  • 26
  • 44

2 Answers2

6

Finally Got a solution by Own. You can do it in a simple way. If you want to apply it on single cell then do this,

worksheet.Cell(9, 10).Style.NumberFormat.Format = "#,##0.00\\%"; 

And If you want to apply it on a Range of Cells then do this,

worksheet.Range(9, 10, 15, 10).Style.NumberFormat.Format = "#,##0.00\\%"; 

you can also find more formats Here, and also you can find the same from Excel as well.

Smit Patel
  • 2,992
  • 1
  • 26
  • 44
0

it worked for me but I used "#,##0.00%" instead of "#,##0.00\%"

AleM
  • 61
  • 1
  • 4