如何控制Excel中页眉的字体?(0分)

  • 主题发起人 主题发起人 Jaline
  • 开始时间 开始时间
J

Jaline

Unregistered / Unconfirmed
GUEST, unregistred user!
如何控制Excel中页眉的字体?
录制的宏为:
With ActiveSheet.PageSetup
.PrintTitleRows = ""
.PrintTitleColumns = ""
End With
ActiveSheet.PageSetup.PrintArea = ""
With ActiveSheet.PageSetup
.LeftHeader = ""
.CenterHeader = "&""宋体,加粗""&14全国人大代表转交案件列表"
End With
End Sub
我想问delphi中如何用代码来控制页眉字体?
 
procedure TForm1.ExcelClick(Sender: TObject);
var
Temp_Worksheet: _WorkSheet;
begin
try
excelapplication.connect;
except
messagedlg('word may not be installed', mterror, [mbok], 0);
abort;
end;

ExcelWorkbook1.ConnectTo(ExcelApplication.Workbooks.Add(EmptyParam,0));

try
Temp_Worksheet := ExcelWorkbook1.WorkSheets.Add( EmptyParam, EmptyParam,EmptyParam,EmptyParam, 0 ) as _WorkSheet;
ExcelWorksheet1.ConnectTo( Temp_Worksheet );
except
messagedlg('word may not be installed', mterror, [mbok], 0);
abort;
end;

excelapplication.Visible[0] := true;

end;

procedure TForm1.ExcelFontClick(Sender: TObject);
begin
ExcelWorksheet1.PageSetup.PrintTitleRows := '';
ExcelWorksheet1.PageSetup.PrintTitleColumns := '';
ExcelWorksheet1.PageSetup.PrintArea := '';
ExcelWorksheet1.PageSetup.LeftHeader := '';
ExcelWorksheet1.PageSetup.CenterHeader := '&' + '"' + '宋体,加粗' + '"' + '&14全国人大代表转交案件列表';
end;

搞定了,试试吧! [:)]
 
后退
顶部