共用方式為


IMDEmbedded 介面

IMDEmbedded 介面是用來管理內嵌 PowerPivot 資料庫或表格式模型資料庫的公用介面。 介面繼承自 IPersistStream 介面。 介面允許下列作業:

  • 取得容器檔中內嵌數據流的標識碼。

  • 設定包含檔的 URL。

  • 設定旗標,指出內嵌應用程式是否位於託管環境中。

  • 將路徑設定為內嵌應用程式所使用的暫存盤。

  • 取消目前的內嵌作業。

  • 取得數據流的估計大小(以位元組為單位),以儲存內嵌物件。 繼承自 IPersistStream

  • 確認內嵌資料庫自上次儲存后是否已變更。 繼承自 IPersistStream

  • 將內嵌資料庫載入本機或進程內引擎。 繼承自 IPersistStream

  • 將本機或進程內嵌資料庫儲存至容器檔中的內嵌數據流。 繼承自 IPersistStream

參考文獻

下列參考會記載 IMDEmbeddedmsmd.h 頭檔中所呈現的介面。

來源檔案:PXOEmbeddedData.idl

[  
  local,                            
  object,                           
  uuid(6B6691CF-5453-41c2-ADD9-4F320B7FD421),                       
  pointer_default(unique)           
]  
interface IMDEmbeddedData : IPersistStream  
{  
 [id(1), helpstring("Set flag indicating if the application is in a hosted environment")]   
 HRESULT SetHosted(  
  [in] BOOL in_fIsHosted);  
  
 [id(2), helpstring("Set the URL for the document containing the embedded stream")]   
 HRESULT SetContainerURL(  
  [in] BSTR in_bstrURL);  
  
 [id(3), helpstring("Get identifier used to look up embedded stream in container document")]   
 HRESULT GetStreamIdentifier(  
  [out, retval] BSTR* out_pbstrStreamId);  
  
 [id(4), helpstring("Set the path used by the embedding application for temporary files")]   
 HRESULT SetTempDirPath(  
  [in]  BSTR in_bstrPath);  
  
 [id(5), helpstring("Cancel the current operation")]   
 HRESULT Cancel();  
};  

IMDEmbeddedData::GetStreamIdentifier

HRESULT GetStreamIdentifier (  
    [out, retval] BSTR * out_pbstrStreamId  
    )  

說明

取得主應用程式用於容器檔中內嵌數據流的標識碼。

參數

out_pbstrStreamId
指定數據流識別碼的位置。

傳回值

S_OK
已成功傳回數據流標識碼。

S_FALSE
沒有數據流標識碼。

E_FAIL
存取數據流識別碼時發生錯誤。

備註

若要確認目前連接是否包含內嵌資料庫,用戶應該從 OLE DB 連接屬性檢查DBPROP_MSMD_EMBEDDED_DATA屬性的值。

DBPROP_MSMD_EMBEDDED_DATA的可能值為:

名稱 價值觀 定義
DBPROPVAL_EMBED_NONE 0x00 沒有可用的內嵌資料庫
DBPROPVAL_EMBED_EMBEDDED 0x01 目前的應用程式包含內嵌資料庫
DBPROPVAL_EMBED_LINKED 0x02 內嵌資料庫裝載於遠端應用程式中(亦即 SharePoint Server)

來源

[id(1), helpstring("Get identifier used to look up embedded stream in container document")]   
 HRESULT GetStreamIdentifier(  
  [out, retval] BSTR* out_pbstrStreamId);  

IMDEmbeddedData::SetContainerURL

HRESULT SetContainerURL (  
    [in] BSTR in_bstrURL  
    )  

說明

設定包含內嵌數據流之檔案的 URL。

參數

in_bstrURL
指定包含檔案的網址。

傳回值

S_OK
已成功設定容器 URL。

E_FAIL
設定容器 URL 時發生錯誤。

來源

[id(2), helpstring("Set the URL for the document containing the embedded stream")]   
 HRESULT SetContainerURL(  
  [in] BSTR in_bstrURL);  

