这是自带的一个例子,看懂这一点东西,基本的操作应该没问题了....

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)---基本应用的更多相关文章

  1. [转载]: delphi中XLSReadWrite控件的使用(1)---简介

    XLSReadWrite控件简介: 一个你需要的,能在Delphi和.NET下访问Excel文件的完美解决方案. 一个经典的读写Excel的控件,对于使用Excel 开发很有帮助 官方网站: http ...

  2. [转载]: delphi中XLSReadWrite控件的使用(2)---delphi XE下安装

    一.下载 官方下载网址: http://www.axolot.com/components/download.htm 从这里可以下载到从Delphi5到DelphiXE全部支持的版本. 二.软件安装 ...

  3. 转Delphi中XLSReadWrite控件的使用(1)---简介

    XLSReadWrite控件简介: 一个你需要的,能在Delphi和.NET下访问Excel文件的完美解决方案. 一个经典的读写Excel的控件,对于使用Excel 开发很有帮助 官方网站: http ...

  4. 转 Delphi中XLSReadWrite控件的使用(2)---基本应用

    unit Main; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, ...

  5. 转Delphi中XLSReadWrite控件的使用(3) 读和写Excel

    unit OpExcell; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Fo ...

  6. Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决

    Delphi中WebBrowser控件打开部分网站报"Invalid floating point operation”解决 EmbeddedWBWebBrowserDelphi  最近用E ...

  7. Delphi中TxmlDocument控件的用法 转

    Delphi中对XML文件的解析做的很好,比直接使用MS的MSXML2_TLB中的接口要方便很多,现称述于下面. 在讲之前先给出一个XML实例,在讲某些部分是要结合实例比较容易理解. 1<?xm ...

  8. delphi中panel控件应用

    delphi中的panel控件是怎么使用的?研究了很久了,还是搞不懂,只知道把它放到form上面,其他操作一律不懂了,有谁可以请教一下,如何把其他控件放到里面去呢?谢谢 提问者采纳   直接把控件放到 ...

  9. delphi中DateTimePicker控件同时输入日期和时间

    将DateTimePicker的Format属性中加入日期格式设成 'yyyy-MM-dd HH:mm',注意大小写 , 将kind设置为dtkTime即可,可以在每次Form onShow时将Dat ...

随机推荐

  1. Objective-C学习笔记-第一天(1)

    .h头文件,用于声明一些公开的属性.方法.头文件一般不会放太多的东西,没必要暴露太多接口,私有和封装. .m主文件,用于实现.h文件中的方法,以及一些其它的方法. -(返回值)方法名参数1名称:(参数 ...

  2. springmvc学习第二天

    一.pojo Spring mvc 会按请求参数名和pojo属性名进行自动匹配,自动为该对象填充属性值,并且支持级联属性 表单: <form action="springmvc/tes ...

  3. Linux的管道

    一.管道是什么? 管道,顾名思义就是个管子,里面可以流过去很多东西.举个栗子 ls | morels输出列出来的文件目录就通过‘|’这个管道流向了more这个文本浏览器.相同的功能我们也可以通过ls ...

  4. HDU 1829 分组并查集

    题意:有两种性别,每组数据表示是男女朋友,判断输入的几组数据是否有同性恋 思路:http://blog.csdn.net/iaccepted/article/details/24304087 分组并查 ...

  5. C# WinForm 应用程序 开启Console窗口

    /********************************************************************************* * C# WinForm 应用程序 ...

  6. UICollectionView 图片横向滑动居中偏移量的解决

    1.在使用UICollectionView 来显示横向滑动图片的时候,cell与cell之间有间隙,每次滑动后cell都会向左偏移,在使用过这两个方法才解决每次向左偏移的部分. 2.使用方法前不要开启 ...

  7. TYVJ 1074 武士风度的牛

    easy BFS 注意输入是反的就OK了 #include <cstdio> #include <iostream> #include <queue> using ...

  8. SQLite建表并添加数据

  9. JS正则表达式大全(整理详细且实用)

    JS正则表达式大全(整理详细且实用).需要的朋友可以过来参考下,希望对大家有所帮助!! 正则表达式中的特殊字符 字符 含意 \ 做为转意,即通常在"\"后面的字符不按原来意义解释, ...

  10. 5X + 2Y +Z = 50 的所有非负整数解

    这种题的解题方法都差不多,不停的循环,不过如果做一下细分,效率应该可以提升很多,下面把最常规效率也最低的代码贴上,有时间再优化 #include <iostream> using name ...