create a new page, using OOoBasic/Draw/TableShape as a template.
Front page
Search
掲示板
Reload
Help
Browse Log
掲示板の使い方
OOo 掲示板3
OOo 掲示板2
OOo 掲示板
掲示板
雑談掲示板
New
List of pages
Recent changes
Backup
簡単ヘルプ
整形ルール
Start:
*表 [#ne635215]
OOo 3.0 から Draw および Impress で表が作成できるようにな...
#contents
**挿入 [#l7e60331]
ドキュメントの XMultiServiceFactory インターフェースから ...
Sub tableshape_1
oDoc = ThisComponent
oDrawPage = oDoc.getCurrentController().getCurrentPage()
oShape = oDoc.createInstance("com.sun.star.drawing.Tabl...
aPoint = CreateUnoStruct("com.sun.star.awt.Point")
aSize = CreateUnoStruct("com.sun.star.awt.Size")
aPoint.X = 1000
aPoint.Y = 1000
aSize.Width = 5000
aSize.Height = 5000
oShape.setPosition(aPoint)
oShape.setSize(aSize)
oDrawPage.add(oShape)
End Sub
削除、その他の操作は他の図形描写オブジェクトと同じように...
**表の操作 [#ge4e95fb]
挿入したすぐの表にはセルが一つしかありません。セルを追加...
oTable = oShape.Model
***列と行 [#we3deb64]
列コンテナと行コンテナ。Calc のシートなどと同じように操作...
***セルの挿入 [#bf06de52]
セルを挿入します。
列を挿入。
oColumns = oTable.getColumns()
oColumns.insertByIndex(0, 2)
行も同様に行えます。
***セルの削除 [#a647b9e3]
列を削除。指定したインデックスから個数分だけ列を削除しま...
oColumns.removeByIndex(1,1)
***セル [#u6aa59fa]
セルは Writer の表のセルと同じような操作が行えます。
oCell = oTable.getCellByPosition(0,1)
oCell.setString("cell 1")
** 表デザイン [#u6c96bbd]
表のデザインはスタイルで管理されています。GUI では表示さ...
追加したデザインは表デザイン一覧に表示されます。しかし、...
*** 表スタイルファミリ [#f4da9f28]
表デザインの各スタイルを定義します。
oDoc = ThisComponent
oStyleFamiles = oDoc.getStyleFamilies()
oTableStyles = oStyleFamilies.getByName("table")
各表スタイルは次のような要素を持ち、それぞれがセルスタイ...
|background|背景|
|body|一般セル|
|even-columns|偶数列|
|even-rows|偶数行|
|first-column|最初の列|
|first-row|最初の行|
|last-column|最初の行|
|last-row|最後の行|
|odd-columns|奇数列|
|odd-rows|奇数行|
新しいスタイルを作成するには次のようにします。
' create new style
sCustomStyle = "custom2"
oTableStyle = oTableStyles.createInstance()
oTableStyle.setName(sCustomStyle)
oTableStyles.insertByName(sCustomStyle, oTableStyle)
表のスタイルはドキュメント内で使用されていない場合にはフ...
*** セルスタイルファミリ [#o06ab7a9]
oCellStyles = oStyleFamilies.getByName("cell")
*** 例 [#c6f2e41a]
表デザインを追加します。背景、枠線を設定していますが枠線...
#code(basic){{
Sub ImpressTable
oDoc = ThisComponent
oStyleFamilies = oDoc.getStyleFamilies()
oCellStyles = oStyleFamilies.getByName("cell")
oTableStyles = oStyleFamilies.getByName("table")
' create new style
sCustomStyle = "custom2"
oTableStyle = oTableStyles.createInstance()
oTableStyle.setParentStyle("default")
oTableStyle.setName(sCustomStyle)
If oTableStyles.hasByName(sCustomStyle) Then
oTableStyles.replaceByName(sCustomStyle, oTableStyle)
Else
oTableStyles.insertByName(sCustomStyle, oTableStyle)
End If
oCellStyle = CreateCellStyle(oTableStyle, oCellStyles, ...
Array("FillColor", "LineColor", "LineWidth", "LineS...
Array(1234567, 0, 10, com.sun.star.drawing.LineStyl...
' set style
oPage = oDoc.getDrawPages().getByIndex(0)
oShape = oPage.getByIndex(0)
oShape.TableTemplate = oTableStyle
End Sub
Function CreateCellStyle( _
oTableStyle As Object, oCellStyles As Object, _
sStyleName As String, sCategory As String, _
sNames As Object, oValues As Object) As Object
oCellStyle = oCellStyles.createInstance()
oCellStyle.setParentStyle("default")
oCellStyle.setName(sStyleName)
For i = 0 To UBound(sNames) step 1
oCellStyle.setPropertyValue(sNames(i), oValues(i))
Next
If oCellStyles.hasByName(sStyleName) Then
oCellStyles.replaceByName(sStyleName, oCellStyle)
Else
oCellStyles.insertByName(sStyleName, oCellStyle)
End If
oTableStyle.replaceByName(sCategory, oCellStyle)
CreateCellStyle = oCellStyle
End Function
}}
End:
*表 [#ne635215]
OOo 3.0 から Draw および Impress で表が作成できるようにな...
#contents
**挿入 [#l7e60331]
ドキュメントの XMultiServiceFactory インターフェースから ...
Sub tableshape_1
oDoc = ThisComponent
oDrawPage = oDoc.getCurrentController().getCurrentPage()
oShape = oDoc.createInstance("com.sun.star.drawing.Tabl...
aPoint = CreateUnoStruct("com.sun.star.awt.Point")
aSize = CreateUnoStruct("com.sun.star.awt.Size")
aPoint.X = 1000
aPoint.Y = 1000
aSize.Width = 5000
aSize.Height = 5000
oShape.setPosition(aPoint)
oShape.setSize(aSize)
oDrawPage.add(oShape)
End Sub
削除、その他の操作は他の図形描写オブジェクトと同じように...
**表の操作 [#ge4e95fb]
挿入したすぐの表にはセルが一つしかありません。セルを追加...
oTable = oShape.Model
***列と行 [#we3deb64]
列コンテナと行コンテナ。Calc のシートなどと同じように操作...
***セルの挿入 [#bf06de52]
セルを挿入します。
列を挿入。
oColumns = oTable.getColumns()
oColumns.insertByIndex(0, 2)
行も同様に行えます。
***セルの削除 [#a647b9e3]
列を削除。指定したインデックスから個数分だけ列を削除しま...
oColumns.removeByIndex(1,1)
***セル [#u6aa59fa]
セルは Writer の表のセルと同じような操作が行えます。
oCell = oTable.getCellByPosition(0,1)
oCell.setString("cell 1")
** 表デザイン [#u6c96bbd]
表のデザインはスタイルで管理されています。GUI では表示さ...
追加したデザインは表デザイン一覧に表示されます。しかし、...
*** 表スタイルファミリ [#f4da9f28]
表デザインの各スタイルを定義します。
oDoc = ThisComponent
oStyleFamiles = oDoc.getStyleFamilies()
oTableStyles = oStyleFamilies.getByName("table")
各表スタイルは次のような要素を持ち、それぞれがセルスタイ...
|background|背景|
|body|一般セル|
|even-columns|偶数列|
|even-rows|偶数行|
|first-column|最初の列|
|first-row|最初の行|
|last-column|最初の行|
|last-row|最後の行|
|odd-columns|奇数列|
|odd-rows|奇数行|
新しいスタイルを作成するには次のようにします。
' create new style
sCustomStyle = "custom2"
oTableStyle = oTableStyles.createInstance()
oTableStyle.setName(sCustomStyle)
oTableStyles.insertByName(sCustomStyle, oTableStyle)
表のスタイルはドキュメント内で使用されていない場合にはフ...
*** セルスタイルファミリ [#o06ab7a9]
oCellStyles = oStyleFamilies.getByName("cell")
*** 例 [#c6f2e41a]
表デザインを追加します。背景、枠線を設定していますが枠線...
#code(basic){{
Sub ImpressTable
oDoc = ThisComponent
oStyleFamilies = oDoc.getStyleFamilies()
oCellStyles = oStyleFamilies.getByName("cell")
oTableStyles = oStyleFamilies.getByName("table")
' create new style
sCustomStyle = "custom2"
oTableStyle = oTableStyles.createInstance()
oTableStyle.setParentStyle("default")
oTableStyle.setName(sCustomStyle)
If oTableStyles.hasByName(sCustomStyle) Then
oTableStyles.replaceByName(sCustomStyle, oTableStyle)
Else
oTableStyles.insertByName(sCustomStyle, oTableStyle)
End If
oCellStyle = CreateCellStyle(oTableStyle, oCellStyles, ...
Array("FillColor", "LineColor", "LineWidth", "LineS...
Array(1234567, 0, 10, com.sun.star.drawing.LineStyl...
' set style
oPage = oDoc.getDrawPages().getByIndex(0)
oShape = oPage.getByIndex(0)
oShape.TableTemplate = oTableStyle
End Sub
Function CreateCellStyle( _
oTableStyle As Object, oCellStyles As Object, _
sStyleName As String, sCategory As String, _
sNames As Object, oValues As Object) As Object
oCellStyle = oCellStyles.createInstance()
oCellStyle.setParentStyle("default")
oCellStyle.setName(sStyleName)
For i = 0 To UBound(sNames) step 1
oCellStyle.setPropertyValue(sNames(i), oValues(i))
Next
If oCellStyles.hasByName(sStyleName) Then
oCellStyles.replaceByName(sStyleName, oCellStyle)
Else
oCellStyles.insertByName(sStyleName, oCellStyle)
End If
oTableStyle.replaceByName(sCategory, oCellStyle)
CreateCellStyle = oCellStyle
End Function
}}
Page: