Applying % number format to a cell value using OpenXML

前端 未结 4 1709
太阳男子
太阳男子 2020-11-29 06:28

I want to apply the % (percentage) number format using open XML C#

I have numeric value 3.6 that I want to display that number in excel as `3.6%.

How do I a

4条回答
  •  春和景丽
    2020-11-29 07:22

    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.

提交回复
热议问题