怎么把这段代码转换成delphi语言(100分)

  • 主题发起人 主题发起人 sljfw
  • 开始时间 开始时间
S

sljfw

Unregistered / Unconfirmed
GUEST, unregistred user!
怎么把这段代码转换成delphi语言
Range("A1:A2").Select
With Selection
.HorizontalAlignment = xlGeneral
.VerticalAlignment = xlBottom
.WrapText = False
.Orientation = 0
.AddIndent = False
.ShrinkToFit = False
.MergeCells = True
End With
 
with selection do
begin
.....
end;
 
Range("A1:A2").Select这一句呢
 
Range("A1:A2").Select;
With Selection do
begin
HorizontalAlignment: = xlGeneral;
VerticalAlignment: = xlBottom;
WrapText := False;
Orientation := 0;
AddIndent := False;
ShrinkToFit := False;
MergeCells := True;
End ;
That's all.
 
其实最重要的是将第一句话转换为delphi可用的代码;
声明一个olevarinat型变量,将创建的ole对象所取是的范围赋值给此变量
再对此变量操作即可;

var
NewRange:OleVariant;
begin
NewRange:=ole对象.Range;
With NewRange do
begin
HorizontalAlignment: = xlGeneral;
VerticalAlignment: = xlBottom;
WrapText := False;
Orientation := 0;
AddIndent := False;
ShrinkToFit := False;
MergeCells := True;
End ;
end;
 
后退
顶部