i’m trying to make a simple Java program to open an existing word-document, change something and save it as .html-file.
The part which is not working is to save it as .html .
The problem is, i got the html-file but it’s only a renamed doc-file. So not really a .html-file which I can work with.
This is what I found with Google:
Object oWordBasic = Dispatch.call(oWord, "WordBasic").getDispatch();
Dispatch.call((Dispatch) oWordBasic, "FileSaveAs", path);
What I have to do, to get a html-file as output?
Thank you in advance.
It’s using the OLE Automation Object to save the file, so you have to find the method or parameter to indicate filetype.
This is the macro I could record using Word:
So it means you have to indicate FileFormat := wdFormatHTML (or the constant value) parameter to the SaveAs method. That’s left as an exercise to the reader 🙂