|
发表于 2008-7-9 17:24:12
|
显示全部楼层
不会呀,代码如下
var
lCell: TSheetCell;
begin
//lstr:='aa';
// ASheet.RowHeights[0]:=0;
ASheet.Areas[0].Top:=ASheet.Areas[0].Top-2;
ASheet.Areas[0].PageHeaderRows := ASheet.Areas[0].PageHeaderRows+2;
ASheet.Areas[0].Bottom:=ASheet.Areas[0].Bottom+1;
ASheet.Areas[0].PageFooterRows:=ASheet.Areas[0].PageFooterRows+1;
//正标题
ASheet.CellTypes[ASheet.Areas[0].Left, 1] := TCellType.ctExpression;
lCell := ASheet.Cells[ASheet.Areas[0].Left, 1];
ASheet.RowHeights[1]:=30;
lCell.Font.Size := 14;
lCell.Width := ASheet.Areas[0].Right;
TExprCell(lCell).HorzAlign := THorzAlign.haCenter;
TExprCell(lCell).Expression.Text:='''aa''';//MakeExpressionText(0);
//副标题
//左
ASheet.CellTypes[ASheet.Areas[0].Left, 2] := TCellType.ctExpression;
lCell := ASheet.Cells[ASheet.Areas[0].Left, 2];
lCell.Font.Size := 10;
lCell.Width := 3;
TExprCell(lCell).HorzAlign := THorzAlign.haleft;
TExprCell(lCell).Expression.Text:='''bb''';//MakeExpressionText(1);
//右
ASheet.CellTypes[ASheet.Areas[0].Right-3, 2] := TCellType.ctExpression;
lCell := ASheet.Cells[ASheet.Areas[0].Right-3, 2];
lCell.Font.Size := 10;
lCell.Width := 3;
TExprCell(lCell).HorzAlign := THorzAlign.haRight;
TExprCell(lCell).Expression.Text:='''cc''';//MakeExpressionText(2);
//页尾1
//左
ASheet.CellTypes[ASheet.Areas[0].Left,ASheet.Areas[0].Bottom-1] := TCellType.ctExpression;
lCell := ASheet.Cells[ASheet.Areas[0].Left,ASheet.Areas[0].Bottom-1];
lCell.Font.Size := 10;
lCell.Width := 3;
TExprCell(lCell).HorzAlign := THorzAlign.haLeft;
TExprCell(lCell).Expression.Text:='''dd''';//MakeExpressionText(3);
//右
ASheet.CellTypes[ASheet.Areas[0].Right-3,ASheet.Areas[0].Bottom-1] := TCellType.ctExpression;
lCell:=ASheet.Cells[ASheet.Areas[0].Right-3,ASheet.Areas[0].Bottom-1];
lCell.Font.Size := 10;
lCell.Width := 3;
TExprCell(lCell).HorzAlign := THorzAlign.haRight;
TExprCell(lCell).Expression.Text:='''ee''';//MakeExpressionText(4);
end;
效果见附件
楼主,你帖进去测试看看,如果还是不行,请告知一下你的Stduio版本号,我看看是否是版本的问题
|
|