| Word 2007 File Seems To Be Deleted When You Open And Save It Using DSOFramer |
If you are using DSOFramer sample to host Office Documents, and tried to open and save Word 2007 documents in this manner, guess what !! the file seems to be deleted ! Using Process Monitor from sysinternals it was noted that files were being moved to a temp directory and then while saving it, changes were being made in it..strange! The DSOFramer code had the IPersist:Save() is returning S_OK, Looking at the Word 2007 code, it seemed like a bug in the implementation of IPersist:Save() Here is the modified DSOFramer code
if (SUCCEEDED(hr = m_pole->QueryInterface(IID_IPersistFile, (void**)&pipfile)))
{
hr = pipfile->Save(pwszFile, FALSE);
pipfile->Release();
//CODE MODIFICATION START
if (SUCCEEDED(hr) && !FFileExists(pwszFile))
{
//We should come here only in case of Word 2007.
CopyFileW(pwszCurPath, pwszFile, TRUE);
}
//CODE MODIFICATION END
}
|
VC中进行office编程--操作word
http://www.cppblog.com/wanhhf/archive/2006/02/20/3355.html
微软最新版本是2005 1.2
Visual C++ ActiveX Control for hosting Office documents in Visual Basic or HTML
Integrating Microsoft Word in your .NET applications