You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
60 lines
1.3 KiB
C#
60 lines
1.3 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace DS.Module.ExcelModule.Model
|
|
{
|
|
/// <summary>
|
|
/// 按自定义列导出Excel
|
|
/// </summary>
|
|
public class ExportByColumnReq
|
|
{
|
|
/// <summary>
|
|
/// 用户自定义列设置
|
|
/// </summary>
|
|
public List<UserColumnSet> ColumnSets { get; set; }
|
|
|
|
|
|
/// <summary>
|
|
/// Json数据
|
|
/// </summary>
|
|
public string JsonDataStr { get; set; }
|
|
}
|
|
|
|
public class exceldt
|
|
{
|
|
public DataTable dt { get; set; }
|
|
|
|
private int x偏差 = 0;
|
|
private int y偏差 = -1;
|
|
|
|
public exceldt(DataTable dt, bool NoTitile = false)
|
|
{
|
|
this.dt = dt;
|
|
if (NoTitile == true)
|
|
{
|
|
y偏差 = 0;
|
|
}
|
|
}
|
|
|
|
public string getValue(int y, int x)
|
|
{
|
|
DataRow dr = dt.Rows[y - 1 + y偏差];
|
|
|
|
return dr[x - 1 + x偏差].ToString();
|
|
}
|
|
|
|
public decimal? getdecimal(int y, int x)
|
|
{
|
|
var str = getValue(y, x);
|
|
|
|
if (string.IsNullOrWhiteSpace(str)) return null;
|
|
|
|
return decimal.Parse(str);
|
|
}
|
|
}
|
|
}
|