0

我在 OpenOffice 中设置了一个模拟。我想显示模拟的结果,比如 100 次复制,但我似乎不知道该怎么做。显然,如果您只是将结果复制到一个单元格并将其向下拖动 100 行,它们都会显示相同的数字。

要么需要宏,要么有内置方式。我都不知道。

基本上相当于http://www.youtube.com/watch?v=tpIhQuxQeNs

4

1 回答 1

-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
于 2012-11-15T02:10:53.833 回答