.NET读写Excel工具Spire.XlS使用(DataExport )
Introduction
E-ICEBLUE is developing office.net component, the main products include Spire.Doc, Spire.PDF, Spire.XLS, Spire.presentation, office Spire and so on. It means that they are the word, PDF, Excel, PowerPoint, office development kit .With the help of those products, developers can essily handle office documents or develop their own applications on the .NET platform.
Product evaluation invitation
I am glad to receive this invitation today (2016/04/12). To be honest, it is the first time for me to do a testing on product even though my major is sofeware. Perhaps it is because of this, that I am determined to spare no effort in doing this test.
E-iceblue官网:http://www.e-iceblue.com/(冰蓝科技)。
Download & Installation
Download Link :http://www.e-iceblue.com/downloads/pack/spire.office_2.13.zip
Inatallation:
ICON:








Here I want to show you how to use the Spire.XLS to export data and import data.
Programming Guid
(1)Create a Project & Add Reference


(2)Using Namespace
In this project, I use the namespace as follows:
using System;
using System.Data.OleDb;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data; using Spire.Xls;
(3)Initialization Component
private void InitializeComponent()
{
this.btnRun = new System.Windows.Forms.Button();
this.btnAbout = new System.Windows.Forms.Button();
this.label1 = new System.Windows.Forms.Label();
this.dataGrid1 = new System.Windows.Forms.DataGrid();
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).BeginInit();
this.SuspendLayout();
//
// btnRun
//
this.btnRun.Location = new System.Drawing.Point(, );
this.btnRun.Name = "btnRun";
this.btnRun.Size = new System.Drawing.Size(, );
this.btnRun.TabIndex = ;
this.btnRun.Text = "Run";
this.btnRun.Click += new System.EventHandler(this.btnRun_Click);
//
// btnAbout
//
this.btnAbout.Location = new System.Drawing.Point(, );
this.btnAbout.Name = "btnAbout";
this.btnAbout.Size = new System.Drawing.Size(, );
this.btnAbout.TabIndex = ;
this.btnAbout.Text = "Close";
this.btnAbout.Click += new System.EventHandler(this.btnAbout_Click);
//
// label1
//
this.label1.Font = new System.Drawing.Font("Tahoma", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)()));
this.label1.Location = new System.Drawing.Point(, );
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(, );
this.label1.TabIndex = ;
this.label1.Text = "I am a Label , following is DataGrid,I will show you how to export data by Spire." +
"XLS";
//
// dataGrid1
//
this.dataGrid1.DataMember = "";
this.dataGrid1.HeaderForeColor = System.Drawing.SystemColors.ControlText;
this.dataGrid1.Location = new System.Drawing.Point(, );
this.dataGrid1.Name = "dataGrid1";
this.dataGrid1.ReadOnly = true;
this.dataGrid1.Size = new System.Drawing.Size(, );
this.dataGrid1.TabIndex = ;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(, );
this.ClientSize = new System.Drawing.Size(, );
this.Controls.Add(this.dataGrid1);
this.Controls.Add(this.label1);
this.Controls.Add(this.btnAbout);
this.Controls.Add(this.btnRun);
this.MaximizeBox = false;
this.MinimizeBox = false;
this.Name = "Form1";
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Spire.XLS sample";
((System.ComponentModel.ISupportInitialize)(this.dataGrid1)).EndInit();
this.ResumeLayout(false); }
(4)Clean up any resources being used (we can use it in other projects)
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
(5)Button Click
private void btnRun_Click(object sender, System.EventArgs e)
{
Workbook workbook = new Workbook(); workbook.LoadFromFile(@"e:\\我的课表.xls");
//Initailize worksheet
Worksheet sheet = workbook.Worksheets[]; this.dataGrid1.DataSource = sheet.ExportDataTable();
} private void btnAbout_Click(object sender, System.EventArgs e)
{
Close();
}
(6)Result


