共用方式為


建立表單區域

This topic lists the considerations and steps for creating a form region.

There are different types of form regions, depending on how you want to customize the form and where you place the form region in the form. A form region can add extra user interface to the default page or add an extra page to a standard form. Or, it can replace the default page of a standard form, or replace the entire standard form, resulting in a new form for a derived message class. 您可以使用 <formRegionType> 步驟 7 中所述的 標記,在表單區域資訊清單 XML 檔案中指定表單區域的類型。 Aside from this, the means to create and design these various types of form regions is identical:

  1. 使用表單設計工具來建立及設計版面配置 (步驟 1 到 5)

  2. 將表單區域儲存至 Outlook Form Storage (.OFS) 檔案 (步驟 6)

  3. 建立表單區域資訊清單 XML 檔,對 Microsoft Outlook 指定表單區域的其他相關細節 (步驟 7)

  4. 註冊郵件類別的表單區域 (步驟 9)

重新啟動 Outlook 後,表單區域即可供使用。 或者,您可以建立表單區域和表單區域資訊清單 XML 檔案、使用增益集來擴充表單區域,並以程式設計方式註冊表單區域。 當安裝增益集時,增益集會同時安裝含有表單區域的表單。

如需詳細資訊,請參閱使用增益集擴充表單區域

下列程序將詳述使用表單設計工具而不靠增益集來建立表單區域的相關步驟。

  1. [開發人員] 索引標籤上,按一下 [自訂表單] 群組中的 [設計表單]

  2. 從九種最適用的標準 Outlook 表單中擇一使用: [約會][連絡人][日誌項目][會議邀請][郵件][通知][RSS 文章][工作][工作要求]

    自訂表單時,應一律使用標準表單產做為範本。 選擇標準表單時,應考慮下列事項:

    • 與表單相關聯的動作,例如,您是否要將表單傳送給其他人,在此情況下,您應該選擇 [訊息] 表單。

    • 您在表單中需要的欄位類型,例如,這些欄位大多是連絡人特定的欄位。

  3. 規劃自訂作業的範圍。 其是否足以讓您將額外控制項新增至標準表單的預設頁面底部? 是否需要額外的自訂頁面? 或者是否要修改使用者介面以方便建立新表單? 請注意,唯有當您對衍生的郵件類別指定該表單後,才可取代表單上的頁面。

  4. 在表單設計工具的 [開發人員] 索引標籤上,按一下 [設計] 群組中的 [新增表單區域]

    請注意,任何類型的表單區域都會在表單設計工具中開啟為個別頁面。 在執行時間中,表單區域將按照您在表單區域資訊清單 XML 檔中指定的方式進行顯示,如步驟 7 所述。

  5. 藉由將控制項從 [工具箱] 拖放至表單區域,並將其繫結至適當欄位,來設計表單的版面配置。

    與自訂表單頁面類似,自訂表單區域的過程將涉及定義自訂欄位、使用 [工具箱] 插入控制項,以及使用 [欄位選擇] 來繫結控制項與欄位。 如需詳細資訊,請參閱自訂表單中的控制項逐步解說:將表單區域新增至表單的現有頁面中的「設計表單區域」一節。 您可以選擇使用增益集來設定控制項的事件。

  6. 儲存表單區域的版面配置,方法是按一下 [儲存區域],然後按一下 [設計] 群組中的 [儲存表單區域]。 表單區域版面配置檔案就會以 .OFS 副檔名儲存。

  7. 使用記事本之類的 XML 編輯器來建立表單區域資訊清單 XML 檔案。

    您必須為每個表單區域指定 XML,以告訴 Outlook 如何顯示它,以及它支援的動作。 XML 必須針對表單區域資訊清單架構 (進行驗證,以取得架構的詳細資訊,請參閱MSDN Library) 中的Microsoft Outlook 2010 XML 架構參考。 架構支援許多元素,例如以下列舉的較常用專案:

    • The <addin> tag specifies the ProgID of the add-in that manages the form region and provides storage for it. You should only specify this tag if you use an add-in to create and manage the form region.

    • The <customActions> tag that specifies the actions supported by the form region, for example, reply and forward.

    • The <displayAfter> tag specifies the form region that precedes the current form region in the same form. This information defines the initial order of multiple adjoining form regions or multiple separate form regions in the same form.

    • The <formRegionType> tag specifies whether the form region is an additive form region (adjoining or separate form region), or is a replacement or replace-all form region (replacing the default page or the entire standard form and resulting as a new form for a derived message class).

    • The <layoutFile> tag specifies the location of the .OFS file, if one exists. Note that any file paths in the .OFS file, including this file path, can be specified as a relative path to the location of the form region manifest XML file specified in the registry. However, also note that UNC paths are not supported. If you use an add-in to create and manage the form region, you must specify the <addin> tag but not this tag.

    • The <name> tag specifies the name for the form region used only in code.

    • 標題 <> 標籤會在 [動作 ] 功能表和 [ 選擇 表單] 對話方塊中指定個別表單區域的顯示名稱。

    • The <icons> tag specifies the location of icon files.

    注意事項

    [!注意事項] 根據預設,圖示檔是在表單區域資訊清單 XML 檔案的相同資料夾或其相對路徑中。 您也可以為圖示檔指定完整路徑,例如: <icons><default>c:\myicon.ico</default></icons>,或資源檔案的完整路徑,例如: <icons><unread>c:\myresource.dll,101</unread> </icons> (這會將圖示資源 101 載入資源檔案 c:\myresource.dll)。 不過,請勿使用隱含慣例來指定內嵌在增益集元件檔案中的圖示。 例如: <icons><read>,102</read></icons> 將不支援 ,且不會載入增益集 dll 中的圖示資源 102。

  8. 關閉 Outlook。

  9. 在 Windows 登錄中註冊表單區域、指定此表單區域所要使用的訊息類別,以及表單區域資訊清單 XML 檔案的完整檔案路徑。

    在 Windows 登錄中的 HKEY_CURRENT_USERHKEY_LOCAL_MACHINE 區下註冊表單區域。 例如,IPM 的加法表單區域 目前使用者的連絡人訊息類別應該在相同的金鑰下註冊, HKEY_CURRENT_USER\Software\Microsoft\Office\Outlook\FormRegions\IPM.Contact。 請注意,套用至 IPM 的所有表單中,將會顯示目前使用者的表單區域 。聯繫 人和衍生自 IPM 的任何訊息類別 。連絡人。 如果您想要只將表單區域用於 IPM。請連絡 且不希望衍生訊息類別使用該表單區域,您可以在表單區域資訊清單 XML 檔案中使用 < exactMessageClass > 標記來指定。

  10. 啟動 Outlook。 當您開啟您在步驟 9 中為表單區域指定的訊息類別專案時,您會在偵測器中看到表單區域。

支援和意見反應

有關於 Office VBA 或這份文件的問題或意見反應嗎? 如需取得支援服務並提供意見反應的相關指導,請參閱 Office VBA 支援與意見反應