create a new page, using OOoBasic/Writer/TableofContents as a template.
Front page
Search
掲示板
Reload
Help
Browse Log
掲示板の使い方
OOo 掲示板3
OOo 掲示板2
OOo 掲示板
掲示板
雑談掲示板
New
List of pages
Recent changes
Backup
簡単ヘルプ
整形ルール
Start:
*目次 [#f4bc2985]
目次はテキストコンテンツとして com.sun.star.text.ContentI...
#contents
**目次の挿入 [#h923f769]
com.sun.star.text.ContentIndex サービスをインスタンス化し...
Sub toc_1
oDoc = ThisComponent
oText = oDoc.getText()
oEnd = oText.getEnd()
oIndex = oDoc.createInstance("com.sun.star.text.Conten...
oIndex.CreateFromOutline = True
oText.insertTextContent(oEnd,oIndex,False)
oIndex.update()
End Sub
**目次の更新 [#ha4b2e60]
''update'' メソッドを呼び出します。
**目次の取得 [#ub1f0ebc]
ドキュメントに既存の目次があるときには DocumentIndexes プ...
Sub toc_4
oDoc = ThisComponent
oIndexes = oDoc.getDocumentIndexes()
For i = 0 To oIndexes.getCount() -1
oIndex = oIndexes.getByIndex(i)
If oIndex.ServiceName = "com.sun.star.text.ContentI...
'...
End If
Next i
End Sub
**目次エントリマーク [#ya39954a]
目次に項目を追加するときのエントリマークの挿入は、テキス...
Sub toc_5
oDoc = ThisComponent
oIndexes = oDoc.getDocumentIndexes()
oIndex = oIndexes.getByName("Table of Contents1")
oText = oDoc.getText()
oSelection = oDoc.getCurrentSelection()
If oSelection.Count = 1 Then
oEntry = oDoc.createInstance("com.sun.star.text.Cont...
oRange = oSelection.getByIndex(0)
oText.insertTextContent(oRange,oEntry,True)
End If
oIndex.update()
End Sub
エントリマークの項目を目次に表示したいときには ''CreateFr...
**プロパティ一覧 [#p4f2872f]
|プロパティ|型||
|BackColor|long|背景色|
|BackGraphicFilter|string|背景画像フィルター名|
|BackGraphicLocation|.style.GraphicLocation|背景画像配置|
|BackGraphicURL|string|背景画像 URL|
|BackTransparent|boolean|背景の透過|
|ContentSection|.text.XTextSection|コンテンツ部分のセクシ...
|CreateFromChapter|boolean|チャプタをコンテンツに|
|CreateFromLevelParagraphStyles|boolean|段落スタイルから...
|CreateFromMarks|boolean|コンテンツマークから作成|
|CreateFromOutline|boolean|アウトラインから作成|
|DocumentIndexMarks|[].text.XDocumentIndexMark|コンテンツ...
|HeaderSection|.text.XTextSection|目次ヘッダ部分のセクシ...
|IsProtected|boolean|保護する|
|IsRelativeTabstops|boolean|相対タブストップを利用|
|Level|short|レベル|
|LevelFormat|.container.XIndexReplace|レベルごとのフォー...
|LevelParagraphStyles|.container.XIndexReplace|レベルごと...
|Name|string|目次オブジェクト名|
|ParaStyleHeading|string|目次ヘッダスタイル名|
|ParaStyleLevel1|string|項目スタイル名|
|ParaStyleLevel10|string||
|ParaStyleLevel2|string||
|ParaStyleLevel3|string||
|ParaStyleLevel4|string||
|ParaStyleLevel5|string||
|ParaStyleLevel6|string||
|ParaStyleLevel7|string||
|ParaStyleLevel8|string||
|ParaStyleLevel9|string||
|TextColumns|.text.XTextColumns|列区切り列|
|Title|string|目次タイトル|
** その他のスタイルから [#w134f784]
その他のスタイルが指定された段落から目次の項目を追加しま...
Sub toc_5
oDoc = ThisComponent
oText = oDoc.getText()
oEnd = oText.getEnd()
oIndex = oDoc.createInstance("com.sun.star.text.Content...
oIndex.CreateFromOutline = True
oIndex.CreateFromLevelParagraphStyles = True
' Heading a スタイルを追加
oLevelParaStyles = oIndex.LevelParagraphStyles
oLevelParaStyles.replaceByIndex(1, Array("Heading a"))
oText.insertTextContent(oEnd,oIndex,False)
oIndex.update()
End Sub
** 項目の形式 [#me2ce9da]
各目次項目は LevelFormat プロパティからアクセスできるコン...
ダイアログで目次の項目を編集するときと同じ順序で項目を指...
項目は二つの要素で構成されており、一つは TokenType でその...
TokenType 項目の種類は com.sun.star.text.DocumentIndexLev...
|名前|説明|h
|TokenEntryNumber|章、セクション番号など|
|TokenEntryText|見出しのテキスト|
|TokenTabStop|タブ|
|TokenPageNumber|ページ番号|
|TokenText|テキスト|
|TokenHyperlinkStart|ハイパーリンク開始|
|TokenHyperlinkEnd|ハイパーリンク終了|
|TokenChapterInfo|章情報。表や図などの目次用。|
|TokenBibliographyDataField|参考文献データフィールド名|
TokenType が TokenTabStop のときには追加で次の項目を指定...
|名前|説明|h
|TabStopRightAligned|タブで右揃え|
|TabStopFillCharacter|タブとして埋める文字|
|WithTab|True のときタブを挿入|
TokenType が TokenEntryText のときには Text 項目で挿入す...
デフォルトの項目は次のような構成になっています。
'章番号 項目名 タブ(文字"."、右揃え) ページ番号
aFormat = Array( _
Array(mkPropertyValue("TokenType", "TokenEntryNumber")...
mkPropertyValue("CharacterStyleName", "")), _
Array(mkPropertyValue("TokenType", "TokenEntryText"), _
mkPropertyValue("CharacterStyleName", "")), _
Array(mkPropertyValue("TokenType", "TokenTabStop"), _
mkPropertyValue("TabStopRightAligned", True), _
mkPropertyValue("TabStopFillCharacter", "."), _
mkPropertyValue("WithTab", True), _
mkPropertyValue("CharacterStyleName", "")), _
Array(mkPropertyValue("TokenType", "TokenPageNumber"), _
mkPropertyValue("CharacterStyleName", "")) _
)
Function mkPropertyValue(sName, vValue) As com.sun.star....
v = CreateUnoStruct("com.sun.star.beasn.PropertyValue")
v.Name = sName
v.Value = vValue
mkPropertyValue = v
End Function
例えば、ハイパーリンクをページ番号の部分に設定するなら、T...
End:
*目次 [#f4bc2985]
目次はテキストコンテンツとして com.sun.star.text.ContentI...
#contents
**目次の挿入 [#h923f769]
com.sun.star.text.ContentIndex サービスをインスタンス化し...
Sub toc_1
oDoc = ThisComponent
oText = oDoc.getText()
oEnd = oText.getEnd()
oIndex = oDoc.createInstance("com.sun.star.text.Conten...
oIndex.CreateFromOutline = True
oText.insertTextContent(oEnd,oIndex,False)
oIndex.update()
End Sub
**目次の更新 [#ha4b2e60]
''update'' メソッドを呼び出します。
**目次の取得 [#ub1f0ebc]
ドキュメントに既存の目次があるときには DocumentIndexes プ...
Sub toc_4
oDoc = ThisComponent
oIndexes = oDoc.getDocumentIndexes()
For i = 0 To oIndexes.getCount() -1
oIndex = oIndexes.getByIndex(i)
If oIndex.ServiceName = "com.sun.star.text.ContentI...
'...
End If
Next i
End Sub
**目次エントリマーク [#ya39954a]
目次に項目を追加するときのエントリマークの挿入は、テキス...
Sub toc_5
oDoc = ThisComponent
oIndexes = oDoc.getDocumentIndexes()
oIndex = oIndexes.getByName("Table of Contents1")
oText = oDoc.getText()
oSelection = oDoc.getCurrentSelection()
If oSelection.Count = 1 Then
oEntry = oDoc.createInstance("com.sun.star.text.Cont...
oRange = oSelection.getByIndex(0)
oText.insertTextContent(oRange,oEntry,True)
End If
oIndex.update()
End Sub
エントリマークの項目を目次に表示したいときには ''CreateFr...
**プロパティ一覧 [#p4f2872f]
|プロパティ|型||
|BackColor|long|背景色|
|BackGraphicFilter|string|背景画像フィルター名|
|BackGraphicLocation|.style.GraphicLocation|背景画像配置|
|BackGraphicURL|string|背景画像 URL|
|BackTransparent|boolean|背景の透過|
|ContentSection|.text.XTextSection|コンテンツ部分のセクシ...
|CreateFromChapter|boolean|チャプタをコンテンツに|
|CreateFromLevelParagraphStyles|boolean|段落スタイルから...
|CreateFromMarks|boolean|コンテンツマークから作成|
|CreateFromOutline|boolean|アウトラインから作成|
|DocumentIndexMarks|[].text.XDocumentIndexMark|コンテンツ...
|HeaderSection|.text.XTextSection|目次ヘッダ部分のセクシ...
|IsProtected|boolean|保護する|
|IsRelativeTabstops|boolean|相対タブストップを利用|
|Level|short|レベル|
|LevelFormat|.container.XIndexReplace|レベルごとのフォー...
|LevelParagraphStyles|.container.XIndexReplace|レベルごと...
|Name|string|目次オブジェクト名|
|ParaStyleHeading|string|目次ヘッダスタイル名|
|ParaStyleLevel1|string|項目スタイル名|
|ParaStyleLevel10|string||
|ParaStyleLevel2|string||
|ParaStyleLevel3|string||
|ParaStyleLevel4|string||
|ParaStyleLevel5|string||
|ParaStyleLevel6|string||
|ParaStyleLevel7|string||
|ParaStyleLevel8|string||
|ParaStyleLevel9|string||
|TextColumns|.text.XTextColumns|列区切り列|
|Title|string|目次タイトル|
** その他のスタイルから [#w134f784]
その他のスタイルが指定された段落から目次の項目を追加しま...
Sub toc_5
oDoc = ThisComponent
oText = oDoc.getText()
oEnd = oText.getEnd()
oIndex = oDoc.createInstance("com.sun.star.text.Content...
oIndex.CreateFromOutline = True
oIndex.CreateFromLevelParagraphStyles = True
' Heading a スタイルを追加
oLevelParaStyles = oIndex.LevelParagraphStyles
oLevelParaStyles.replaceByIndex(1, Array("Heading a"))
oText.insertTextContent(oEnd,oIndex,False)
oIndex.update()
End Sub
** 項目の形式 [#me2ce9da]
各目次項目は LevelFormat プロパティからアクセスできるコン...
ダイアログで目次の項目を編集するときと同じ順序で項目を指...
項目は二つの要素で構成されており、一つは TokenType でその...
TokenType 項目の種類は com.sun.star.text.DocumentIndexLev...
|名前|説明|h
|TokenEntryNumber|章、セクション番号など|
|TokenEntryText|見出しのテキスト|
|TokenTabStop|タブ|
|TokenPageNumber|ページ番号|
|TokenText|テキスト|
|TokenHyperlinkStart|ハイパーリンク開始|
|TokenHyperlinkEnd|ハイパーリンク終了|
|TokenChapterInfo|章情報。表や図などの目次用。|
|TokenBibliographyDataField|参考文献データフィールド名|
TokenType が TokenTabStop のときには追加で次の項目を指定...
|名前|説明|h
|TabStopRightAligned|タブで右揃え|
|TabStopFillCharacter|タブとして埋める文字|
|WithTab|True のときタブを挿入|
TokenType が TokenEntryText のときには Text 項目で挿入す...
デフォルトの項目は次のような構成になっています。
'章番号 項目名 タブ(文字"."、右揃え) ページ番号
aFormat = Array( _
Array(mkPropertyValue("TokenType", "TokenEntryNumber")...
mkPropertyValue("CharacterStyleName", "")), _
Array(mkPropertyValue("TokenType", "TokenEntryText"), _
mkPropertyValue("CharacterStyleName", "")), _
Array(mkPropertyValue("TokenType", "TokenTabStop"), _
mkPropertyValue("TabStopRightAligned", True), _
mkPropertyValue("TabStopFillCharacter", "."), _
mkPropertyValue("WithTab", True), _
mkPropertyValue("CharacterStyleName", "")), _
Array(mkPropertyValue("TokenType", "TokenPageNumber"), _
mkPropertyValue("CharacterStyleName", "")) _
)
Function mkPropertyValue(sName, vValue) As com.sun.star....
v = CreateUnoStruct("com.sun.star.beasn.PropertyValue")
v.Name = sName
v.Value = vValue
mkPropertyValue = v
End Function
例えば、ハイパーリンクをページ番号の部分に設定するなら、T...
Page: