1、开发环境
以Delphi7为例,使用DevExpress套件中的ExpressSpreadSheet组件1.38版本进行开发设计。
2、控件安装
控件源码:
DevExpress.ExpressSpreadSheet.v1.38.for.Delphi.BCB.Full.Source-SSG.rar
这个源码在优快云上也有,请直接点击下面的超链接自行下载:
DevExpress.ExpressSpreadSheet.v1.38.for.Delphi.BCB源代码-Delphi文档类资源-优快云下载
请解压缩之后,按照如下控件包的顺序依次安装,并设置Delphi编译路径。
顺序 | 控件名称 | 操作 | 帮助文件 |
---|---|---|---|
1 | XP Theme Manager | 编译 | 无 |
2 | ExpressGDI+ Library | 编译 | 无 |
3 | ExpressLibrary | 编译+安装 | 有 |
4 | ExpressSpreadSheet | 编译+安装 | 有 |
其中帮助采用的还是比较原始的hlp格式,如果您的操作系统是win10/8/7等,只要出不来帮助,就请按照这个文章进行设置:
[]
3、控件使用
学习资料请参考https://blog.youkuaiyun.com/hotmee/article/category/5948851,这个大神写了几篇相关文章,不过都是C#的,需要自己研究对照。
<span style="color: red">最重要的学习资料就是控件源码路径下的帮助hlp文件,务必要详细阅读。</span>
3.1 合并单元格
var
st : TcxSSBookSheet;
r : TRect;
begin
st := book.Pages[0];
r.Left := 1; //第二列,0起始
r.Top := 1; //第二行
r.Right := 5; //第六列
r.Bottom := 2;//第三行
st.SetMergedState(r, True); //第二个参数true标识合并单元格
end;
3.2 单元格操作
var
st : TcxSSBookSheet;
cell1, cell2 : TcxSSCellObject;
begin
st := book.Pages[0];
cell1 := st.GetCellObject(0, 0); //A1
cell1.Text := '1';
cell1 := st.GetCellObject(1, 0); //B1
cell1.Text := '2';
cell1 := st.GetCellObject(2, 0); //C1
cell1.SetCellText('=A1+B1', True); //公式,第二个参数默认为False,如果为True可以重新计算
cell2 := st.GetCellObject(1, 1); //C2
cell2.SetCellText(cell1.Text); //TEXT方式获取到的是单元格的公式
cell2 := st.GetCellObject(1, 2); //C3
cell2.SetCellText(cell1.CellValue); //CellValue获取的是单元格的值
cell2 := st.GetCellObject(2, 2); //C3
cell2.SetCellText('杨雨田');
//画左右上下四条线
cell2.Style.Borders.Left.Style := lsMedium;
cell2.Style.Borders.Right.Style := lsThin;
cell2.Style.Borders.Top.Style := lsThick;
cell2.Style.Borders.Bottom.Style := lsDouble;
{
lsDefault, lsThin, lsMedium, lsDashed, lsDotted,
lsThick, lsDouble, lsHair, lsMediumDashed, lsDashDot, lsMediumDashDot,
lsDashDotDot, lsMediumDashDotDot, lsSlantedDashDot, lsNone
}
//设置背景色,前景色等
cell2.Style.Brush.AssignInfo(fsSolid, 2, 5);
//设置字体
cell2.Style.Font.AssignInfo('微软雅黑', 40, [fsBold], GB2312_CHARSET, 5);
//对齐
cell2.Style.HorzTextAlign := haRIGHT; {haGENERAL, haLEFT, haCENTER, haRIGHT, haFILL, haJUSTIFY}
cell2.Style.VertTextAlign := vaBOTTOM; {vaTOP, vaCENTER, vaBOTTOM, vaJUSTIFY}
//设置行高度
st.Rows.Size[0] := 120;
st.Rows.Size[1] := 80;
st.Rows.Size[2] := 150;
//设置列宽度
st.Cols.Size[0] := 120;
st.Cols.Size[1] := 80;
st.Cols.Size[2] := 200;
end;
3.3 加载EXCEL/保存EXCEL
begin
book.SaveToFile('e:\abc.xlsx'); //导出
book.LoadFromFile('e:\abc.xlsx'); //导入
end;
3.4 删除Sheet/增加Sheet
procedure Del()
begin
book.DeleteSheet(0);
end;
procedure Add()
begin
book.AddSheetPage('第一页' + FormatDateTime('yyyy-mm-dd hh:nn:ss', Now));
end;
3.5 关于打印
还没有找到好用的打印方法,暂时可以直接通过ShellExecute执行xls文件的print方法输出到打印机。
1.样式
procedure TForm1.Button1111Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
AColumn: TdxSpreadSheetTableColumn;
ARow: TdxSpreadSheetTableRow;
// ACell: TdxSpreadSheetCell;
begin
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
// Creating a column object corresponding to the third column (C)
// from the left border of the worksheet's table
AColumn := ATableView.Columns.CreateItem(2);
// Creating a row object corresponding to the third row
// from the top border of the worksheet's table
ARow := ATableView.Rows.CreateItem(2);
// Assigning the custom border settings to the C column
AColumn.Style.Borders[bLeft].Color := clBlue;
AColumn.Style.Borders[bLeft].Style := sscbsMediumDashDotDot;
AColumn.Style.Borders[bRight].Color := clBlue;
AColumn.Style.Borders[bRight].Style := sscbsMediumDashDotDot;
// Assigning the custom brush settings to all cells within the C column
AColumn.Style.Brush.Style := sscfsRevDiagonalStrip;
AColumn.Style.Brush.BackgroundColor := clHotLight;
AColumn.Style.Brush.ForegroundColor := clSkyBlue;
// Assigning the custom border settings to the third row
ARow.Style.Borders[bTop].Color := clBlue;
ARow.Style.Borders[bTop].Style := sscbsMediumDashDotDot;
ARow.Style.Borders[bBottom].Color := clBlue;
ARow.Style.Borders[bBottom].Style := sscbsMediumDashDotDot;
// Assigning the custom brush settings to all cells within the third row
ARow.Style.Brush.Style := sscfsRevDiagonalStrip;
ARow.Style.Brush.BackgroundColor := clHotLight;
ARow.Style.Brush.ForegroundColor := clSkyBlue;
//
// ACell.Style.Font.Color := clBlue;
// ACell.Style.Font.Name := 'Century Gothic';
// ACell.Style.Font.Size := 14;
// ACell.Style.Font.Style := [fsBold, fsUnderline];
end;
2.写入文字
procedure TForm1.Button2Click(Sender: TObject);
var
ACell: TdxSpreadSheetCell;
begin
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(1, 1);
ACell.SetText('www.devexpress.com');
end;
3.多单元格写入文字
procedure TForm1.Button3Click(Sender: TObject);
var
ACell: TdxSpreadSheetCell;
HAlign: TdxSpreadSheetDataAlignHorz;
VAlign: TdxSpreadSheetDataAlignVert;
I, J: Integer;
begin
I := 1;
J := 1;
for HAlign := ssahGeneral to ssahDistributed do
begin
for VAlign := ssavTop to ssavDistributed do
begin
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(I, J);
ACell.Style.AlignHorz := ssahGeneral;
ACell.Style.AlignHorz := HAlign;
ACell.Style.AlignVert := VAlign;
ACell.Style.Font.Name := '宋体';
ACell.SetText('这是开发者作程序测试时用的东东,也可以称之为彩蛋. ');
ACell.Style.WordWrap := True;
ACell.Column.Size := 120;
ACell.Row.Size := 120;
I := I + 1;
end;
J := J + 1;
I := 1;
end;
end;
4.插入单元格
procedure TForm1.Button4Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
begin
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
ATableView.InsertCells(Rect(1, 1, 1, 2), cmShiftCellsHorizontally);
end;
5.删除行
procedure TForm1.Button5Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
begin
// ...
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
ATableView.DeleteRows(1, 2);
end;
6.合并单元格
procedure TForm1.Button6Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
begin
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
ATableView.MergedCells.Add(Rect(1, 1, 2, 2));
end;
7.拆分选择的单元格
procedure TForm1.Button7Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
begin
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
ATableView.MergedCells.DeleteItemsInArea(ATableView.Selection.Area);
end;
8.清除选择单元格内容
procedure TForm1.Button8Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
begin
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
ATableView.ClearCells(ATableView.Selection.Area);
end;
9.对选择单元格内容排序
procedure TForm1.Button9Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
const
ASortOrder: array [1 .. 3] of TdxSortOrder = (soDescending, soAscending,
soAscending);
AColumns: array [1 .. 3] of Integer = (0, 1, 2);
begin
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
ATableView.SortByColumnValues(ATableView.Selection.Area, ASortOrder,
AColumns);
end;
10.删除列
procedure TForm1.Button10Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
begin
// ...
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
ATableView.DeleteColumns(2, 3);
end;
11.设置公式
procedure TForm1.Button11Click(Sender: TObject);
var
ASheet: TdxSpreadSheetTableView;
ACell: TdxSpreadSheetCell;
AArrayResultArea: TRect;
I, J: Integer; // 循环计数器
begin
// ...
ASheet := dxSpreadSheet1.ActiveSheetAsTable;
AArrayResultArea := Rect(4, 0, 6, 2);
// 定义存储计算结果数组的单元格范围。
// ...
Randomize();
for I := 0 to 5 do // 通过周期行
begin
for J := 0 to 2 do // Cycles through columns
begin
ACell := ASheet.CreateCell(I, J); // 创建单元格对象
ACell.AsVariant := random(1000);
// 将0到1000之间的随机值赋给一个新创建的单元格对象
end;
end;
// 指定数组公式的单元格区域
// ASheet.AddArrayFormula('=MMULT(A1:C3, A4:C6'), AArrayResultArea);
// ASheet.AddArrayFormula(;
ASheet.AddArrayFormula('=MMULT(A1:C3, A4:C6)', AArrayResultArea);
end;
12.导入图片
procedure TForm1.Button1Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
AContainer: TdxSpreadSheetPictureContainer;
AImage: TdxSmartImage;
OD1: TOpenDialog;
begin
OD1 := TOpenDialog.Create(self);
ATableView := TdxSpreadSheetTableView(dxSpreadSheet1.ActiveSheet);
if (OD1.Execute(Handle)) then
// 打开用于选择容器图像的对话框。
begin
ATableView.Containers.Add(TdxSpreadSheetPictureContainer);
// 创建图片容器
AContainer := TdxSpreadSheetPictureContainer(ATableView.Containers.Last);
AContainer.BeginUpdate;
AImage := TdxSmartImage.Create();
AImage.LoadFromFile(OD1.FileName); // 加载图像
AContainer.Picture.Image := AImage; // 将图像分配给容器
AImage.Free;
AContainer.AnchorType := catTwoCell;
AContainer.AnchorPoint1.Cell := ATableView.CreateCell(1, 1);
AContainer.AnchorPoint2.Cell := ATableView.CreateCell(20, 20);
AContainer.EndUpdate;
end;
end;
13.工作薄名称
procedure TForm1.Button12Click(Sender: TObject);
begin
dxSpreadSheet1.Sheets[0].Caption := '新的工作薄名称';
end;
14.导出图片
procedure TForm1.Button13Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
AContainer: TdxSpreadSheetPictureContainer;
AImage: TdxSmartImage;
begin
// AImage := TdxSmartImage.Create();
ATableView := TdxSpreadSheetTableView(dxSpreadSheet1.ActiveSheet);
AContainer := TdxSpreadSheetPictureContainer(ATableView.Containers.Last);
AContainer.AnchorType := catTwoCell;
// AContainer.AnchorPoint1.Cell := ATableView.CreateCell(1, 1);
// AContainer.AnchorPoint2.Cell := ATableView.CreateCell(20, 20);
AContainer.AnchorPoint1.Cell := ATableView.CreateCell(3, 2);
AContainer.AnchorPoint2.Cell := ATableView.CreateCell(3, 2);
AImage := AContainer.Picture.Image;
AImage.SaveToFile('d:\123.jpg');
end;
15.选择行
procedure TForm1.Button14Click(Sender: TObject);
begin
// dxSpreadSheet1.ActiveSheetAsTable.Selection.("A2").ColumnWith=100;
dxSpreadSheet1.ActiveSheetAsTable.Selection.SelectRows(1, 1);
dxSpreadSheet1.ActiveSheetAsTable.Selection.SelectRows(3, 4, [ssCtrl]);
end;
16.选择列
procedure TForm1.Button15Click(Sender: TObject);
begin
dxSpreadSheet1.ActiveSheetAsTable.Selection.SelectColumns(1, 1);
dxSpreadSheet1.ActiveSheetAsTable.Selection.SelectColumns(3, 4, [ssCtrl]);
end;
17.插入单元格
procedure TForm1.Button17Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
begin
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
ATableView.InsertCells(Rect(1, 1, 1, 2), cmShiftCellsVertically);
end;
18.改变字体
procedure TForm1.Button18Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
ACell: TdxSpreadSheetCell;
I, J, K: Integer; // Counters
begin
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
if (ATableView.Selection.Count > 0) then
begin
ATableView.BeginUpdate;
for I := 0 to ATableView.Selection.Count - 1 do
for J := ATableView.Selection.Items[I].Left to ATableView.Selection.Items
[I].Right do
for K := ATableView.Selection.Items[I].Top to ATableView.Selection.Items
[I].Bottom do
begin
ACell := ATableView.CreateCell(K, J);
ACell.Style.Font.Size := 11;
ACell.Style.Font.Name := '黑体';
ACell.Style.Font.Color := clBlue;
ACell.Style.Brush.BackgroundColor := clRed;
end;
ATableView.EndUpdate;
end;
end;
19.列宽
procedure TForm1.Button19Click(Sender: TObject);
begin
TdxSpreadSheetTableView(dxSpreadSheet1.Sheets[0])
.Options.DefaultColumnWidth := 50;
// TdxSpreadSheetTableView(dxSpreadSheet1.Sheets[1])
// .Options.DefaultColumnWidth := 100;
end;
20.行高
procedure TForm1.Button20Click(Sender: TObject);
begin
TdxSpreadSheetTableView(dxSpreadSheet1.Sheets[0])
.Options.DefaultRowHeight := 140;
// TdxSpreadSheetTableView(dxSpreadSheet1.Sheets[1]).Options.DefaultRowHeight := 10;
end;
21.单元格高和宽
procedure TForm1.Button21Click(Sender: TObject);
var
ACell: TdxSpreadSheetCell;
I, J: Integer;
begin
I := 2;
J := 2;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(I, J);
// ACell.Style.AlignHorz := ssahGeneral;
// ACell.Style.AlignHorz := HAlign;
// ACell.Style.AlignVert := VAlign;
// ACell.Style.Font.Name := '宋体';
// ACell.SetText('这是开发者作程序测试时用的东东,也可以称之为彩蛋. ');
// ACell.Style.WordWrap := True;
ACell.Column.Size := 100;
ACell.Row.Size := 40;
// I := I + 1;
// end;
// J := J + 1;
// I := 1;
// end;
end;
22边框
procedure TForm1.Button22Click(Sender: TObject);
var
ACell: TdxSpreadSheetCell;
begin
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(1, 5);
ACell.Style.Borders[bLeft].Color := clRed;
ACell.Style.Borders[bLeft].Style := sscbsDefault;
ACell.Style.Borders[bBottom].Color := clGreen;
ACell.Style.Borders[bBottom].Style := sscbsHair;
ACell.Style.Borders[bRight].Color := clYellow;
ACell.Style.Borders[bRight].Style := sscbsDotted;
ACell.Style.Borders[bTop].Color := clBlue;
ACell.Style.Borders[bTop].Style := sscbsDashDotDot;
ACell.Row.Size := 100;
// dxSpreadSheet1.ActiveSheetAsTable.Rows.DefaultSize := 40;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(3, 5);
ACell.Style.Borders[bLeft].Color := clRed;
ACell.Style.Borders[bLeft].Style := sscbsDashDot;
ACell.Style.Borders[bBottom].Color := clGreen;
ACell.Style.Borders[bBottom].Style := sscbsDashed;
ACell.Style.Borders[bRight].Color := clYellow;
ACell.Style.Borders[bRight].Style := sscbsThin;
ACell.Style.Borders[bTop].Color := clBlue;
ACell.Style.Borders[bTop].Style := sscbsMediumDashDotDot;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(5, 5);
ACell.Style.Borders[bLeft].Color := clRed;
ACell.Style.Borders[bLeft].Style := sscbsSlantedDashDot;
ACell.Style.Borders[bBottom].Color := clGreen;
ACell.Style.Borders[bBottom].Style := sscbsMediumDashDot;
ACell.Style.Borders[bRight].Color := clYellow;
ACell.Style.Borders[bRight].Style := sscbsMediumDashed;
ACell.Style.Borders[bTop].Color := clBlue;
ACell.Style.Borders[bTop].Style := sscbsMedium;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(7, 5);
ACell.Style.Borders[bLeft].Color := clRed;
ACell.Style.Borders[bLeft].Style := sscbsThick;
ACell.Style.Borders[bBottom].Color := clGreen;
ACell.Style.Borders[bBottom].Style := sscbsDouble;
ACell.Style.Borders[bRight].Color := clYellow;
ACell.Style.Borders[bRight].Style := sscbsNone;
ACell.Style.Borders[bTop].Color := clBlue;
ACell.Style.Borders[bTop].Style := sscbsDefault;;
end;
23单元格样式
procedure TForm1.Button24Click(Sender: TObject);
var
ACell: TdxSpreadSheetCell;
begin
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(1, 1);
ACell.Style.Brush.BackgroundColor := clBlue;
ACell.Style.Brush.ForegroundColor := clRed;
ACell.Style.Brush.Style := sscfsThinThickCrossHatch;
end;
24.插入工作薄
procedure TForm1.Button25Click(Sender: TObject);
begin
dxSpreadSheet1.AddSheet;
end;
25.清除所有工作蔳
procedure TForm1.Button26Click(Sender: TObject);
begin
dxSpreadSheet1.ClearAll;
end;
27.行高
procedure TForm1.Button27Click(Sender: TObject);
begin
dxSpreadSheet1.ActiveSheetAsTable.Rows.DefaultSize := 40;
end;
28.列宽
procedure TForm1.Button28Click(Sender: TObject);
begin
dxSpreadSheet1.ActiveSheetAsTable.Columns.DefaultSize := 40;
end;
29.格式样式
procedure TForm1.Button29Click(Sender: TObject);
var
ATableView: TdxSpreadSheetTableView;
ACell: TdxSpreadSheetCell;
begin
dxSpreadSheet1.ClearAll;
dxSpreadSheet1.AddSheet;
ATableView := dxSpreadSheet1.ActiveSheetAsTable;
ATableView.MergedCells.Add(Rect(0, 0, 5, 0));
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(0, 0);
ACell.SetText('2018年10月全区城乡居保养老金丧葬费补助金发放明细表');
ACell.Style.AlignHorz := ssahCenter;
ACell.Style.AlignVert := ssavCenter;
// ACell.Style.Borders[bTop].Style := sscbsSlantedDashDot;
ACell.Style.Borders[bTop].Style := sscbsNone;
ACell.Style.Borders[bLeft].Style := sscbsNone;
ACell.Style.Borders[bRight].Style := sscbsNone;
ACell.Style.Borders[bBottom].Style := sscbsNone;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(1, 0);
ACell.SetText('镇区');
ACell.Style.AlignHorz := ssahCenter;
ACell.Style.AlignVert := ssavCenter;
// ACell.Style.Borders[bTop].Style := sscbsSlantedDashDot;
ACell.Style.Borders[bTop].Style := sscbsThin;
ACell.Style.Borders[bLeft].Style := sscbsThin;
ACell.Style.Borders[bRight].Style := sscbsThin;
ACell.Style.Borders[bBottom].Style := sscbsThin;
ACell.Row.Size := 60;
ACell.Column.Size := 60;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(1, 1);
ACell.SetText('编号');
ACell.Style.AlignHorz := ssahCenter;
ACell.Style.AlignVert := ssavCenter;
ACell.Style.Borders[bTop].Style := sscbsThin;
ACell.Style.Borders[bLeft].Style := sscbsThin;
ACell.Style.Borders[bRight].Style := sscbsThin;
ACell.Style.Borders[bBottom].Style := sscbsThin;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(1, 2);
ACell.SetText('姓名');
ACell.Style.AlignHorz := ssahCenter;
ACell.Style.AlignVert := ssavCenter;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(1, 3);
ACell.SetText('身份证');
ACell.Style.AlignHorz := ssahCenter;
ACell.Style.AlignVert := ssavCenter;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(2, 3);
ACell.Style.AlignHorz := ssahCenter;
ACell.Style.AlignVert := ssavCenter;
ACell.Style.DataFormat.FormatCode := '@';
ACell.SetText('320961543254325432413');
// ACell.SetText('''' + '32096196506110413');
ACell.AsString;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(1, 4);
ACell.SetText('发放标准');
ACell.Style.AlignHorz := ssahCenter;
ACell.Style.AlignVert := ssavCenter;
ACell := dxSpreadSheet1.ActiveSheetAsTable.CreateCell(1, 5);
ACell.SetText('社保卡银行帐号');
ACell.Column.Size := 120;
ACell.Style.AlignHorz := ssahCenter;
ACell.Style.AlignVert := ssavCenter;
end;
30.打开电子表格
procedure TForm1.Button30Click(Sender: TObject);
var
qq: TOpenDialog;
begin
qq := TOpenDialog.Create(self);
try
if qq.Execute then
begin
dxSpreadSheet1.ClearAll;
dxSpreadSheet1.LoadFromFile(qq.FileName);
end;
finally
qq.Free;
end;
end;
31.打印
procedure TForm1.Button31Click(Sender: TObject);
begin
dxComponentPrinter1.ReportLink[0].Print(True, nil); // 打印对话框
// dxComponentPrinter1.ReportLink[0].Print(false, nil); // 直接打印
end;
32.储存电子表格
procedure TForm1.Button32Click(Sender: TObject);
var
qq: TSaveDialog;
begin
qq := TSaveDialog.Create(self);
try
qq.Filter := '电子表格|*.xls,*.xlsx';
qq.FileName := 'qwe';
if qq.Execute then
begin
dxSpreadSheet1.SaveToFile(qq.FileName + '.xls');
end;
finally
qq.Free;
end;
end;
33.选择单元格
procedure TForm1.Button33Click(Sender: TObject);
begin
dxSpreadSheet1.ActiveSheetAsTable.Selection.SelectCell(5, 5);
// dxSpreadSheet1.ActiveSheetAsTable.Selection.SelectAll;
end;
34.焦点
procedure TForm1.Button34Click(Sender: TObject);
begin
dxSpreadSheet1.ActiveSheetAsTable.Selection.SetFocused(10, 10, [ssPen]);
// ssShift, ssAlt, ssCtrl, ssLeft, ssRight, ssMiddle, ssDouble, ssTouch, ssPen, ssCommand, ssHorizontal
end;