* 番号付けスタイル [#w89c9e0c] 番号付け用スタイル。 #contents ** スタイルファミリ [#j8f7e477] 番号付けのスタイルファミリ名は NumberingStyles です。 oDoc = ThisComponent oStyleFamilies = oDoc.getStyleFamilies() oStyles = oStyleFamilies.getByName("NumberingStyles") ** スタイルと番号付け [#z2eec43e] スタイルファミリから取得した (または作成した後で追加済みの) スタイルの NumberingRules プロパティから番号付け 1-10 レベルにアクセスできます。 sName = "NewNumbering" If oStyles.hasByName(sName) Then oStyle = oStyles.getByName(sName) End If oRules = oStyle.NumberingRules oRule0 = oRules.getByIndex(0) ' レベル1 各レベル設定は com.sun.star.beans.PropertyValue の配列です。(UNO での型名は []com.sun.star.beans.PropertyValue) 各プロパティはを知るには配列から特定の要素を保持している構造体を検索しなければいけません。 プロパティは &idlref(com.sun.star.style.NumberingRule); のものを利用します。 ** プロパティ [#e326e1c4] |プロパティ|型|説明|h |IsAbsoluteMargins|boolean|余白を相対値にしない| |IsAutomatic|boolean|自動作成されたものかどうか| |IsContinuousNumbering|boolean|通し番号で| |NumberingIsOutline|boolean|アウトラインを利用| |DefaultListId|string|デフォルトの指定| ** NumberingRules プロパティ [#v916c15b] []com.sun.star.beans.PropertyValue *** 位置 [#i4dc1368] com.sun.star.text.NumberingLevel |プロパティ|型|説明|h |BulletChar|string|箇条書き文字| |BulletFont|com.sun.star.awt.FontDescriptor|フォント指定| |GraphicURL|string|画像 URL| |GraphicBitmap|com.sun.star.awt.XBitmap|画像指定| |GraphicSize|com.sun.star.awt.Size|画像サイズ| |VertOrient|short|画像配置 com.sun.star.text.VertOrientation| |プロパティ|型|説明|h |Adjust|short|番号の位置 css.text.HoriOrientation で指定| |ParentNumbering|short|| |ListtabStopPosition||タブストップ位置| |FirstLineIndent|long|最初の行のインデント位置| |IndentAt|long|インデント位置| |NumberingType|番号付け指定|com.sun.star.style.NumberingType| |LeftMargin|long|左余白| |SymbolTextDistance|long|テキストまでの間隔| *** オプション [#p3984e37] |プロパティ|型|説明|h |Prefix|string|接頭語| |Suffix|string|接尾語| |CharStyleName|string|文字のスタイル名| |StartWith|short|開始番号| |PositionAndSpaceMode|short|位置およびスペース指定 com.sun.star.text.PositionAndSpaceMode| |LabelFollowedBy|short|| ** 変更例 [#l6aef114] Sub ModifyNumberingStyle oDoc = ThisComponent oStyleFamilies = oDoc.getStyleFamilies() oStyles = oStyleFamilies.getByName("NumberingStyles") ' 番号付けスタイルを新しく作成。あればそれを利用 sName = "NewNumbering" If oStyles.hasByName(sName) Then oStyle = oStyles.getByName(sName) Else oStyle = oDoc.createInstance("com.sun.star.style.NumberingStyle") oStyles.insertByName(sName, oStyle) End If oRules = oStyle.NumberingRules oRule0 = oRules.getByIndex(0) n = FindItem(oRule0, "StartWith") ' 配列中での位置を検索 If n >= 0 Then oRule0(n).Value = 15 End If ' レベルの設定を置き換える oRules.replaceByIndex(0, oRule0) ' 反映させる oStyle.NumberingRules = oRules 'oStyles.replaceByName(sName, oStyle) End Sub ' 名前指定で配列中でのインデックスを取得 Function FindItem(aProps As Object, sName As String) Dim nFound As Integer nFound = -1 For i = 0 To UBound(aProps) step 1 If aProps(i).Name = sName Then nFound = i Exit For End If Next FindItem = nFound End Function |