IMDEmbeddedData::SetHosted

HRESULT SetHosted (  
    [in] BOOL in_fIsHosted  
    )  

說明

設定旗標,指出內嵌應用程式是否位於託管環境中。

參數

in_ftHosted
如果呼叫端位於服務應用程式中的託管中,則為TRUE (例如 IIS)。

傳回值

S_OK
旗標已成功設定。

E_FAIL
設定旗標時發生錯誤。

來源

[id(5), helpstring("Set flag indicating if the application is in a hosted environment")]   
 HRESULT SetHosted(  
  [in]  BOOL in_fIsHosted);  

IMDEmbeddedData::SetTempDirPath

HRESULT SetTempDirPath (  
    [in] BSTR in_bstrPath  
    )  

說明

將路徑設定為內嵌應用程式所使用的暫存盤。

參數

in_bstrPath
主應用程式用於暫存盤的路徑。

傳回值

S_OK
已成功設定暫存盤目錄。

E_FAIL
設定路徑時發生錯誤。

來源

[id(4), helpstring("Set the path used by the host application for temporary files")]   
 HRESULT SetTempDirPath(  
  [in]  BSTR in_bstrPath);  

IMDEmbeddedData::Cancel

HRESULT Cancel ( void )  

說明

取消目前的內嵌資料庫作業

參數

沒有。

傳回值

S_OK
作業已成功取消。

DB_E_CANTCANCEL
目前沒有任何可取消的作業正在進行中。

E_FAIL
取消內嵌作業時發生錯誤。

來源

[id(5), helpstring("Cancel the current operation")]   
 HRESULT Cancel();  

IMDEmbeddedData::GetSizeMax (IPersistStream::GetSizeMax)

HRESULT GetSizeMax (  
    [out] ULARGE_INTEGER * out_pcbSize  
    )  

說明

取得數據流的估計大小(以位元組為單位),以儲存內嵌物件。 繼承自 IPersistStream

參數

in_bstrPath
內嵌資料庫映像的估計大小(以位元組為單位)。

傳回值

S_OK
已成功取得大小。

E_FAIL
取得大小時發生錯誤。

IMDEmbeddedData::IsDirty (IPersistStream::IsDirty)

HRESULT IsDirty ( void )  

說明

確認內嵌資料庫自上次儲存后是否已變更。 繼承自 IPersistStream

參數

沒有

傳回值(秒)

S_OK
資料庫自上次儲存后已變更。

S_FALSE
資料庫自上次儲存后尚未變更。

E_FAIL
取得資料庫狀態時發生錯誤。

IMDEmbeddedData::Load (IPersistStream::Load)

HRESULT Load (   
    [in] IStream * in_pStm   
    )  

說明

將內嵌資料庫載入本機或進程內引擎。 繼承自 IPersistStream

參數

in_pStm
從何處載入內嵌資料庫的數據流介面指標。

傳回值(秒)

S_OK
已成功載入資料庫。

E_OUTOFMEMORY
記憶體不足,無法載入資料庫。

E_FAIL
載入資料庫時發生錯誤,不同於 E_OUTOFMEMORY

IMDEmbeddedData::Save (IPersistStream::Save)

HRESULT Save (   
    [in] IStream * in_pStm,  
    [in] BOOL in_fClearDirty  
    )  

說明

將本機或進程內嵌資料庫儲存至容器檔中的內嵌數據流。 繼承自 IPersistStream

參數

in_pStm
要儲存內嵌資料庫的數據流介面指標。

in_fClearDirty
旗標,指出此作業之後是否應該清除髒旗標。

傳回值(秒)

S_OK
已成功儲存資料庫。

STG_E_CANTSAVE
儲存資料庫時發生錯誤,與 STG_E_MEDIUMFULL不同。

STG_E_MEDIUMFULL
無法儲存資料庫,因為儲存裝置上沒有剩餘的空間。