根据配置文件 将EXCEL中数据读入目标结构的DATASET,并对合并单元格作处理
1、类设计,EXCEL要据配置读入DATASET
using System;
using System.Data;
using System.Collections;
using System.Data.OleDb;
namespace HKH.Common
{
/// <summary>
/// 从Excel导入数据到DataSet,带有虚函数的基类
/// </summary>
/// <remarks>Create By Liwt on 2006 - 09 - 15
/// </remarks>
public class clsImportExcel
{
#region 变量
protected String m_MappingFile; //映射配置文件路径
protected String m_ExcelSheetName; //Excel中要导入数据的表名
protected String m_SqlTableName; //要导入的Sql表名,也可为其它类型的,如Oracle
protected ArrayList[] m_ColumnMapping; //列映射配置列表,包括3部分 0--Sql列名,1--Excel列索引
//2-- 如当前Excel行为空,是否赋值为上一行的值
private bool isLoadMapping;
#endregion
#region 构造函数
/// <summary>
/// 无参构造
/// </summary>
public clsImportExcel()
{
m_MappingFile = "";
m_ExcelSheetName = "";
isLoadMapping = false;
m_ColumnMapping = new ArrayList[3];
m_ColumnMapping[0] = new ArrayList();
m_ColumnMapping[1] = new ArrayList();
m_ColumnMapping[2] = new ArrayList();
}
/// <summary>
/// 构造函数重载
/// </summary>
/// <param name="mappingFilePath">映射配置文件路径</param>
/// <param name="excelSheetName">Excel中要导入数据的表名</param>
public clsImportExcel(String mappingFilePath, String excelSheetName)
{
m_MappingFile = mappingFilePath;
m_ExcelSheetName = excelSheetName;
isLoadMapping = false;
m_ColumnMapping = new ArrayList[3];
m_ColumnMapping[0] = new ArrayList();
m_ColumnMapping[1] =