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;
戻る
安溪县|
新野县|
吐鲁番市|
芦山县|
新营市|
汶川县|
香格里拉县|
明水县|
夏邑县|
永吉县|
冷水江市|
彭山县|
黄龙县|
航空|
团风县|
蚌埠市|
临江市|
秦皇岛市|
长武县|
梁平县|
嘉祥县|
新田县|
东宁县|
台山市|
长宁县|
滁州市|
都安|
仙居县|
镇原县|
霍林郭勒市|
门源|
稷山县|
安义县|
小金县|
曲水县|
宜宾县|
封开县|
襄城县|
郯城县|
竹溪县|
建湖县|