目前已实现的功能:
1、可以指定Excel文件的读取位置;
2、读取Excel中各sheet名称;
3、可以预览各sheet的数据。
Todo:
1、如何将datatable另存为DBF文件;
2、另存DBF时如何指定各字段的类型和长度。
目前界面:
目前代码:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using NPOI;
using NPOI.SS.UserModel;
using NPOI.HSSF.UserModel;
using NPOI.XSSF.UserModel;
using System.IO;
using SocialExplorer.IO.FastDBF;
namespace demo
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
//============修正预览界面=======开始================
dataGridView1.AllowUserToAddRows = false;//禁止添加行
dataGridView1.AllowUserToDeleteRows = false;//禁止删除行
//设置SelectionMode属性为FullRowSelect使控件能够整行选择
dataGridView1.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
//============修正预览界面=======结束================
}
private void button1_Click(object sender, EventArgs e)
{
//============选择Excel文件=======开始================