OK, so I finally solved my problem. To sum it up, my problem was : "how to handle DOCX documents on an automated Word 2003 application", and I found an easier solution than using the Converter SDK.
What I had to do to get a successful conversion was (copy/paste from the same question I asked in MSDN) :
- Detect if my document is a DOCX document (the extension is not relevant, I need to check the file signature)
- Get the FileConverter object corresponding to the Word 2007 Converter (of course, the Compatibility Pack is required)
- Opening the document with the OpenFormat of the FileConverter as an argument in the "Documents.Open" method.
Here are some excerpts of the code :
OpenDoc( CString inFileName, BOOL tryAgain ) {
m_oDoc = NULL;
FileConverter fc = NULL;
// isDocxFile checks the file signature
BOOL isDocX = isDocxFile(inFileName);
FileConverters fcList = m_oWordApp.GetFileConverters();
if (fcList.GetCount() > 1) {
// Beginning the loop on "0" won't work. The fcList starts at 1.
for (long i=1; i < fcList.GetCount() + 1; i++) {
FileConverter fcTemp = fcList.Item(COleVariant((long) i));
if (fcTemp.GetClassName() == "Word12") {
fc = fcTemp;
}
}
}
if (isDocX) {
m_oDoc = m_oDocs.Open( COleVariant( inFileName ), //FileName
vFalse, //ConfirmConversions
vTrue, //ReadOnly
vFalse, //AddToRecentFiles
vOpt, //PasswordDocument
vOpt, //PasswordTemplate
vFalse, //Revert
vOpt, //WritePasswordDocument
vOpt, //WritePasswordTemplate
COleVariant(fc.GetOpenFormat()), //Format
vOpt, //Encoding
vOpt); //Visible
}
else
{
m_oDoc = m_oDocs.Open( COleVariant( inFileName ), //FileName
vFalse, //ConfirmConversions
vTrue, //ReadOnly
vFalse, //AddToRecentFiles
vOpt, //PasswordDocument
vOpt, //PasswordTemplate
vFalse, //Revert
vOpt, //WritePasswordDocument
vOpt, //WritePasswordTemplate
vOpt, //Format
vOpt, //Encoding
vOpt); //Visible
}
}
With all this done, my document can be rendered correctly, and saved as RTF if need be.