VBA ==> Perl變換
戻る
-------------------------------------------------------------------------
Sub Macro2()
'
' Macro2 Macro
'
Range("E11:I11").Select
With Selection.Borders(xlEdgeBottom)
.LineStyle = xlDouble
.Weight = xlThick
.ColorIndex = xlAutomatic
End With
Selection.Borders(xlEdgeRight).LineStyle = xlNone
Selection.Borders(xlInsideVertical).LineStyle = xlNone
End Sub
----------------------------------->
$t{sheet}->Range("E11:I11")->Borders(xlEdgeBottom)->{LineStyle} = xlDouble;
-------------------------------------------------------------------------
安裝Microsoft的Microsoft Visual Basic
Microsoft Formsオブジェクトリファレンス
==>メソッド
==>Add
マルチ ページ コントロール、タブ ストリップ コントロールの場(chǎng)合
Set Object = object.Add( [ Name [, Caption [, index]]])
その他のコントロールの場(chǎng)合
Set Control = object.Add( ProgID [, Name [, Visible]])
-------------------------------------------------------------------------
$ex = Win32::OLE->new('Excel.Application') or die "oops\n";
-------------------------------------------------------------------------
$ex->Amethod("arg")->Bmethod->{'Property'} = "foo";
-------------------------------------------------------------------------
$ex->Cmethod(undef,undef,$Arg3);
-------------------------------------------------------------------------
# EXCELを起動(dòng)
$t{ex} = Win32::OLE->new('Excel.Application') or die "oops\n";
# 「xxへの変更を保存しますか?」が出ない
$t{ex}->{DisplayAlerts} = 'False';
$t{book} = $t{ex}->Workbooks->Add;
$t{sheet} = $t{book}->Worksheets(1);
$t{sheet}->Cells(2,2)->{Value} = "This is a dog.";
$t{sheet}->Cells(3,3)->{Value} = "That is alos a dog";
# $ex->Cmethod(undef,undef,$Arg3);
$t{book}->SaveAs("C:\\seki\\chubu\\jouetsu\\test\\ttt.xls");
#$t{ex}->{Visible} = 1; # 表示する
$t{ex}->quit();
-------------------------------------------------------------------------
$ex->Dmethod($RequiredArg1, {NamedArg1 => $Value1, NamedArg2 => $Value2}
-------------------------------------------------------------------------
# write a 2 rows by 3 columns range
$t{sheet}->Range("A8:C9")->{Value} = [[ undef, 'Xyzzy', 'Plugh'],
[ 42, 'Perl', 3.1415]];
# print
# |Xyzzy|Plugh|
# 42|Perl|3.1415|
$array = $t{sheet}->Range("A8:C9")->{Value};
for (@$array) {
for (@$_) {
print defined($_) ? "$_|" : "|";
}
print "\n";
}
-------------------------------------------------------------------------
use Win32::OLE::Enum;
----------------------------------------------------------------
# 追加BOOK
my $book = $excel->Workbooks->add() ;
#取得SHEET
my $sheet = $book->ActiveSheet;
#寫數(shù)據(jù)
$sheet->Range("B1")->{Value} = "OLE Sample" ;
#取得數(shù)據(jù)
my $data = $sheet->Range("B1")->{Value};
print "(" . $data . ")\r\n";
#取得數(shù)據(jù)
my $array = $sheet->Range("A1:C1")->{Value};
print "(" . $$array[0][1] . ")\r\n"; # @@$arrayの2次元配列
#指定顏色
$sheet->Range("A1")->Interior->{ColorIndex} = 6;
#指定顏色
$sheet->Range("A8:G8")->Interior->{ColorIndex} = 6;
#劃線
#Const xlContinuous = 1;
$sheet->Range("C2")->Borders(xlDiagonalUp)->{LineStyle} = 1;
$sheet->Range("C3")->Borders(xlDiagonalDown)->{LineStyle} = 1;
#改變寬度
$sheet->Columns("A:A")->{ColumnWidth} = 4.00;
#返回有效
$sheet->Range("A1")->{WrapText} = 1;
戻る
行唐县|
武山县|
太原市|
中山市|
云浮市|
乌兰浩特市|
孙吴县|
穆棱市|
乐都县|
龙南县|
临城县|
潜江市|
杭锦旗|
惠州市|
循化|
岢岚县|
祁连县|
稷山县|
重庆市|
崇礼县|
宣城市|
东兴市|
体育|
盘山县|
河池市|
泾川县|
兴隆县|
乌兰浩特市|
武鸣县|
湟中县|
珠海市|
宜丰县|
稷山县|
乌兰浩特市|
萍乡市|
乐昌市|
烟台市|
樟树市|
南京市|
依安县|
朝阳市|