首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 办公应用 > OFFICE教程 >

openoffice 在目前光标位置插入批注的宏

2012-09-07 
openoffice 在当前光标位置插入批注的宏REM*****BASIC*****sub MainoDoc ThisComponentDim vDoc, vViewC

openoffice 在当前光标位置插入批注的宏
REM  *****  BASIC  *****


sub Main

oDoc = ThisComponent
Dim vDoc, vViewCursor, oCurs, vTextField
Dim s$
'Lets lie and say that this was added ten days ago!
Dim aDate As New com.sun.star.util.Date
With aDate
.Day = Day(Now - 10)
.Month = Month(Now - 10)
.Year = Year(Now - 10)
End With
vDoc = ThisComponent
vViewCursor = vDoc.getCurrentController().getViewCursor()
oCurs=vDoc.getText().createTextCursorByRange(vViewCursor.getStart())
s = "com.sun.star.text.TextField.Annotation"
vTextField = vDoc.createInstance(s)
With vTextField
.Author = "cai"
.Content = "hello 老板 cai"
'Ommit the date and it defaults to today!
.Date = aDate
End With
vDoc.Text.insertTextContent(oCurs, vTextField, False)

end sub

热点排行