简体   繁体   English

如何获取单元格值作为Excel工作表的货币

[英]How to get the cell value as a currency of excel sheet

I set excel sheet one of the the column as a currency format $ and decimal places 2. Like $0.00. 我将一栏的Excel工作表设置为货币格式$和小数点后2位。例如$ 0.00。

But while displaying in datagridview in it showing like :0.0000. 但是当在datagridview中显示时,显示为:0.0000。 If set currency as none.Then it is showing 0.00. 如果将币种设置为none,则显示0.00。 If i add $ symbol. 如果我添加$符号。 it is showing extra digits values. 它显示了多余的数字值。

Can you please help how can i show as it is (mean like:$0.00) only In windows application. 您能帮我怎样在Windows应用程序中按原样显示(意思是:$ 0.00)。

you have to give a format to your currency datagrid field. 您必须给货币datagrid字段指定格式。 that is, assign to that column a property called DataFormatString and value of {0:c} 也就是说,为该列分配一个名为DataFormatString的属性,其值为{0:c}

for additional info: check that link http://msdn.microsoft.com/en-us/library/aa479342.aspx 有关其他信息:请检查链接http://msdn.microsoft.com/en-us/library/aa479342.aspx

Try that 试试看

<asp:BoundField DataField="Money" DataFormatString="{0:c2}" HeaderText="Money"
                    SortExpression="Money" />

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使用其字段名称获取excel表格单元格的值 - How to get the value of excel sheet cell using their Field Name 如何在以编程方式添加到Excel工作表单元格的xlDropDown中获取所选项目的值 - How to get the value of selected item in a xlDropDown which is added programmatically to a Excel sheet cell 如何在一张纸上的Excel单元格中转换值以在另一张纸上显示为下拉列表 - How to convert a value in Excel cell on one sheet to show as a dropdown in another 根据 excel 表中的值获取单元格范围/位置,并在 c# 中为单元格数据网格视图着色 - Get cell range/location based on value at excel sheet and colour the cell datagridview in c# 将字符串值与导入的Excel图纸单元格匹配 - Matching a string value to an imported excel sheet cell 给定单元格地址为= Sheet1:A1,如何获取值 - Given cell address as =Sheet1:A1, how to get the value 使用 C# 从打开的 Excel 工作表中获取当前单元格值 - Get current cell value from open Excel sheet using C# 如何使用C#获取保存在Excel工作表中的确切值? - How to get the exact value saved in Excel sheet using C#? 如何从excel单元格中获取完整值,而不是显示(舍入)值? - How to get the full value from an excel cell, not the displayed (rounded) value? 如何使用 Excel Interop 检索与基于引用另一个 Excel 工作表的公式的 Excel 单元格关联的值? - How can I retrieve the value associated with an Excel Cell that is based on a formula referencing another Excel Sheet using Excel Interop?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM