*ヘッダとフッタ [#kf592dd6] ヘッダとフッタにはページのスタイルからアクセスします。ヘッダおよびフッタのテキストに関しても同様です。 #contents **設定 [#j979b3c6] Dim oDoc As Object Dim oStyleFamilies As Object Dim oPageStyles As Object Dim oStyle As Object oDoc = ThisComponent oStyleFamilies = oDoc.getStyleFamilies() oPageStyles = oStyleFamilies.getByName("PageStyles") oStyle = oPageStyles.getByIndex("Standard") まずは,ヘッダとフッタを利用するかどうかを指定するプロパティを true にしてヘッダおよびフッタを利用します。 boolean FooterIsOn boolean HeaderIsOn また,ヘッダとフッタは右ページと左ページの区別があるときには別々の内容にすることができます。その右ページと左ページの内容同じにするかどうかを指定するプロパティがあります。ture にすると右ページと左ページのフッタおよびヘッダの内容が同じになります。 boolean FooterIsShared boolean HeaderIsShared 実際のヘッダとフッタのないように関しては,FooterText プロパティもしくは HeaderText プロパティからアクセスします。これらのプロパティから取得できるオブジェクトの取り扱い方はテキストオブジェクトと同じです。また,右ページと左ページが違う場合のためにそれぞれ違うプロパティがあります。 boolean /void FooterText boolean /void FooterTextLeft boolean /void FooterTextRight boolean /void HeaderText boolean /void HeaderTextLeft boolean /void HeaderTextRight **書式設定 [#zce40b05] フッタとヘッダの書式設定に関しては,段落の書式設定と同様です。 ***ヘッダ [#wfa95362] ヘッダ用のプロパティです。 |プロパティ|型|説明| |HeaderBackColor|long|ヘッダの背景色| |HeaderBackGraphicFilter|string|ヘッダの背景画像フィルター名| |HeaderBackGraphicLocation|.style.GraphicLocation|ヘッダの背景画像配置| |HeaderBackGraphicURL|string|ヘッダの背景画像 URL| |HeaderBackTransparent|boolean|ヘッダの背景色が透明かどうか| |HeaderBodyDistance|long|ヘッダの背景色| |HeaderBorderDistance|long|ヘッダの配置間隔| |HeaderBottomBorder|.table.BorderLine|ヘッダ外枠の間隔| |HeaderBottomBorderDistance|long|ヘッダの下枠線| |HeaderDynamicSpacing|boolean|ヘッダの下枠線の間隔| |HeaderHeight|long|ヘッダの高さを自動調節するかどうか| |HeaderIsDynamicHeight|boolean|ヘッダの高さ| |HeaderIsOn|boolean|ヘッダの高さを自動調節するかどうか| |HeaderIsShared|boolean|ヘッダを付けるかどうか| |HeaderLeftBorder|.table.BorderLine|ヘッダを左右同じ内容にするかどうか| |HeaderLeftBorderDistance|long|ヘッダの左枠線| |HeaderLeftMargin|long|ヘッダの左枠線間隔| |HeaderRightBorder|.table.BorderLine|ヘッダの左余白| |HeaderRightBorderDistance|long|ヘッダを付けるかどうか| |HeaderRightMargin|long|ヘッダの右枠線| |HeaderShadowFormat|.table.ShadowFormat|ヘッダの右枠線間隔| |HeaderText|.text.XText|ヘッダの右余白| |HeaderTextLeft|.text.XText|ヘッダの影| |HeaderTextRight|.text.XText|ヘッダを左右同じ内容にするかどうか| |HeaderTopBorder|.table.BorderLine|ヘッダの上枠線| |HeaderTopBorderDistance|long|ヘッダの上枠線間隔| ***フッタ [#f7d50456] フッタ用のプロパティです。 |プロパティ|型|説明| |FooterBackColor|long|フッタの背景色| |FooterBackGraphicFilter|string|フッタの背景画像フィルター名| |FooterBackGraphicLocation|.style.GraphicLocation|フッタの背景画像配置| |FooterBackGraphicURL|string|フッタの背景画像 URL| |FooterBackTransparent|boolean|フッタの背景色が透明かどうか| |FooterBodyDistance|long|フッタの背景色| |FooterBorderDistance|long|フッタの配置間隔| |FooterBottomBorder|.table.BorderLine|フッタ外枠の間隔| |FooterBottomBorderDistance|long|フッタの下枠線| |FooterDynamicSpacing|boolean|フッタの下枠線の間隔| |FooterHeight|long|フッタの高さを自動調節するかどうか| |FooterIsDynamicHeight|boolean|フッタの高さ| |FooterIsOn|boolean|フッタの高さを自動調節するかどうか| |FooterIsShared|boolean|フッタを付けるかどうか| |FooterLeftBorder|.table.BorderLine|フッタを左右同じ内容にするかどうか| |FooterLeftBorderDistance|long|フッタの左枠線| |FooterLeftMargin|long|フッタの左枠線間隔| |FooterRightBorder|.table.BorderLine|フッタの左余白| |FooterRightBorderDistance|long|フッタを付けるかどうか| |FooterRightMargin|long|フッタの右枠線| |FooterShadowFormat|.table.ShadowFormat|フッタの右枠線間隔| |FooterText|.text.XText|フッタの右余白| |FooterTextLeft|.text.XText|フッタの影| |FooterTextRight|.text.XText|フッタを左右同じ内容にするかどうか| |FooterTopBorder|.table.BorderLine|フッタの上枠線| |FooterTopBorderDistance|long|フッタの上枠線間隔| ** 例 [#w257b6f9] ヘッダやフッタを使用する例。 *** ヘッダに画像を挿入する [#m5c928ef] 標準のページスタイルのヘッダをオンにして画像を挿入します。アンカーの種類を AS_CHARACTER などにするといいかもしれません。 #code(ob){{ Sub header_example_1 oDoc = ThisComponent oSFs = oDoc.getStyleFamilies() oPageStyles = oSFs.getByName("PageStyles") oPageStyle = oPageStyles.getByName("Standard") oImage = oDoc.createInstance("com.sun.star.text.TextGraphicObject") oImage.GraphicURL = "file:///C:/usr/selection_16.bmp" Dim aSize As New com.sun.star.awt.Size aSize.Width = 1000 aSize.Height = 1000 oImage.Size = aSize With oPageStyle .HeaderIsOn = True oHeaderText = .HeaderText End With oCursor = oHeaderText.createTextCursor() oHeaderText.insertTextContent(oCursor, oImage, False) oImage.AnchorType = com.sun.star.text.TextContentAnchorType.AS_CHARACTER End Sub }} ** ヘッダにビューカーソルを移動させる [#b5b06bb3] #code(basic){{ sub MoveCursorToHeader oDoc = ThisComponent oViewCursor = oDoc.getCurrentController().getViewCursor() oStyleFamilies = oDoc.getStyleFamilies() oStyle = oStyleFamilies.getByName("PageStyles").getByName("Standard") oHeaderText = oStyle.HeaderText oViewCursor.gotoRange(oHeaderText, False) end sub }} |