Hello,
I have the following code in a macro:
if chapters.getBoolean(6) then
args4(0).Name = "TableName"
args4(0).Value = "Tabel1"
args4(1).Name = "Columns"
args4(1).Value = 3
args4(2).Name = "Rows"
args4(2).Value = 2
args4(3).Name = "Flags"
args4(3).Value = 11
dispatcher.executeDispatch(document,
".uno:InsertTable", "", 0, args4())
args1(0).Name = "Text"
args1(0).Value = "Product"
dispatcher.executeDispatch(document,
".uno:InsertText", "", 0, args1())
dispatcher.executeDispatch(document,
".uno:JumpToNextCell", "", 0, Array())
args1(0).Name = "Text"
args1(0).Value = "Hoev."
dispatcher.executeDispatch(document,
".uno:InsertText", "", 0, args1())
dispatcher.executeDispatch(document,
".uno:JumpToNextCell", "", 0, Array())
args1(0).Name = "Text"
args1(0).Value = "Prijs"
dispatcher.executeDispatch(document,
".uno:InsertText", "", 0, args1())
sale_order_lines=DBsql4.executeQuery("SELECT name,
product_uom_qty, " + _
"(product_uom_qty *
price_unit) AS amount, " + _
"(SELECT seq_document from
product_product where product_product.id = sale_order_line.product_id)
AS seq " + _
" FROM sale_order_line WHERE "
+ _
"order_id = " + sale_order_id
+ " ORDER BY seq")
While sale_order_lines.next
naam=sale_order_lines.getString(1)
qty=sale_order_lines.getString(2)
amount=sale_order_lines.getString(3)
args1(0).Name = "Text"
args1(0).Value = naam
dispatcher.executeDispatch(document,
".uno:JumpToNextCell", "", 0, Array())
dispatcher.executeDispatch(document,
".uno:InsertText", "", 0, args1())
args1(0).Name = "Text"
args1(0).Value = qty
dispatcher.executeDispatch(document,
".uno:JumpToNextCell", "", 0, Array())
dispatcher.executeDispatch(document,
".uno:InsertText", "", 0, args1())
dispatcher.executeDispatch(document,
".uno:NumberFormatDecimal", "", 0, Array())
args1(0).Name = "Text"
args1(0).Value = amount
dispatcher.executeDispatch(document,
".uno:JumpToNextCell", "", 0, Array())
dispatcher.executeDispatch(document,
".uno:InsertText", "", 0, args1())
dispatcher.executeDispatch(document,
".uno:NumberFormatDecimal", "", 0, Array())
Wend
mCurs.gotoEnd(False)
end if
The result that I get is:
Does anybody have an idea why the dispatcher.executeDispatch(document,
".uno:JumpToNextCell", "", 0, Array()) is not working?
The crazy thing is that if I put a breakpoint on the first line of
this code, and go through it step by step, it works fine and I get :
Another strange thing is that the third column containing the price is
set to 0 while in the first screenprint, if you look closely at the
contents that is completely in the first cell, the prices are not 0 !!!
Any ideas please?
Thanks in advance for any help...
Greetings,
Alain