[转载]: delphi中XLSReadWrite控件的使用(3)---基本应用
这是自带的一个例子,看懂这一点东西,基本的操作应该没问题了....
unit Main; interface uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XLSReadWriteII4, XLSFonts4, CellFormats4, BIFFRecsII4; type
TfrmMain = class(TForm)
Label1: TLabel;
Button1: TButton;
edFilename: TEdit;
Button2: TButton;
Button3: TButton;
dlgSave: TSaveDialog;
XLS: TXLSReadWriteII4;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
private
procedure AddFormats;
public
{ Public declarations }
end; var
frmMain: TfrmMain; implementation {$R *.dfm} procedure TfrmMain.AddFormats;
begin
(*Format a single cell*)
(* 显示字符串 *)
XLS.Sheets[].AsString[,] := 'Cell 1';
(* 字符串颜色 *)
XLS.Sheets[].Cell[,].FillPatternForeColor := xcYellow;
(* 字体 *)
XLS.Sheets[].Cell[,].FontStyle := [xfsBold,xfsItalic]; (*Format a number cell (3 decimals and thousand separator)
(* 格式化字符串,显示小数点后三位,千位和百位之间加个空格 *)
XLS.Sheets[].AsFloat[,] := 12335985394.895634;
XLS.Sheets[].Cell[,].NumberFormat := '# ##0.000'; (* Write a string cell. *)
XLS.Sheet[].AsStringRef['C2'] := 'Hello';
(* 单元格赋值 *)
(* Set the font size of the cells in the area.
(* 改变区域内的字体大小 *)
XLS.Sheet[].Range.Items[,,,].FontSize := ;
(* Set the color of the cells. *)
(* 设置区域的颜色 *)
XLS.Sheet[].Range.ItemsRef['B1:D4'].FillPatternForeColor := xcYellow;
(* Set a outline border. *)
(* 设置外框线的外形、颜色 *)
XLS.Sheet[].Range.ItemsRef['B1:D4'].BorderOutlineStyle := cbsThick;
(* Set color of the outline border. *)
XLS.Sheet[].Range.ItemsRef['B1:D4'].BorderOutlineColor := xcRed;
(* Make a copy of the cells. *)
(* 区域复制 *)
XLS.Sheet[].Range.ItemsRef['B1:D4'].Copy(,);
(* Move the cells. *)
(* 区域移动 *)
XLS.Sheet[].Range.ItemsRef['B1:D4'].Move(,);
end; procedure TfrmMain.Button1Click(Sender: TObject);
begin
AddFormats;
XLS.Filename := edFilename.Text;
(* 保存文件 *)
XLS.Write;
end; procedure TfrmMain.Button2Click(Sender: TObject);
begin
dlgSave.FileName := edFilename.Text;
if dlgSave.Execute then
edFilename.Text := dlgSave.FileName;
end; procedure TfrmMain.Button3Click(Sender: TObject);
begin
Close;
end; end.
转自:http://www.cnblogs.com/dabiao/archive/2011/07/08/2100613.html
[转载]: delphi中XLSReadWrite控件的使用(3)---基本应用的更多相关文章
- [转载]: delphi中XLSReadWrite控件的使用(1)---简介
XLSReadWrite控件简介: 一个你需要的,能在Delphi和.NET下访问Excel文件的完美解决方案. 一个经典的读写Excel的控件,对于使用Excel 开发很有帮助 官方网站: http ...
- [转载]: delphi中XLSReadWrite控件的使用(2)---delphi XE下安装
一.下载 官方下载网址: http://www.axolot.com/components/download.htm 从这里可以下载到从Delphi5到DelphiXE全部支持的版本. 二.软件安装 ...
- 转Delphi中XLSReadWrite控件的使用(1)---简介
XLSReadWrite控件简介: 一个你需要的,能在Delphi和.NET下访问Excel文件的完美解决方案. 一个经典的读写Excel的控件,对于使用Excel 开发很有帮助 官方网站: http ...
- 转 Delphi中XLSReadWrite控件的使用(2)---基本应用
unit Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ...
- 转Delphi中XLSReadWrite控件的使用(3) 读和写Excel
unit OpExcell; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Fo ...
- Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决
Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决 EmbeddedWBWebBrowserDelphi 最近用E ...
- Delphi中TxmlDocument控件的用法 转
Delphi中对XML文件的解析做的很好,比直接使用MS的MSXML2_TLB中的接口要方便很多,现称述于下面. 在讲之前先给出一个XML实例,在讲某些部分是要结合实例比较容易理解. 1<?xm ...
- delphi中panel控件应用
delphi中的panel控件是怎么使用的?研究了很久了,还是搞不懂,只知道把它放到form上面,其他操作一律不懂了,有谁可以请教一下,如何把其他控件放到里面去呢?谢谢 提问者采纳 直接把控件放到 ...
- delphi中DateTimePicker控件同时输入日期和时间
将DateTimePicker的Format属性中加入日期格式设成 'yyyy-MM-dd HH:mm',注意大小写 , 将kind设置为dtkTime即可,可以在每次Form onShow时将Dat ...
随机推荐
- UIlabel 属性text
UILabel *pLabel = [[UILabel alloc] initWithFrame:CGRectMake(0,100,200,100)]; pLabel.text = @"测试 ...
- BZOJ 3809 莫队+(分块|BIT)
#include <cstdio> #include <iostream> #include <cstring> #include <algorithm> ...
- codeforces 446B(优先队列)
题目链接:http://codeforces.com/problemset/problem/446/B #include<bits/stdc++.h> using namespace st ...
- Android FM模块学习之四源码学习(2)
前几章我们分析了FM模块的几个主要的类文件,今天要分析的是:FMTransceiver.java // 某些工程中名称为FMRadioService.java public class FmTra ...
- oracle 跨数据库取数据
思路:先从另一个数据库里把数据取出来, 然后,把这个数据集合解析,根据这个数据集合拆分组合成一个创建oralce临时表的方法及数据的插入.紧接着就可以写sql语句进行联合查询了. 下面是具体实例的方法 ...
- 使用STL离散化
把原来的数组a复制一份拷贝b 用sort先把数组a排序 用unique消除a里面重复的元素 对于b中的每一个元素,用lower_bound找到它在a中的位置,也就是离散化之后的编号. 没了. #inc ...
- jdbc 配置
jdbc 配置 Class.forName("com.mysql.jdbc.Driver") ;//加载数据库驱动 Connection conn=null; String ur ...
- 在HTML标签<a/>中调用javascript代码
<a/>标签的“href”属性可以是一个有效的URL,表示跳转的目的地,除此之外,href还可以是一段javascript代码.当为“href”设置javascript代码时,格式如下:& ...
- mac 下安装 lua5.3 + cjson
1.lua 5.3的安装 直接去官网下载 http://www.lua.org/ftp/lua-5.3.3.tar.gz make macosx sudo make install 2.CSJON 编 ...
- mysql操作汇集
1.修改root密码 cmd进如mysql的bin目录 >mysql -u root -p Enter password: ****** mysql> use mysql; mysql&g ...