数字格式化在excel Vb.Net [英] Number Formatting in excel Vb.Net

查看:105
本文介绍了数字格式化在excel Vb.Net的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有人可以给我一些代码来将excel电子表格的单元格设置为最多使用2位小数的数字格式。或者它会更好的工作,我将数据更改为正确格式的单元格?这是一个正在进行的数据示例,现在它以字符串形式出现...
col(ADJ)ToString()其中col是DataTable oject。

解决方案

我不确定VB,但在C#中将是:

  worksheet.Cells [C3]。NumberFormat =0.00

或者

  worksheet.Cells [A:Z]。NumberFormat =0.00

  Range.NumberFormat = 0.00


Can someone give me some code to set the cell of an excel spreadsheet to a number format that use a max of 2 decimal places. Or would it work better it I change the data I am putting into the cell to a proper format? Here is a sample of data that is going in. Right now its going in as a string... col("ADJ").ToString() where col is a DataTable oject.

解决方案

I'm not sure about VB, but in C# it would be:

worksheet.Cells["C3"].NumberFormat = "0.00"

or

worksheet.Cells["A:Z"].NumberFormat = "0.00"

or

Range.NumberFormat = "0.00"

这篇关于数字格式化在excel Vb.Net的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