openoffice.org - 向宏中的单元格添加注释

标签 openoffice.org openoffice-calc

我想在宏中的单元格中添加注释。我试过录制一个宏来做到这一点,但它什么也没做。有任何想法吗?这是录制的宏的主要部分:

dim document   as object
dim dispatcher as object
document   = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
dispatcher.executeDispatch(document, ".uno:DrawEditNote", "", 0, Array())
rem dispatcher.executeDispatch(document, ".uno:InsertAnnotation", "", 0, Array())
dispatcher.executeDispatch(document, ".uno:DrawEditNote", "", 0, Array())
dim args4(0) as new com.sun.star.beans.PropertyValue
args4(0).Name = "ToPoint"
args4(0).Value = "$A$2"

dispatcher.executeDispatch(document, ".uno:GoToCell", "", 0, args4())

最佳答案

在 OpenOffice 中称为“插入注释”

' col, row - Zero-based
sub insertAnnotation(col, row, text)
    sheet = thiscomponent.getcurrentcontroller.activesheet
    cell = sheet.getCellByPosition(col, row) 
    sheet.Annotations.insertNew(cell.getCellAddress, text)
    cell.Annotation.isVisible = True
end sub

' row, col - Zero-based
sub removeAnnotation(col, row)
    sheet = thiscomponent.getcurrentcontroller.activesheet
    cell = sheet.getCellByPosition(col, row)
    cell.clearContents( com.sun.star.sheet.CellFlags.ANNOTATION )
end sub

insertAnnotation(2, 0, "Hello " & Now)

关于openoffice.org - 向宏中的单元格添加注释,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3219865/

相关文章:

java - 如何将外部文字处理应用程序与 Java Swing 应用程序集成?

java - 在 ODFToolkit 中将内容添加到 OpenOffice odp 演示文稿的框架

java - 如何知道 OpenOffice Calc UNO 对象支持的 Java 接口(interface)(通过 queryInterface)

openoffice-calc - 如何在 Openoffice Calc 中识别两列中的重复值

javascript - OpenOffice Calc Javascript 函数

delphi - OpenOffice DDE 执行失败

java - 使用 Open/LibreOffice 开始使用 UNO 和 Java

perl - 使用 OpenOffice::OODoc 传输表格样式

centos - CentOS 6 上的 Jodconverter - "failed to start and connect"

excel - 通过 vlookup 检测空白单元格