[转载]: 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 ...
随机推荐
- HBase with MapReduce (Read and Write)
上面一篇文章仅仅是介绍如何通过mapReduce来对HBase进行读的过程,下面将要介绍的是利用mapreduce进行读写的过程,前面我们已经知道map实际上是读过程,reduce是写的过程,然而ma ...
- oracle 拼接一张表所有字段
declare t_name varchar2(100) := upper('dba_tab_columns'); cursor c_col is select column_name from db ...
- javaEE(web)SEO优化 Yahoo军规
javaEE(web)SEO优化 Yahoo军规 1.尽可能减少HTTP请求数2.使用CDN3.添加Expire/Cache-Control头4.启用Gzip压缩5.将CSS房在页面最上方6.将Scr ...
- Wampserver #1045 无法登录 mysql 服务器
一是通过phpMyAdmin直接修改: 二是使用WAMP的MySql控制台修改. 第一种: ①在phpMyAdmin界面中点击[用户],将用户概况中的所有用户名为[root] 用户的密码都改为 ...
- C++资料收集&整理
类别 地址 ZLib c++ zlib(qt)压缩与解压缩 STL STL学习之map容器(2)_insert Basic std::nothrow new (nothrow) T() 的原理 C++ ...
- (转) Deep learning architecture diagrams
FastML Machine learning made easy RSS Home Contents Popular Links Backgrounds About Deep learning ar ...
- MFC 线程使用
CWinThread* m_pthread; //多线程对象 struct param//参数传递结构体 { int id; TASK t[20]; }; CNB400Dlg::CNB400Dlg( ...
- Razor基础语法简介
http://blog.csdn.net/pasic/article/details/7072340 Razor的出现,使页面看起更加简洁,Razor的页面后缀为:.cshtml Razor基础语法: ...
- windbg
1, symbols : srv*c:\symbols*http://msdl.microsoft.com/download/symbols 2,.loadby sos mscorwks or ...
- HTTP Proxy Servlet 代理服务使用
java servlet 代理服务器 1. 使用 maven 依赖 <dependency> <groupId>org.mitre.dsmiley.httpproxy< ...