LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 08-14-2005, 10:00 AM   #1
tredegar
Guru
 
Registered: May 2003
Location: London, UK
Distribution: Ubuntu 10.04, mostly
Posts: 6,007

Rep: Reputation: 366Reputation: 366Reputation: 366Reputation: 366
Simple Ooo BASIC Macro problem: "connot coerce argument type..."


Im using Openoffice 1.1.4, KDE3.3.2, Mandriva 2005LE, with updates. My java is jre1.5.0_04

I want a simple macro to insert some text into my document. For example:

Tools - Macro - Record
Type "test" <CR>
Mouse to Stop Recorder & stop it.
Save the macro as "Test"

When I run the macro I get:
Quote:
BASIC runtime error.
An exception occurred
Type: com.sun.star.lang.illegalArgumentException
Message: cannot coerce argument type during corereflection call!
[OK]
This is the code that Openoffice has generated for me:

Code:
REM  *****  BASIC  *****

Sub Main

End Sub

sub Test
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(0) as new com.sun.star.beans.PropertyValue
args1(0).Name = "Text"
args1(0).Value = "test"

dispatcher.executeDispatch(document, ".uno:InsertText", "", 0, args1())

rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())

end sub
It falls over on the line:

dispatcher.executeDispatch(document, ".uno:InsertPara", "", 0, Array())

With the error I mentioned at the start.

Does anybody know what I have misconfigured?

Edit: misspelled the OOO error message

Last edited by tredegar; 08-27-2005 at 11:20 AM.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
IPW2200 Make error macro "create_workqueue" passed 2 arguments, but takes just 1 jplev22 Linux - Wireless Networking 2 09-16-2005 11:34 AM
web surfing problem... i have to type in "http://" fatrandy13 Linux - Software 8 05-23-2005 02:48 AM
extern "C" and static data type problem with g++ vtluu Red Hat 1 05-21-2004 10:45 AM
extern "C" and static data type problem with g++ vtluu Programming 2 04-28-2004 05:10 AM
<input type="button" disabled="true" > does not work in ns4.7 or 4.9 cybercop12us Programming 2 11-29-2002 08:31 AM


All times are GMT -5. The time now is 04:07 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration