| View previous topic :: View next topic |
| Author |
Message |
CXXLJEVANS General User

Joined: 17 Mar 2011 Posts: 18
|
Posted: Tue Apr 17, 2012 1:05 pm Post subject: Why "Error saving script" error? |
|
|
I created a new spreadsheet document, then created a macro,
Macro1, which the program defined with some default value
which had, on line 45:
xTextRange.setString("Hello World(in BeanShell)");
Then tried to run the macro and the error I got was on line
43 which was:
xText = xTextDoc.getText();
Which was understandable since the doc type was a spreadsheet
not a text document.
So, from seeing XSpreadsheet on:
http://wiki.services.openoffice.org/wiki/Documentation/DevGuide/Spreadsheets/Working_With_Spreadsheet_Documents
I guessed that everywhere there was Text, there should be Spreadsheet.
So, after changing:
import com.sun.star.text.XTextDocument;
to:
import com.sun.star.text.XSpreadsheetDocument;
and:
xTextDoc =
(XTextDocument)UnoRuntime.queryinterface
(XTextDocument.class,...
to:
xTextDoc =
(XTextDocument)UnoRuntime.queryinterface
(XSpreadsheet Document.class,...
I tried to save the script; however, this caused and error
window to appear with title "Error" and content:
(X) Error saving script:
[OK]
which gave me no hint as to what I was doing wrong.
So, how can I save the script with my modifications?
My OOo version(from the About under Help) is:
OpenOffice.org 3.2.0
OOO320m12(Build:9483)
My os is linux:
~/prog_dev/OpenOffice/writer $ uname -a
Linux evansl-desktop 2.6.32-38-generic #83-Ubuntu SMP Wed Jan 4 11:12:07
UTC 2012 x86_64 GNU/Linux
I did search for:
Error saving script
on the forum:
http://www.oooforum.org/forum/search.phtml
and got several hits; however, none had to do with saving scripts.
TIA for any help.
-regards,
Larry |
|
| Back to top |
|
 |
B Marcelly Super User

Joined: 12 May 2004 Posts: 1414 Location: France
|
Posted: Wed Apr 18, 2012 1:21 am Post subject: |
|
|
Hi,
What you are doing : create a macro in BeanShell.
What is your problem : cannot save your macro.
There is no relation with any instructions you may have set in the macro.
Do not create your macro in "OpenOffice.org macros". In some OS it may be write protected.
Create the macro in "My Macros" or in your document.
You should learn the API before attempting to write anything in BeanShell (or JavaScript). This is much more difficult than with Basic. And even with Basic, learning the API is not easy. _________________ Bernard
OpenOffice.org 1.1.5 fr / OpenOffice.org 3.4.1 en-US + langpacks, MS-Windows XP Home SP3
This forum is unusable, use instead Apache OpenOffice forums |
|
| Back to top |
|
 |
CXXLJEVANS General User

Joined: 17 Mar 2011 Posts: 18
|
Posted: Wed Apr 18, 2012 4:23 am Post subject: |
|
|
| B Marcelly wrote: | Hi,
What you are doing : create a macro in BeanShell.
What is your problem : cannot save your macro.
There is no relation with any instructions you may have set in the macro.
Do not create your macro in "OpenOffice.org macros". In some OS it may be write protected.
Create the macro in "My Macros" or in your document.
You should learn the API before attempting to write anything in BeanShell (or JavaScript). This is much more difficult than with Basic. And even with Basic, learning the API is not easy. |
Thanks very much. Just as you said, creating the macro under "My Macros"
avoided the problem.
However, I did not put the initial macro under "OpenOffice.org macros".
Instead, the initial macro was put in:
| Code: |
simple_script.ods
Library1
Macro1.js
|
I would think, since the simple_script.ods is writeable by me (since I created it),
the simple_script.ods->Library1->Macro1.js would be writeable also.
Why can't the script be saved under simple_script.ods?
-regards,
Larry |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|