c# - 使用 epplus 将 Excel 单元格转换为百分比

标签 c# epplus

我想将 中的值转换为小数点后两位。我正在使用 EPPlus 如果值为 66.6666667 并且我想将其显示为 66.66% 我尝试了以下代码,但它不起作用。

   foreach (var dc in dateColumns)
   {
       sheet.Cells[2, dc, rowCount + 1, dc].Style.Numberformat.Format = "###,##%";
   }

请帮忙。

最佳答案

我找到了!

我试过了

 foreach (var dc in dateColumns)
  {
    sheet.Cells[2, dc, rowCount + 1, dc].Style.Numberformat.Format ="#0\\.00%";
   }

关于c# - 使用 epplus 将 Excel 单元格转换为百分比,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17281809/

相关文章:

c# - 如何检测托管 C# 屏幕保护程序中的 GDI 资源泄漏?

c# - String.Replace(string,string) Unicode 对于代理对而言安全吗?

c# - 无法确定 OR “Value cannot be null, parameter name ' 键的主体端'”

c# - 保护 Excel 中的某些单元格 - C# Epplus

c# - 使用 EPPlus 获取单元格的行号

.net - 导出 excel .xls 和 .xlsx EPPlus .NET

c# - 从 Windows 移动应用程序获取文件的图标

c# - 以编程方式向滚动查看器添加内容,滚动条停止工作

excel - 工作表位置超出范围。连接已关闭。使用EPPLUS时

c# - 使用 ExcelDataReader 和 Epplus 访问 protected Excel 文件