
June 8th, 2005, 04:59 AM
|
|
Registered User
|
|
Join Date: Jun 2005
Posts: 3
Time spent in forums: 1 h 15 m 36 sec
Reputation Power: 0
|
|
<Identifier> expected
I'm new to JAVA.
I have made the following code:
Code:
1 import com.sun.rsasign.m;
2 import com.sun.rsasign.p;
3 import Class.com.sun.star.uno.UnoRuntime;
4 import Class.com.sun.star.text.XTextDocument;
5 import Class.com.sun.star.text.XText;
6 import Class.com.sun.star.text.XTextRange;
7 import Class.com.sun.star.frame.XStorable;
8 import Class.com.sun.star.beans.PropertyValue;
9 /*
10 * PropertyValue.java
11 *
12 * Created on June 7, 2005, 4:05 PM
13 */
14
15 /**
16 *
17 * @author msl
18 */
19 public class StoreToURL {
20
21 /** Creates new form BeanForm */
22 public StoreToURL() {
23 initComponents();
24
25 }
26 public class main{
27 /** Methods available are:
28 *
29 *XSCRIPTCONTEXT.getDocument() returns XModel
30 * XSCRIPTCONTEXT.getDesktop() returns XDesktop
31 *XSCRIPTCONTEXT.getComponentContext() returns XComponentContext
32 */
33
34 Dim oDoc = XSCRIPTCONTEXT.getDocument();
35 Dim xTextDoc = UnoRuntime.queryInterface(XTextDocument,oDoc);
36 Dim xText = xTextDoc.getText();
37 Dim xTextRange; As String;
38 String xTextRange = xText.getStart();
39 xTextRange.setString( "Text created by Martijn Slippens.\n\n" );
40 String xTextRange = xText.getEnd();
41 xTextRange.setString( "All rights reserved®.\n\n" );
42 Dim sPath = "path:///D:/BASIC";
43 Dim sURL = sPath & "/" & "test.odt";
44 Dim xDocument = oDoc;
45
46 {
47
48 com.sun.star.beans.PropertyValue[] lProperties =
49 new com.sun.star.beans.PropertyValue[1];
50 lProperties[0] = new com.sun.star.beans.PropertyValue() ;
51 lProperties[0].Name = "Overwrite ";
52 lProperties[0].Value = new Boolean(true);
53
54
55 com.sun.star.frame.XStorable xStore = (com.sun.star.frame.XStorable)UnoRuntime.queryInterface (
56
57 com.sun.star.frame.XStorable .class, xDocument);
58
59 xStore.storeAsURL (sURL, lProperties);
60 }
61
62 }
63 /** This method is called from within the constructor to
64 * initialize the form.
65 * WARNING: Do NOT modify this code. The content of this method is
66 * always regenerated by the Form Editor.
67 */
68 // <editor-fold defaultstate="collapsed" desc=" Generated Code ">
69 private void initComponents() {
70
71 }
72 // </editor-fold>
73
74
75 // Variables declaration - do not modify
76 // End of variables declaration
77
78 }
79
But the lines:
Code:
39 xTextRange.setString( "Text created by Martijn Slippens.\n\n" );
&
Code:
41 xTextRange.setString( "All rights reserved®.\n\n" );
give the following error:
<Identifier> expected.
Could someone please tell me what it is that i must change in order to make it work?
Thanx in advance.
|