Board index » jbuilder » Getting and Setting properies of Office files

Getting and Setting properies of Office files


2003-07-22 03:11:37 AM
jbuilder18
Hi,
Is there any way to firstly get, and after change the properties of office
files? To be more specific, i want to change the "author" of a .doc file. I
found that POI is -until now- incomplete (no write methods).
Which is the simplest way to do this?
Thanks on advance,
TS
 
 

Re:Getting and Setting properies of Office files

On 7/21/2003 at 3:11:37 PM, TS wrote:
Quote
Is there any way to firstly get, and after change the properties of
office files? To be more specific, i want to change the "author" of a
.doc file.
This is definitely not the right newsgroup for this question. In fact,
it is not even the right news server. You will have better luck on the
Microsoft news server.
--
Regards,
John McGrath [TeamB]
 

Re:Getting and Setting properies of Office files

In <3f1ca00a$ XXXX@XXXXX.COM >John McGrath [TeamB] wrote:
Quote
On 7/21/2003 at 3:11:37 PM, TS wrote:

>Is there any way to firstly get, and after change the properties of
>office files? To be more specific, i want to change the "author" of
>a .doc file.

This is definitely not the right newsgroup for this question. In
fact, it is not even the right news server. You will have better
luck on the Microsoft news server.
Actually, I think the POI list-serve would be the best
place to ask, even though the POI folks haven't implemented
this. They may have suggestions as to how you might figure
out the HDF (horrible document format) or the HPSF (horrible
property set format) or some other horrible thing for what
you want to do.
Paul Furbacher [TeamB]
Save time, search the archives:
info.borland.com/newsgroups/ngsearch.html
Is it in Joi Ellis's Faq-O-Matic?
www.visi.com/~gyles19/fom-serve/cache/1.html
Finally, please send responses to the newsgroup only.
That means, do not send email directly to me.
Thank you.
 

{smallsort}

Re:Getting and Setting properies of Office files

On 7/21/2003 at 10:51:01 PM, Paul Furbacher [TeamB] wrote:
Quote
Actually, I think the POI list-serve would be the best
place to ask
Yes, that does sound like a better place to ask.
--
Regards,
John McGrath [TeamB]
 

Re:Getting and Setting properies of Office files

Thanks, i' ll start searching.........
 

Re:Getting and Setting properies of Office files

If you have MS Office installed you can do it by invoking Word from your
Java application through one of Java/COM gates
(staff.develop.com/halloway/JavaWin32.html). Here is an example of
doing that:
import org.jawin.*;
import org.jawin.win32.*;
public class Test {
private static String DOC_PATH = "D:\\temp\\jawin\\Test.doc";
private static String NEW_AUTHOR = "My Java App";
private static Integer wdPropertyAuthor = new Integer(3);
public static void main(String args[]) throws COMException {
DispatchPtr word = new DispatchPtr("Word.Application");
word.put("Visible", false);
DispatchPtr docs = word.getObject("Documents");
docs.invoke("Open", DOC_PATH);
DispatchPtr doc = word.getObject("ActiveDocument");
DispatchPtr author = (DispatchPtr)
doc.get("BuiltinDocumentProperties", wdPropertyAuthor);
System.out.println("Author: " + author.get("Value"));
author.put("Value", NEW_AUTHOR);
doc.invoke("Save");
word.invoke("Quit");
}
}
I used Jawin (sourceforge.net/projects/jawinproject/) to write the
code.
--Sultan
On Mon, 21 Jul 2003 22:11:37 +0300, TS < XXXX@XXXXX.COM >wrote:
Quote
Hi,
Is there any way to firstly get, and after change the properties of
office
files? To be more specific, i want to change the "author" of a .doc file.
I
found that POI is -until now-incomplete (no write methods).
Which is the simplest way to do this?

Thanks on advance,
TS