PRB: Convert Dialog Doesn't Appear for OLE Object in MS ExcelLast reviewed: February 17, 1998Article ID: Q135765 |
The information in this article applies to:
SYMPTOMSWhen the Edit|<Object>|Convert... menu item is selected for an OLE object that is embedded within a Microsoft Excel document, the Convert dialog box does not appear.
CAUSEMicrosoft Excel displays the Convert dialog for an object only if WriteFmtUserTypeStg has been used to write out a clipboard format and user-readable name for the contents of the object. The MFC libraries do not call this function when creating or saving OLE objects.
RESOLUTIONCall WriteFmtUserTypeStg in the Serialize method of your server's document class.
STATUSThis behavior is by design.
MORE INFORMATIONWriteFmtUserTypeStg should be called as part of your server's implementation of IPersistStorage::InitNew and IPersistStorage::Save. By default, MFC OLE server applications do not call WriteFmtUserTypeStg in their implementation of IPersistStorage::InitNew and IPersistStorage::Save. One simple way to achieve this functionality in an MFC application is to make the call to WriteFmtUserTypeStg in the Serialize method of the server's document class.
Steps to Add a Call to WriteFmtUserTypeStg
Sample Code
void CServerDoc::DoWriteFmtUserTypeStg(LPSTORAGE lpStorage) { LPOLEOBJECT lpObject = (LPOLEOBJECT)GetInterface(&IID_IOleObject); ASSERT(lpObject != NULL); CLSID clsid; lpObject->GetUserClassID(&clsid); LPTSTR pszUserType = NULL; OleRegGetUserType(clsid, USERCLASSTYPE_FULL, (LPOLESTR *)&pszUserType); if (pszUserType) { WriteClassStg(lpStorage, clsid); WriteFmtUserTypeStg(lpStorage, m_cfPrivate, (LPOLESTR)pszUserType); CoTaskMemFree(pszUserType); } } void CServerDoc::Serialize(CArchive& ar) { ASSERT(m_pRoot != NULL); if(IsEmbedded() && ar.IsStoring()) { ASSERT(m_lpRootStg != NULL); DoWriteFmtUserTypeStg(m_lpRootStg); } SerializeFontInfo(ar); m_pRoot->Serialize(ar); } Keywords : MfcOLE Technology : kbMfc kbole Version : WINDOWS:1.5,1.51,1.52,1.52b;Winnet:2.0,2.1,2.2,4.0,4.1,5.0 Platform : NT WINDOWS Issue type : kbprb |
================================================================================
© 1998 Microsoft Corporation. All rights reserved. Terms of Use. |