Issue 56400 - Macro recorder For Inserting New Sheet Doesn't Work Always
Summary: Macro recorder For Inserting New Sheet Doesn't Work Always
Status: CONFIRMED
Alias: None
Product: Calc
Classification: Application
Component: programming (show other issues)
Version: OOo 2.0
Hardware: PC All
: P3 Trivial with 2 votes (vote)
Target Milestone: ---
Assignee: AOO issues mailing list
QA Contact:
URL:
Keywords:
Depends on:
Blocks: 81535
  Show dependency tree
 
Reported: 2005-10-21 20:40 UTC by mrtea
Modified: 2013-08-07 15:12 UTC (History)
2 users (show)

See Also:
Issue Type: FEATURE
Latest Confirmation in: ---
Developer Difficulty: ---


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description mrtea 2005-10-21 20:40:43 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
Comment 1 frank 2005-11-11 13:19:00 UTC
Hi Joerg,

please have a look at this Issue.

Frank
Comment 2 probe1 2005-12-05 21:49:45 UTC
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.
Comment 3 joerg.skottke 2005-12-29 15:01:16 UTC
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
Comment 4 bettina.haberer 2010-05-21 14:58:24 UTC
To grep the issues easier via "requirements" I put the issues currently lying on
my owner to the owner "requirements".