It's easy to use ,isn't it?
.NET读写Excel工具Spire.XlS使用(DataExport )的更多相关文章
- 【原创】.NET读写Excel工具Spire.Xls使用(1)入门介绍
在.NET平台,操作Excel文件是一个非常常用的需求,目前比较常规的方法有以下几种: 1.Office Com组件的方式:这个方式非常累人,微软的东西总是这么的复杂,使用起来可能非常不便,需要安装E ...
- 【原创】.NET读写Excel工具Spire.Xls使用(2)Excel文件的控制
本博客所有文章分类的总目录:http://www.cnblogs.com/asxinyu/p/4288836.html .NET读写Excel工具Spire.Xls使用文章 ...
- 【原创】.NET读写Excel工具Spire.Xls使用(3)单元格控制
本博客所有文章分类的总目录:http://www.cnblogs.com/asxinyu/p/4288836.html .NET读写Excel工具Spire.Xls使用文章 ...
- 【原创】.NET读写Excel工具Spire.Xls使用(4)对数据操作与控制
本博客所有文章分类的总目录:http://www.cnblogs.com/asxinyu/p/4288836.html .NET读写Excel工具Spire.Xls使用文章 ...
- 【原创】.NET读写Excel工具Spire.Xls使用(5)重量级的Excel图表功能
本博客所有文章分类的总目录:http://www.cnblogs.com/asxinyu/p/4288836.html .NET读写Excel工具Spire.Xls使用文章 ...
- .NET读写Excel工具Spire.Xls使用(1)入门介绍
原文:[原创].NET读写Excel工具Spire.Xls使用(1)入门介绍 在.NET平台,操作Excel文件是一个非常常用的需求,目前比较常规的方法有以下几种: 1.Office Com组件的方式 ...
- 【目录】C#操作Excel组件Spire.XLS系列文章目录
本博客所有文章分类的总目录链接:http://www.cnblogs.com/asxinyu/p/4288836.html 1.C#操作Excel组件Spire.XLS文章目录 1.[原创].NET读 ...
- NPOI写Excel,Spire.XLS for.NET组件转换Excel为PDF
首先要引用NPOI动态库和Microsoft.Office.Interop.excel.dll (Microsoft.Office.Interop.excel.dll 最好使用使用NuGet下载 , ...
- POI读取excel工具类(xls,xlsx通用)
package com.boot.utils; import java.io.File; import java.io.FileInputStream; import java.io.FileNotF ...
随机推荐
- Emit学习(2) - IL - 对象的创建过程
上一篇的介绍中, 并没有介绍到对象的创建过程, 这一篇主要就介绍一下, 对象的创建过程. 其实熟悉了IL语法之后, 完全可以用Reflector反编译代码去查看. 而且正因为有这个工具, 可以对照着R ...
- C#读取配置文件的几种方式
配置文件 <?xml version="1.0" encoding="utf-8" ?> <configuration> <con ...
- List<T>保存为XML文件
今天我们学习怎样把List<T>写成一个XML文件保存起来.因为我们在做动态网站开发时,需要对一些不太常变化的数据产生为XML文件,让程序直接去读取,而不是每次是SQL数据库取. 为了解决 ...
- 不可或缺 Windows Native (14) - C++: 文件
[源码下载] 不可或缺 Windows Native (14) - C++: 文件 作者:webabcd 介绍不可或缺 Windows Native 之 C++ 文件 示例CppIO2.h #prag ...
- Tigase XMPP Server的安装
Tigase和OpenFire都是基于XMPP(Extensible Messaging and Presence Protocol, 可扩展通讯和表示协议)的,主要功能是实现消息的即时通信.Goog ...
- SpringMVC框架介绍
1. SpringMVC通过一套MVC注解,让POJO成为处理请求的控制器,而无须实现任何接口. 2.支持REST风格的URL请求. 3.采用了松散耦合可插拔组件结构,比其他MVC框架更具扩展性和灵 ...
- python学习笔记3(元组、字典)
Python中有三种内置的数据类型.dictionary(字典).List(列表)和tuple(元组). 元组(tuple) 只读列表(列表的值可以修改,元组的不可以) 元组与列表类似,不同之处在于元 ...
- CGI与Servlet的比较
转自:http://www.maxhis.info/java/cgi-vs-servlet/ 谢! 概括来说,CGI和Servlet可以完成相同的功能. 一:CGI(Common Gateway In ...
- 模拟Executor策略的实现
Executor作为现在线程的一个管理工具,就像管理线程的管理器一样,不用像以前一样,通过start来开启线程 Executor将提交线程与执行线程分离开来,使得用户只需要提交线程,并不需要在乎怎么和 ...
- canvas滤镜-刮刮乐
<!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title> ...