D
David
I'm attempting to open a .doc file in a C++ Word 2007 automation
program and save it as docx, but the resulting document is always in
compatibility mode. Here's the relevant code:
short wdFormatXMLDocument = 12;
COleVariant vXMLFormat(wdFormatXMLDocument, VT_I2);
CString sName = m_pDocument->get_FullName();
CString sTempName = sName + _T("x");
CComVariant vName(sName);
CComVariant vTempName(sTempName);
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
m_pDocument->SaveAs(&vTempName, &vXMLFormat, &covOptional,
&covOptional, &covOptional, &covOptional, &covOptional, &covOptional,
&covOptional, &covOptional, &covOptional, &covOptional, &covOptional,
&covOptional, &covOptional, &covOptional);
m_pDocument->Close(&viDoNotSave, &vOriginalFormat, &vbFalse);
m_pDocument = NULL;
closeDoc(false);
Instead of wdFormatXMLDocument I've also tried long
wdFormatDocumentDefault = 16, with the same result.
Can anyone tell me what I'm doing wrong?
Thanks,
David
program and save it as docx, but the resulting document is always in
compatibility mode. Here's the relevant code:
short wdFormatXMLDocument = 12;
COleVariant vXMLFormat(wdFormatXMLDocument, VT_I2);
CString sName = m_pDocument->get_FullName();
CString sTempName = sName + _T("x");
CComVariant vName(sName);
CComVariant vTempName(sTempName);
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
m_pDocument->SaveAs(&vTempName, &vXMLFormat, &covOptional,
&covOptional, &covOptional, &covOptional, &covOptional, &covOptional,
&covOptional, &covOptional, &covOptional, &covOptional, &covOptional,
&covOptional, &covOptional, &covOptional);
m_pDocument->Close(&viDoNotSave, &vOriginalFormat, &vbFalse);
m_pDocument = NULL;
closeDoc(false);
Instead of wdFormatXMLDocument I've also tried long
wdFormatDocumentDefault = 16, with the same result.
Can anyone tell me what I'm doing wrong?
Thanks,
David