OOobbs3/18
質問
お世話になります。 現在、OpenOffice.org BasicにてImpressにOutlinerShapeを追加させる下記code-1を作成しました。 ****** Code-1 ******* Sub oImpShape Dim oDoc Dim oDrawPage Dim oSize as new com.sun.star.awt.Size Dim oIShape oDoc = ThisComponent oDrawPage = oDoc.getDrawPages().getByIndex(0) ' oIShape = oDoc.createInstance("com.sun.star.presentation.OutlinerShape") ' oDrawPage.add(oIShape) End Sub ************************************ 作成されたOutlinerShapeを手動にてClickして文字を入力しますと自動的に箇条書き形式になります。(改行すると文頭に「・」が自動で付きます。) そこで、同じ操作をOOo Basicにて行うべく下記Code-2を実行しましたが、箇条書き形式での表示となりません。 ****** Code-2 ******* Sub oImpShape Dim oDoc Dim oDrawPage Dim oSize as new com.sun.star.awt.Size Dim oIShape oDoc = ThisComponent oDrawPage = oDoc.getDrawPages().getByIndex(0) ' oIShape = oDoc.createInstance("com.sun.star.presentation.OutlinerShape") ' oDrawPage.add(oIShape) oDisp = "Outliner-1" & Chr$(13) & "Outliner-2" oIshape.setString(oDisp) End Sub ********************************** つきましては、非常に初歩的な質問で恐縮ですが、OutlinerShapeへのText追加についてCodeをご教示頂けます様お願いします。 また、当方のOutlinerShapeの使い方が根本的に間違っているのであれば併せてご教示頂けます様お願いします。 [添付File] 05OutlinerShape00.png : Macro実行前の画面 05OutlinerShape00a.png : Code-1 Macro実行直後の画面 05OutlinerShape00b.png : 手動にてOutlinerShapeを選択直後の画面 05OutlinerShape00c.png : 手動にてText追加した画面(箇条書きになっている) 05OutlinerShape00d.png : Code-2 Macro実行後の画面(箇条書きになっていない) 回答
下記は一例です。段落の箇条書きに関するプロパティを設定します。 Sub SetTextInOutliner oDoc = ThisComponent oPage = oDoc.getDrawPages().getByIndex(0) oShape = oPage.getByIndex(2) If oShape.getShapeType() = "com.sun.star.presentation.OutlinerShape" Then oText = oShape.getText() aArg = CreateUnoStruct("com.sun.star.beans.PropertyValue") aArg.Name = "NumberingLevel" aArg.Value = 0 ' with bullet oText.appendParagraph(Array(aArg)) oText.insertString(oText.getEnd(), "Line 1", False) ' non outline aArg.Value = nothing oText.appendParagraph(Array(aArg)) oText.insertString(oText.getEnd(), "Line 2", False) End If End Sub サイトの容量が無いので画像は削除させてもらいました。
感想,コメント,メモ
|