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

Joined: 02 Jul 2005 Posts: 6
|
Posted: Sat Jul 02, 2005 6:11 am Post subject: loading a file |
|
|
Could anybody please provide me with a working snippet of Java programming for loading a Word file into an OfficeBean.
I just began programming with OO; I need this small thing to start me off. Many sincerest thanks.
Alex
http://www.cut-the-knot.org |
|
| Back to top |
|
 |
Cybb20 Super User


Joined: 02 Mar 2004 Posts: 1569 Location: Frankfurt, Germany
|
Posted: Sat Jul 02, 2005 9:05 am Post subject: |
|
|
Hi abogom, download the SDK from the download pages and look into the examples/java folder.
Hope this helps.
Christian _________________ - Knowledge is Power - |
|
| Back to top |
|
 |
abogom General User

Joined: 02 Jul 2005 Posts: 6
|
Posted: Sat Jul 02, 2005 1:47 pm Post subject: |
|
|
| Cybb20 wrote: | Hi abogom, download the SDK from the download pages and look into the examples/java folder.
Hope this helps.
|
No, Christian, it does not. I asked for a snippet, not the SDK, nor an advice. Something does not work in my settings. And since I am a newbie, there are too many things that might have gone wrong. So I asked for a snippet that an expert OO programmer knows to work. I would then compare and, if necessary, eliminate a couple of possibilities.
Thank you |
|
| Back to top |
|
 |
abogom General User

Joined: 02 Jul 2005 Posts: 6
|
Posted: Sat Jul 02, 2005 3:58 pm Post subject: |
|
|
| Cybb20 wrote: | Hi abogom, download the SDK from the download pages and look into the examples/java folder.
Hope this helps.
Christian |
You know, it did help after all. There is an example for loading a document that contains an url creation:
| Code: |
String sUrl = args[0];
if ( sUrl.indexOf("private:") != 0) {
java.io.File sourceFile = new java.io.File(args[0]);
StringBuffer sTmp = new StringBuffer("file:///");
sTmp.append(sourceFile.getCanonicalPath().replace('\\', '/'));
sUrl = sTmp.toString();
}
|
I've no notion what "private:" may mean, so I ignored it. Then I used it as the first argument for loadComponentFromUrl. The remarkable thing is that when I created a URL object and used its toString() function as the first argument, the thing did not work, which prompted my original post.
So thank you, I did get what I needed.
Alex
http://www.cut-the-knot.org |
|
| Back to top |
|
 |
SergeM Super User

Joined: 09 Sep 2003 Posts: 3211 Location: Troyes France
|
|
| Back to top |
|
 |
|