.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语言学习008:标准错误
在上一节中的数据文件中(C语言学习007:重定向标准输入和输出),如果文件中的数据包含非法数据,如何让程序显示一条错误的提示消息呢?就需要用到标准错误 #include <stdio.h> ...
- ASP.NET MVC 使用Jquery Uploadify 在非IE浏览器下Http Error的解决方案
解决Uploadify上传控件在非IE浏览器中不工作,需要做如下2步修改: 1.Global.asax文件中,实现Application_BeginRequest函数: void Applicatio ...
- 代码生成工具Database2Sharp中增加视图的代码生成以及主从表界面生成功能
在代码生成工具的各种功能规划中,我们一向以客户的需求作为驱动,因此也会根据需要增加一些特殊的功能或者处理.在实际的开发中,虽然我们一般以具体的表进行具体业务开发,但是有些客户提出有时候视图开发也是很常 ...
- 【Java每日一题】20161125
package Nov2016; import java.util.LinkedList; import java.util.List; public class Ques1125 { public ...
- Redis配置集群一(window)
因为接下来的项目要使用到redis作为我们项目的缓存,所以就花了一天时间研究了一下redis的一些用法,因为没转linux虚拟机,所以就决定先研究一下windows版本的redis集群.主要是redi ...
- UVALive 4987---Evacuation Plan(区间DP)
题目链接 https://icpcarchive.ecs.baylor.edu/index.php?option=com_onlinejudge&Itemid=8&page=show_ ...
- JavaWeb前端基础复习笔记系列 一
课程:孔浩前端视频教程(CMS内容管理系统case) 1.背景知识 ASPCMS,是一个基于asp的CMS.类似于Jeecms是基于Java的.aspcms:http://www.aspcms.com ...
- Array数组基础
数组的定义 数组(array)是按次序排列的一组值,单个值称为元素,它们的位置都有编号(从0开始).整个数组用方括号表示. var arr = ['a', 'b', 'c']; 上面代码中的a.b.c ...
- <welcome-file-list>标签的控制作用以及在springmvc中此标签的的配置方式
我们在写安全性较高的网站时必然会对网站的入口进行限制, 而在这其中其关键作用的就是网站的根目录下WEB-INF中的web.xml中<welcome-file-list> <welc ...
- Android异步回调中的UI同步性问题
Android程序编码过程中,回调无处不在.从最常见的Activity生命周期回调开始,到BroadcastReceiver.Service以及Sqlite等.Activity.BroadcastRe ...