我在OpenOffice中设置了一个模拟。我想显示模拟的结果,比如100次重复,但我似乎无法弄清楚如何做到这一点。显然,如果你只是将结果复制到一个单元格并将其向下拖动100行,它们都会显示相同的数字。
要么是宏,要么是内置方式。我都不知道。
答案 0 :(得分:-1)
我创建了一个宏:
Sub PasteSpecialNoFormula
dim args3(0) as new com.sun.star.beans.PropertyValue
args3(0).Name = "SelectedFormat"
args3(0).Value = 1
Dim document As Object
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
oDesktop = createUnoService("com.sun.star.frame.Desktop")
oDocument = ThisComponent
oSheet1 = oDocument.Sheets.getByIndex(0)
oSheet2 = oDocument.Sheets.getByIndex(0)
Dim i As Long, n As Long
n = 1000
for i = 1 to n
oFromRange = oSheet1.getCellRangeByName("B464:C464")
oToCell = oSheet2.getCellByPosition(1,466+i)
oDocument.CurrentController.Select(oFromRange)
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
oDocument.CurrentController.Select(oToCell)
dispatcher.executeDispatch(document, ".uno:ClipboardFormatItems", "", 0, args3())
next i
End Sub