.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 ...
随机推荐
- C#串口通信
通过COM1发送数据,COM2接收数据.当COM2接收完本次发送的数据后,向COM1发送信息通知COM1本次数据已发完,COM1接到通知后,再发下一段数据.这样可以确保每次发送的数据都可以被正确接收. ...
- C#基础-replace()过滤非法字符
string FilterfileName(string strName) { string result=string.Empty ; if (string.IsNullOrWhiteSpace(s ...
- 提升VMware虚拟机性能招数
在VMware虚拟机(VMware Workstation或VMware Server)中我们可以同时运行多个Guest OS,当同时在同一Host OS中运行多台虚拟机时势必会严重影响到Host O ...
- 不可或缺 Windows Native (24) - C++: 运算符重载, 自定义类型转换
[源码下载] 不可或缺 Windows Native (24) - C++: 运算符重载, 自定义类型转换 作者:webabcd 介绍不可或缺 Windows Native 之 C++ 运算符重载 自 ...
- jquery属性选择器(匹配具有指定属性的元素)
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 算法:冒泡排序(python版)
1.将n个元素从大到小排序后,选择第k个大的元素 #!/usr/bin/env python #coding -*- utf:8 -*- #冒泡排序选第k个元素 import random impor ...
- Java面试题总结系列 Servlet
Servlet技术主要是为了使用Web上的HTTP协议而设计的.servlet是在WEB服务器上运行的程序.Java Servlet可以用于处理客户请求或生成动态Web网页.先一个实例.然后解释. 先 ...
- ahjesus 让我的MVC web API支持JsonP跨域
无数被跨域请求爆出翔来的人 遇到请求成功却不能进入success 总是提示parsererror 参考一下两篇文章吧 参考文章http://www.asp.net/web-api/overview/s ...
- 为mongodb数据库添加安全账户
最近的数据库服务器有些不稳定,遇到了黑客的骚扰,mongodb的安全存在一些漏洞.首要任务是给数据库添加账号.之前大家都习惯于mongodb的不加安全账号和密码来连接数据库,那么问题是添加了安全账户后 ...
- redis事务详解
mysql中也存在事务的概念.其实事务的定义是一样的.一组操作的集合,作为一个整体,要么全执行,要么全不执行. redis设置事务三步骤: 开始事务 :multi 操作加入事务队列 执行事务 :exe ...