小数不显示前导零

Decimal not showing leading zero

我有以下代码将列格式化为十进制 它工作正常但是如果数字小于 1 则不显示零

foreach (var deciCol in decimalIndx)
   {
      var col = deciCol.Start.Column;
      sheet.Column(col).Style.Numberformat.Format = "#.####";
   } 

Input 12.35486 ==> in excel 12.3548 (OK)

Input 0.34845 ==> in excel .3484 (0 is not displayed)

Input 0 ==> in excel (0.) (how can i remove the decimal separator)?

提前致谢

编辑:

感谢下面的回答,我使用了以下内容:

"0.0###"

#表示optional digit。使用 0 作为前导零,例如 "0.####".

格式字符串与您在 Excel 中使用的格式字符串相同(如果您选择了自定义格式代码)。您可以先在 Excel 中测试格式字符串,找到您想要的格式字符串后,在 EPPlus 中使用它。

自定义数字格式字符串的内容记录在 Excel 的文档中。检查 Create or delete a custom number format。这解释了如何为正、负、零金额指定不同的格式,包括额外的文本等。

看来您甚至可以在格式字符串中指定颜色。我想知道 [Blue]0.###;[Red]-0.### 会是什么样子

UDPATE

如链接页面所示,您可以为零指定不同的格式,例如:

"0.####;-0.###;0"