转 Delphi中XLSReadWrite控件的使用(2)---基本应用
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[0].AsString[0,1] := 'Cell 1';
(* 字符串颜色 *)
XLS.Sheets[0].Cell[0,1].FillPatternForeColor := xcYellow;
(* 字体 *)
XLS.Sheets[0].Cell[0,1].FontStyle := [xfsBold,xfsItalic];
(*Format a number cell (3 decimals and thousand separator)
(* 格式化字符串,显示小数点后三位,千位和百位之间加个空格 *)
XLS.Sheets[0].AsFloat[0,0] := 12335985394.895634;
XLS.Sheets[0].Cell[0,0].NumberFormat := '# ##0.000';
(* Write a string cell. *)
XLS.Sheet[0].AsStringRef['C2'] := 'Hello';
(* 单元格赋值 *)
(* Set the font size of the cells in the area.
(* 改变区域内的字体大小 *)
XLS.Sheet[0].Range.Items[1,0,3,3].FontSize := 14;
(* Set the color of the cells. *)
(* 设置区域的颜色 *)
XLS.Sheet[0].Range.ItemsRef['B1:D4'].FillPatternForeColor := xcYellow;
(* Set a outline border. *)
(* 设置外框线的外形、颜色 *)
XLS.Sheet[0].Range.ItemsRef['B1:D4'].BorderOutlineStyle := cbsThick;
(* Set color of the outline border. *)
XLS.Sheet[0].Range.ItemsRef['B1:D4'].BorderOutlineColor := xcRed;
(* Make a copy of the cells. *)
(* 区域复制 *)
XLS.Sheet[0].Range.ItemsRef['B1:D4'].Copy(8,10);
(* Move the cells. *)
(* 区域移动 *)
XLS.Sheet[0].Range.ItemsRef['B1:D4'].Move(8,2);
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.
转 Delphi中XLSReadWrite控件的使用(2)---基本应用的更多相关文章
- [转载]: delphi中XLSReadWrite控件的使用(1)---简介
XLSReadWrite控件简介: 一个你需要的,能在Delphi和.NET下访问Excel文件的完美解决方案. 一个经典的读写Excel的控件,对于使用Excel 开发很有帮助 官方网站: http ...
- 转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控件的使用(3)---基本应用
这是自带的一个例子,看懂这一点东西,基本的操作应该没问题了.... unit Main; interface uses Windows, Messages, SysUtils, Variants, C ...
- 转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 ...
随机推荐
- build RTK on ubuntu 16.04
RTK-1.4.0 InsightToolkit-4.12.2 ./cmake/nvcc-check.cmake line:86 commentout as #message(FATAL_ERROR ...
- erlang配置三方库
暴力的: 直接下载解压以后放到erlang的lib目录,比如/usr/local/Cellar/erlang/17.3/lib/erlang/lib 和谐的: 在用户名下建立.erlang文件 在里面 ...
- PhysicalDrive
由于"\"是C/C+中转义符, "\\\\.\\"就相当于\\.\ 在Windows中 \\.\ 前缀用于标识设备,其中的"."表示本地计算 ...
- 【转】Jmeter在命令行运行技巧
For non-interactive testing, you may choose to run JMeter without the GUI. To do so, use the followi ...
- Unicode 和 UTF-8关系
unicode 就是 “与存储无关的表示”,utf—8 就是 “二进制表示”.一句话,utf8是对unicode字符集进行编码的一种编码方式,utf8是给unicode字符集加了一个存储类型前缀. u ...
- IDA Pro 权威指南学习笔记(七) - 其他 IDA 显示窗口
默认情况下 IDA 不会打开这些窗口,可通过 View -> Open Subviews 命令打开 Strings 窗口(Strings) Strings 窗口中显示的是从二进制文件中提取出的一 ...
- 易混淆的Window窗体与父窗体之间位置关系
假设有abc三个窗体,a是最外层窗体,b是a的子窗体,c是b的子窗体 c.Top,c.Left,c.Bottom,c.Location等都是相对于B的左上角点的,子窗体的位置点都是相对于父窗体而言的, ...
- 第十七章 MySQL Replication(待续)
··········
- Select/Poll/Epoll异步IO
IO多路复用 同步io和异步io,阻塞io和非阻塞io分别是什么,有什么样的区别? io模式 对于一次io 访问(以read为例),数据会先拷贝到操作系统内核的缓冲区,然后才会从操作系统内核的缓冲区拷 ...
- nginx keepalive 双机
Nginx+keepalived双机热备(主从模式) 负载均衡技术对于一个网站尤其是大型网站的web服务器集群来说是至关重要的!做好负载均衡架构,可以实现故障转移和高可用环境,避免单点故障,保证网 ...