LibreOffice Shell関数でURLを指定してファイルマネージャーNemoを起動する実験 [LibreOffice Calc Basic]
LibreOffice Shell関数でURLを指定してファイルマネージャーNemoを起動する実験
OS LinuxMint19 cinnamon 64bit
LibreOffice6.2.2.2
Sub nemoOpen()
'URLを指定してファイルマネージャーNemoを起動する
shell ("nemo /home/telstar/ドキュメント/LibreOffice/bas",0)
End Sub
'URLを指定してファイルマネージャーNemoを起動する
shell ("nemo /home/telstar/ドキュメント/LibreOffice/bas",0)
End Sub
LibreOffice Calc セルの書式番号を調べる実験 [LibreOffice Calc Basic]
LibreOffice Calc セルの書式番号を調べる実験
OS LinuxMint19Cinnamon 64bit
LibreOffice6.2.2,2
選択セルの書式番号を調べる
Sub formatValue()
'
'選択セルの書式番号を調べる
'NumberFormat,value
'
msgbox ThisComponent.CurrentController.Selection.NumberFormat,value
End Sub
'
'選択セルの書式番号を調べる
'NumberFormat,value
'
msgbox ThisComponent.CurrentController.Selection.NumberFormat,value
End Sub
' [ Note ]
1) Standard = 0
{ 数字 }
2) 0 = 1
3) 0.00 = 2
4) #,##0 = 3
5) #,##0.00 = 4
6) #,###.00 = 5
{ Percent }
7) 0% = 10
8) 0.00% = 11
{ 通貨 }
9) [$¥-411]#,##0;-[$¥-411]#,##0 = 101
10) [$¥-411]#,##0.00;-[$¥-411]#,##0.00 = 103
11) [$¥-411]#,##0;[RED]-[$¥-411]#,##0 = 103
12) [$¥-411]#,##0.00;[RED]-[$¥-411]#,##0.00 = 104
13) [$¥-411]#,##0.--;[RED]-[$¥-411]#,##0.-- = 105
14) #,##0 [$JPY];[RED]-#,##0 [$JPY] = 110
15) ¥#,##0;-¥#,##0 = 111
16) ¥#,##0.00;-¥#,##0.00 = 20
17) ¥#,##0;[RED]-¥#,##0 = 21
18) ¥#,##0.00;[RED]-¥#,##0.00 = 22
19) #,##0 CCC = 24
20) ¥#,##0.--;[RED]-¥#,##0.-- = 25
{ 日付 }
21) YY/M/D = 30
22) YYYY年MM月DD日(AAAA) = 38
23) YY/MM/DD = 37
24) YYYY/MM/DD = 36
25) YY年M月D日 = 39
26) YYYY年M月D日 = 75
27) GGGE年M月D日 = 80
28) YYYY年M月D日 = 76
29) GGGE年M月D日(AAAA) = 81
30) YY年M月D日(AAA) = 77
31) GGGE年M月D日(AAA) = 31
32) YYYY年M月D日(AAA) = 78
33) YYYY年M月D日(AAAA) = 79
34) MM.DD = 82
35) GE.M.D = 83
36) YYYY-MM-DD = 84
37) YY/MM = 32
38) M月D日 = 33
39) M月 = 34
40) YY年 QQ = 35
41) WW = 85
{ 時刻 }
42) YY/MM/DD HH:MM = 50
43) YYYY/M/D H:MM = 51
44) H:MM = 40
45) HH:MM:SS = 41
46) AM/PM H:MM = 42
47) AM/PM H:MM:SS = 43
48) [HH]:MM:SS = 44
49) MM:SS.00 = 45
50) [HH]:MM:SS.00 = 46
51) YY/MM/DD HH:MM = 50
52) YYYY/M/D H:MM = 51
{ 指数 }
53) 0.00E+000 = 60
54) 0.00E+00 = 61
{ 分数 }
55) # ?/? = 70
56) # ??/?? = 71
{ プール値 }
57) BOOLEAN = 99
{ テキスト }
58) @ = 100
1) Standard = 0
{ 数字 }
2) 0 = 1
3) 0.00 = 2
4) #,##0 = 3
5) #,##0.00 = 4
6) #,###.00 = 5
{ Percent }
7) 0% = 10
8) 0.00% = 11
{ 通貨 }
9) [$¥-411]#,##0;-[$¥-411]#,##0 = 101
10) [$¥-411]#,##0.00;-[$¥-411]#,##0.00 = 103
11) [$¥-411]#,##0;[RED]-[$¥-411]#,##0 = 103
12) [$¥-411]#,##0.00;[RED]-[$¥-411]#,##0.00 = 104
13) [$¥-411]#,##0.--;[RED]-[$¥-411]#,##0.-- = 105
14) #,##0 [$JPY];[RED]-#,##0 [$JPY] = 110
15) ¥#,##0;-¥#,##0 = 111
16) ¥#,##0.00;-¥#,##0.00 = 20
17) ¥#,##0;[RED]-¥#,##0 = 21
18) ¥#,##0.00;[RED]-¥#,##0.00 = 22
19) #,##0 CCC = 24
20) ¥#,##0.--;[RED]-¥#,##0.-- = 25
{ 日付 }
21) YY/M/D = 30
22) YYYY年MM月DD日(AAAA) = 38
23) YY/MM/DD = 37
24) YYYY/MM/DD = 36
25) YY年M月D日 = 39
26) YYYY年M月D日 = 75
27) GGGE年M月D日 = 80
28) YYYY年M月D日 = 76
29) GGGE年M月D日(AAAA) = 81
30) YY年M月D日(AAA) = 77
31) GGGE年M月D日(AAA) = 31
32) YYYY年M月D日(AAA) = 78
33) YYYY年M月D日(AAAA) = 79
34) MM.DD = 82
35) GE.M.D = 83
36) YYYY-MM-DD = 84
37) YY/MM = 32
38) M月D日 = 33
39) M月 = 34
40) YY年 QQ = 35
41) WW = 85
{ 時刻 }
42) YY/MM/DD HH:MM = 50
43) YYYY/M/D H:MM = 51
44) H:MM = 40
45) HH:MM:SS = 41
46) AM/PM H:MM = 42
47) AM/PM H:MM:SS = 43
48) [HH]:MM:SS = 44
49) MM:SS.00 = 45
50) [HH]:MM:SS.00 = 46
51) YY/MM/DD HH:MM = 50
52) YYYY/M/D H:MM = 51
{ 指数 }
53) 0.00E+000 = 60
54) 0.00E+00 = 61
{ 分数 }
55) # ?/? = 70
56) # ??/?? = 71
{ プール値 }
57) BOOLEAN = 99
{ テキスト }
58) @ = 100
NumberFormatを設定する
sub test()
ThisComponent.CurrentController.Selection.NumberFormat=80
End Sub
LibreOffice Calc ユーザー定義関数の練習 [LibreOffice Calc Basic]
LibreOffice Calc ユーザー定義関数の練習
OS LinuxMint19sinnamon 64bit
LibreOffice6.2.0.3
上記のサイトを見て試してみた。
独自の関数を LibreOffice Calc で適用する
Basic-IDE で定義した関数 VOL(a; b; c)
は、LibreOffice Calc のほかの組み込み関数と同じ方法で使用できます。
- Calc ドキュメントを開いて、セル A1、B1、および C1 に関数の引数の数値である
a
、b
、およびc
を入力します。 - カーソルを別のセルに置き、次のように入力します:
=VOL(A1;B1;C1) - 関数が適用され、結果が選択したセルに表示されます。
LibreOffice Calc Basic GeneralFunction SUMで合計を計算する実験 [LibreOffice Calc Basic]
LibreOffice Calc Basic GeneralFunction SUMで合計を計算する実験
OS LinuxMint 19 Cinnamon 64bit
LibreOffice6.1.0.3
Sub GFSum()
'GeneralFunction.SUM
'
Dim oRange as Object
oRange = ThisComponent.Sheets(0).getCellRangeByName("A1:E5")
oSUM = oRange.computeFunction(com.sun.star.sheet.GeneralFunction.SUM )
msgbox oSUM
End Sub
'GeneralFunction.SUM
'
Dim oRange as Object
oRange = ThisComponent.Sheets(0).getCellRangeByName("A1:E5")
oSUM = oRange.computeFunction(com.sun.star.sheet.GeneralFunction.SUM )
msgbox oSUM
End Sub
GeneralFunction {
NONE, AUTO, SUM, COUNT,
AVERAGE, MAX, MIN, PRODUCT,
COUNTNUMS, STDEV, STDEVP, VAR,
VARP
}
NONE, AUTO, SUM, COUNT,
AVERAGE, MAX, MIN, PRODUCT,
COUNTNUMS, STDEV, STDEVP, VAR,
VARP
}
LibreOffice Calc 行と列を固定するマクロ、解除するマクロ [LibreOffice Calc Basic]
LibreOffice Calc 行と列を固定するマクロ、解除するマクロ
OS LinuxMint 19 cinnamon 64bit
LibreOffice 6.1.0.3
Sub Cell_Fixed()
'sheetの行と列の固定
'選択セルで固定
Dim oCol , oRow as Long
'行と列番号
oRow = ThisComponent.CurrentController.selection.CellAddress.Row
oCol = ThisComponent.CurrentController.Selection.CellAddress.column
'実行
ThisComponent.CurrentController.FreezeAtPosition(oCol , oRow)
End Sub
Sub fixed_kaijyo
'行と列の固定を解除
'
Dim oFrame as Object
Dim oDispatcher as Object
Dim oProp(0) as new com.sun.star.beans.PropertyValue
oFrame = ThisComponent.CurrentController.Frame
oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDispatcher.executeDispatch(oFrame, ".uno:FreezePanes", "", 0, oProp())
'
End Sub
'sheetの行と列の固定
'選択セルで固定
Dim oCol , oRow as Long
'行と列番号
oRow = ThisComponent.CurrentController.selection.CellAddress.Row
oCol = ThisComponent.CurrentController.Selection.CellAddress.column
'実行
ThisComponent.CurrentController.FreezeAtPosition(oCol , oRow)
End Sub
Sub fixed_kaijyo
'行と列の固定を解除
'
Dim oFrame as Object
Dim oDispatcher as Object
Dim oProp(0) as new com.sun.star.beans.PropertyValue
oFrame = ThisComponent.CurrentController.Frame
oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDispatcher.executeDispatch(oFrame, ".uno:FreezePanes", "", 0, oProp())
'
End Sub