gpt4 book ai didi

excel - 如何使用 EPPlus 将电子表格单元格的内容设置为会计格式?

转载 作者:行者123 更新时间:2023-12-02 17:42:33 33 4
gpt4 key购买 nike

我需要将某些列的内容设置为会计格式。

这次尝试:

public static readonly string NUMBER_FORMAT_ACCOUNTING = "$";
. . .
bidPriceCell.Style.Numberformat.Format = NUMBER_FORMAT_ACCOUNTING;

...只需给出“$”和“-$”作为值。

这次尝试:

public static readonly string NUMBER_FORMAT_ACCOUNTING = "$0.00";
. . .
bidPriceCell.Style.Numberformat.Format = NUMBER_FORMAT_ACCOUNTING;

...给我诸如“$24.09”和“-$0.91”之类的值

用户想要的是美元符号和值之间的空格,以及负值周围的括号,例如“$ 24.09”和“$ (0.91)”

我需要什么字符串来分配 Numberformat.Format 属性才能使其正常工作?

最佳答案

从 Wildpinkler 找到答案 here ,即:

@"_(""$""* #,##0.00_);_(""$""* \(#,##0.00\);_(""$""* ""-""??_);_(@_)";

...以便执行以下操作:

public static readonly  String NUMBER_FORMAT_ACCOUNTING = @"_(""$""* #,##0.00_);_(""$""* \(#,##0.00\);_(""$""* ""-""??_);_(@_)";
. . .
bidPriceCell.Style.Numberformat.Format = RoboReporterConstsAndUtils.NUMBER_FORMAT_ACCOUNTING;

关于excel - 如何使用 EPPlus 将电子表格单元格的内容设置为会计格式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42100667/

33 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com