在c#读取Excel 中,如果读取的数据位空,会报错不能直接转为string 类型
解决方法:
进行检查并转换数据
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text.RegularExpressions;
using System.Web;
namespace ATSalay.BLL
{
public class CheckValues
{
public static decimal CheckParseDecimeValues(object value) {
decimal decimalvalue = 0;
string values = value.ToString();
if (values == null || string.IsNullOrEmpty(values))
{
}
else {
Regex regex = new Regex(@"^([0-9][0-9]*)+(.[0-9]{0,})?$");
if (regex.I