程序为:
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
AxCtrls, OleCtrls, TTF160_TLB, StdCtrls;
type
TForm1 = class(TForm)
F1BYzp: TF1Book;
Button1: TButton;
procedure Button1Click(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
nPages:integer;
{ Private declarations }
public
procedure CopyPage(nDstSheet,nSrcSheet,MaxRow,MaxCol:integer);
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.DFM}
procedure TForm1.CopyPage(nDstSheet, nSrcSheet, MaxRow, MaxCol: integer);
var
i:integer;
Height,Width:integer;
begin
F1BYzp.Sheet:=nSrcSheet;
F1BYzp.SetSelection(1,1,MaxRow,MaxCol);
F1BYzp.EditCopy;
F1BYzp.Sheet:=nDstSheet;
F1BYzp.SetSelection(1,1,MaxRow,MaxCol);
F1BYzp.EditPasteSpecial(F1PasteAll,F1PasteOpNone);
for i:=1 to MaxRowdo
begin
F1BYzp.Sheet:=nSrcSheet;
height:=F1BYzp.RowHeight;
F1BYzp.Sheet:=nDstSheet;
F1BYzp.RowHeight:=height;
end;
for i:=1 to MaxColdo
begin
F1BYzp.Sheet:=nSrcSheet;
width:=F1BYzp.ColWidth;
F1BYzp.Sheet:=nDstSheet;
F1BYzp.ColWidth:=width;
end;
F1BYzp.ShowRowHeading:=false;
F1BYzp.ShowColHeading:=false;
F1BYzp.ShowGridLines:=false;
F1BYzp.ShowSelections:=2;
F1BYzp.MaxCol:=MaxCol;
F1BYzp.MaxRow:=MaxRow;
end;
procedure TForm1.Button1Click(Sender: TObject);
var
nPageNow:integer;
//当前页
i,j:integer;
strTmp:string;
begin
inc(nPages);
//新建一页
F1BYzp.NumSheets:=nPages;
CopyPage(nPages,nPages-1,F1BYzp.MaxRow,F1BYzp.MaxCol);
F1BYzp.Sheet:=1;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
nPages:=1;
end;
end.