M
murugan U
Hello,
I am trying to automate word 2003 to Compare Documents in Tile View
(Compare Side By Side).
I am working on Windows-XP (SP2), Visual Studio 6.0. i am getting the
Error msg "DisplayRulers is not a method" while calling
CompareSideBySideWith.
Here is my code:
CoInitialize(NULL);
_Application objWordApp;
_Document objDoc,objDoc1;
LPDISPATCH lpDisp,lpDisp1;
// Common OLE variants that are easy to use for calling arguments.
COleVariant covTrue((short)TRUE),
covFalse((short)FALSE),
covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
if ( !objWordApp.CreateDispatch("Word.Application") )
{
MessageBox("Couldn't start MS-Word", "CBayOnlineViewer", MB_OK |
MB_ICONINFORMATION);
return;
}
objWordApp.SetVisible(TRUE);
Documents docs(objWordApp.GetDocuments());
lpDisp = docs.Open(
COleVariant("c:\\test1.doc", VT_BSTR),
covFalse, // Confirm Conversion.
covFalse, // ReadOnly.
covFalse, // AddToRecentFiles.
covOptional, // PasswordDocument.
covOptional, // PasswordTemplate.
covFalse, // Revert.
covOptional, // WritePasswordDocument.
covOptional, // WritePasswordTemplate.
covOptional, // Format. // Last argument
covOptional, // Encoding // New for Word 2000/2002
covTrue, // Visible
covOptional, //OpenAndRepair
covOptional, //DocumentDirection
covOptional, //NoEncodingDialog
covOptional //XMLTransform
); // Close Open parameters
Documents docs1(objWordApp.GetDocuments());
lpDisp1 = docs1.Open(
COleVariant("c:\\test2.doc", VT_BSTR),
covFalse, // Confirm Conversion.
covFalse, // ReadOnly.
covFalse, // AddToRecentFiles.
covOptional, // PasswordDocument.
covOptional, // PasswordTemplate.
covFalse, // Revert.
covOptional, // WritePasswordDocument.
covOptional, // WritePasswordTemplate.
covOptional, // Format. // Last argument
covOptional, // Encoding // New for Word 2000/2002
covTrue, // Visible
covOptional, //OpenAndRepair
covOptional, //DocumentDirection
covOptional, //NoEncodingDialog
covOptional //XMLTransform
); // Close Open parameters
objDoc.AttachDispatch(lpDisp);
objDoc.Activate();
objDoc1.AttachDispatch(lpDisp1);
objDoc1.Activate();
Windows objwin;
objwin.AttachDispatch(objDoc1.GetActiveWindow());
objwin.CompareSideBySideWith(COleVariant("c:\\test1.doc"));
objwin.Arrange(COleVariant ((short)0));
CoUninitialize();
can someone help me out? is there any way to get this work?
Thanks,
Murugan U
I am trying to automate word 2003 to Compare Documents in Tile View
(Compare Side By Side).
I am working on Windows-XP (SP2), Visual Studio 6.0. i am getting the
Error msg "DisplayRulers is not a method" while calling
CompareSideBySideWith.
Here is my code:
CoInitialize(NULL);
_Application objWordApp;
_Document objDoc,objDoc1;
LPDISPATCH lpDisp,lpDisp1;
// Common OLE variants that are easy to use for calling arguments.
COleVariant covTrue((short)TRUE),
covFalse((short)FALSE),
covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
if ( !objWordApp.CreateDispatch("Word.Application") )
{
MessageBox("Couldn't start MS-Word", "CBayOnlineViewer", MB_OK |
MB_ICONINFORMATION);
return;
}
objWordApp.SetVisible(TRUE);
Documents docs(objWordApp.GetDocuments());
lpDisp = docs.Open(
COleVariant("c:\\test1.doc", VT_BSTR),
covFalse, // Confirm Conversion.
covFalse, // ReadOnly.
covFalse, // AddToRecentFiles.
covOptional, // PasswordDocument.
covOptional, // PasswordTemplate.
covFalse, // Revert.
covOptional, // WritePasswordDocument.
covOptional, // WritePasswordTemplate.
covOptional, // Format. // Last argument
covOptional, // Encoding // New for Word 2000/2002
covTrue, // Visible
covOptional, //OpenAndRepair
covOptional, //DocumentDirection
covOptional, //NoEncodingDialog
covOptional //XMLTransform
); // Close Open parameters
Documents docs1(objWordApp.GetDocuments());
lpDisp1 = docs1.Open(
COleVariant("c:\\test2.doc", VT_BSTR),
covFalse, // Confirm Conversion.
covFalse, // ReadOnly.
covFalse, // AddToRecentFiles.
covOptional, // PasswordDocument.
covOptional, // PasswordTemplate.
covFalse, // Revert.
covOptional, // WritePasswordDocument.
covOptional, // WritePasswordTemplate.
covOptional, // Format. // Last argument
covOptional, // Encoding // New for Word 2000/2002
covTrue, // Visible
covOptional, //OpenAndRepair
covOptional, //DocumentDirection
covOptional, //NoEncodingDialog
covOptional //XMLTransform
); // Close Open parameters
objDoc.AttachDispatch(lpDisp);
objDoc.Activate();
objDoc1.AttachDispatch(lpDisp1);
objDoc1.Activate();
Windows objwin;
objwin.AttachDispatch(objDoc1.GetActiveWindow());
objwin.CompareSideBySideWith(COleVariant("c:\\test1.doc"));
objwin.Arrange(COleVariant ((short)0));
CoUninitialize();
can someone help me out? is there any way to get this work?
Thanks,
Murugan U