How can I convert a *.rtf file to *.doc file programmatically?

Piet van Oostrum piet-l at pietvanoostrum.com
Fri Oct 16 23:46:24 PDT 2015


Redmond at 139. wrote:

 > hello sir/madam
 >       I'm using Windows 7 and Visual Studio 2008 team version & 2013 commnunity version,and I have
 > installed libreoffice 5.0 sdk,I'm not too familar with C++ ,but my project was using VC++,so how
 > do I convert a *.rtf file to *.doc programmatically?any help would be appciated.
 > Regards
 > Ken
 > 

The easiest would be to use a command line, like
soffice --convert-to "doc:MS Word 97" yourfile.rtf --headless.

I have read somewhere that on Windows you have to use -convert-to instead of --convert-to. I can't check that as I don't have Windows.
Also you should give the complete path of the soffice binary, or make sure it is in a directory that appears in your PATH environment variable.

Hope this helps.
-- 
Piet van Oostrum <piet at vanoostrum.org>
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]



More information about the LibreOffice mailing list