Apache OpenOffice (AOO) Bugzilla – Issue 56400
Macro recorder For Inserting New Sheet Doesn't Work Always
Last modified: 2013-08-07 15:12:27 UTC
I used the Record Macro function to record a macro for inserting a new sheet into an existing spreadsheet. See below for the macro code that was generated. This code works fine if the spreadsheet contains 2 or more sheets. If the spreadsheet contains only 1 sheet, then this code fails without giving an error message. Here is the generated code: sub InsertSheet rem ---------------------------------------------------------------------- rem define variables dim document as object dim dispatcher as object rem ---------------------------------------------------------------------- rem get access to the document document = ThisComponent.CurrentController.Frame dispatcher = createUnoService("com.sun.star.frame.DispatchHelper") rem ---------------------------------------------------------------------- dim args1(1) as new com.sun.star.beans.PropertyValue args1(0).Name = "Name" args1(0).Value = "Sheet2" args1(1).Name = "Index" args1(1).Value = 2 dispatcher.executeDispatch(document, ".uno:Insert", "", 0, args1()) end sub
Hi Joerg, please have a look at this Issue. Frank
Can confirm that no error message is issued if running the code (OOo2 Linux). Of course code is wrong in that test case: if only one sheet is present args1(1).Value should be 1. So the dispatcher call should return a "index used out of bounds" error message.
Hi mrtea, i confirm the issue - partly. The macro is recorded in a way that it tries to insert a new Shet before Sheet2 which does not exist, resulting in failure. Change args1(1).Name = "Index" args1(1).Value = 2 to args1(1).Name = "Index" args1(1).Value = 1 and it will work as expected. There is a problem that the macro recorder does not record whether the new table is to be created infront or behind the currently selected table. However, neither of this worked in StarOffice 5.2 or any other version. Without the regression flag i can only make this a RFE with target OOo Later
To grep the issues easier via "requirements" I put the issues currently lying on my owner to the owner "requirements".