Eclipse.swt and Microsoft Word files

Hi everybody,

I stumbled on a thread way back in the forum that said something about using eclipse.org.swt to work with Microsoft Word files in Eclipse. It didn't exactly answer the question I was looking for (I don't think) so I'm going to give it a shot up here.

Before anyone asks, I've heard of the Jakarta API's, and I can't make heads or tails of them or their source code, they really confused me, so that's why I'm trying this approach.

Anyway, the impression I got was that you can use eclipse.org.swt, which is already installed in Eclipse (correct me if I'm wrong) to read Word files into Eclipse. Is this true? If so, is there a way to read it line by line, like you would a text file?

Thanks,

Jezzica85

[761 byte] By [jezzica85a] at [2007-11-26 22:28:57]
# 1
I have no idea whether you can read Word files into Eclipse that way or any other way. Seems unlikely to me. But even if you can, you wouldn't be able to read it in "line by line". That's because lines aren't part of Word's data model.
DrClapa at 2007-7-10 11:32:31 > top of Java-index,Java Essentials,Java Programming...
# 2
Wow, they aren't?What is Word's data model then? I thought that was the basis of text in a file.
jezzica85a at 2007-7-10 11:32:31 > top of Java-index,Java Essentials,Java Programming...
# 3

I get the feeling you are thinking of MS Word as a large and expensive text editor. It isn't that at all. It's way more complicated than that. (And that is why you couldn't understand the POI classes right away.) So if you're looking for a quick and dirty way to just suck the text out of a MS Word document, throwing away all the formatting and other objects in the document, I don't think you're going to find one.

DrClapa at 2007-7-10 11:32:31 > top of Java-index,Java Essentials,Java Programming...
# 4

Oh, shoot. Well, thanks, I guess I always did think of Word as a text editor. It just seems like such a pain to always convert to text files first and then have the extra files floating around. Maybe I should write something into my application so the text files are deleted after I run it--is there a way to delete text files on a computer from a java application?

Thanks so much for the clarification,

Jezzica85

jezzica85a at 2007-7-10 11:32:32 > top of Java-index,Java Essentials,Java Programming...
# 5

> are deleted after I run it--is there a way to delete

> text files on a computer from a java application?

Yes. You first have to define what you mean by "text files" though.

Anything that ends in .txt? Easy.

Based on the content? Easy to difficult, depending on your rules.

Something else?

jverda at 2007-7-10 11:32:32 > top of Java-index,Java Essentials,Java Programming...
# 6

Hi again, I just got back finally--

I have no restrictions on content, and they would be .txt files, I just want to delete the file I originally ran the application with. I'm not 100% sure how to do that though, would I say,

File file = new File( name of original file on the computer );

file.delete();

or would I do it another way?

Thanks,

Jezzica85

Message was edited by:

jezzica85

jezzica85a at 2007-7-10 11:32:32 > top of Java-index,Java Essentials,Java Programming...
# 7
Yes, if you know the file you want to delete, then creating a corresponding File object and calling delete() will do it, assuming you have permission, the file's not open, etc.
jverda at 2007-7-10 11:32:32 > top of Java-index,Java Essentials,Java Programming...
# 8
Whew, cool! I would have thought that it might create memory only inside the program, that's going to be a lot of help. Thanks again!
jezzica85a at 2007-7-10 11:32:32 > top of Java-index,Java Essentials,Java Programming...