歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux基礎 >> Linux教程 >> Microsoft Office開發工具 Visual Studio 2015

Microsoft Office開發工具 Visual Studio 2015

日期:2017/2/28 13:52:29   编辑:Linux教程

針對Office開發工具微軟推出了Visual Studio 2015,支持Clang編譯器和LLVM框架,同時可以為Android及未來的iOS開發應用。Visual Studio 2015支持Java、ANT、SQL LITE和WebSocket4web,提供原生的Git支持。用戶可以在新版中嘗試創建新的項目類型,下面將重點介紹一下安裝步驟和新功能。

安裝步驟如下:

  1. 如果還沒安裝Visual Studio 2015,立即點擊獲取Visual Studio Community 2015,完全免費!
  2. 通過aka.ms/GetLatestOfficeDevTools獲取最新版本的Office開發套件。
  3. 請確保您已安裝Outlook 2016。

新功能:支持外接應用是重點

Visual Studio 2015的新功能有很多,除了能夠原生地支持在ECMAScript 2015中定義的一部分新的語言結構,讓JavaScript編輯工具利用Visual Studio中自帶的任務列表,讓JavaScript編輯更簡單之外,Visual Studio 2015還支持直接生成Linux二進制程序。但是,這裡將著重介紹Office外接應用的功能。

在Visual Studio 2015新版中,開發團隊已經在Office外接應用中添加一個新的項目類型,叫做Outlook Add-in with Commands。外接應用可以在Outlook功能區添加按鈕,啟動外界程序顯示菜單或者執行一個自定義的JavaScript函數,為用戶提供一個無縫的辦公室體驗。

用VersionOverrides在清單中聲明一個命令,忽略舊版本的Office,從而確保與用戶的兼容性。

現在可以創建一個撰寫電子郵件時插入自定義文本的外接程序。當報告有關問題時,客戶支持人員通常需要詢問更多的細節,給出使用說明如何查找版本,序列號等。它會非常方便—節省大量的時間—在Outlook中插入這種常見的文本按鈕。開發團隊還將逐步通過一個示例來創建一個寫電子郵件時插入自定義文檔的外接程序。

在Visual Studio 2015中,通過文件 > 新項目,選擇模板 > Office/SharePoint > Outlook Add-in with Commands創建新 Outlook 外接程序命令項目:

若要查看這些按鈕,在解決方案管理器中選擇OutlookAddIn節點,在屬性窗口中將啟動操作改為辦公室桌面客戶端,然後啟動Outlook 2016,並按F5:

正如你所看到的,通過選擇顯示所有的屬性按鈕啟動外界程序,當用戶閱讀信息時(在清單中定義MessageRead)出現在功能區。現在當用戶在撰寫郵件 (MessageCompose 表面) 時在功能區添加一個菜單按鈕。

停止調試,然後在解決方案資源管理器上點擊OutlookAddInManifest節點,並打開 XML 文件清單。

在</ExtensionPoint>標簽結束處,向MessageCompose內添加一個添加菜單按鈕的ExtensionPoint標簽。

<ExtensionPointxsi:type="MessageComposeCommandSurface">
< OfficeTabid="TabDefault">
< Groupid="msgComposeDemoGroup">
< Labelresid="groupLabel" />
< Controlxsi:type="Menu"id="msgComposeMenuButton">
< Labelresid="menuComposeButtonLabel" />
< Supertip>
< Titleresid="menuComposeSuperTipTitle" />
< Descriptionresid="menuComposeSuperTipDescription" />
< /Supertip>
< Icon>
< bt:Imagesize="16"resid="icon16" />
< bt:Imagesize="32"resid="icon32" />
< bt:Imagesize="80"resid="icon80" />
< /Icon>
< Items>
< Itemid="msgComposeMenuItem1">
< Labelresid="menuItem1ComposeLabel" />
< Supertip>
< Titleresid="menuItem1ComposeLabel" />
< Descriptionresid="menuItem1ComposeTip
" />
< /Supertip>
< Icon>
< bt:Imagesize="16"resid="icon16" />
< bt:Imagesize="32"resid="icon32" />
< bt:Imagesize="80"resid="icon80" />
< /Icon>
< Actionxsi:type="ExecuteFunction">
< FunctionName>addMsg1ToBody</FunctionName>
< /Action>
< /Item>
< Itemid="msgComposeMenuItem2">
< Labelresid="menuItem2ComposeLabel" />
< Supertip>
< Titleresid="menuItem2ComposeLabel" />
< Descriptionresid="menuItem2ComposeTip
" />
< /Supertip>
< Icon>
< bt:Imagesize="16"resid="icon16" />
< bt:Imagesize="32"resid="icon32" />
< bt:Imagesize="80"resid="icon80" />
< /Icon>
< Actionxsi:type="ExecuteFunction">
< FunctionName>addMsg2ToBody</FunctionName>
< /Action>
< /Item>
< /Items>
< /Control>
< /Group>
< /OfficeTab>
< /ExtensionPoint>

在清單末尾的Resources節點處,用下面的代碼替換 ShortStrings 和 LongStrings的節點

<bt:ShortStrings>
< bt:Stringid="groupLabel"DefaultValue="My Add-in Group"/>
< bt:Stringid="paneReadButtonLabel"DefaultValue="Display all properties"/>
< bt:Stringid="paneReadSuperTipTitle"DefaultValue="Get all properties"/>
< bt:Stringid="menuComposeButtonLabel"DefaultValue="Insert message"/>
< bt:Stringid="menuComposeSuperTipTitle"DefaultValue="Choose a message to insert"/>
< bt:Stringid="menuItem1ComposeLabel"DefaultValue="Insert custom message #1"/>
< bt:Stringid="menuItem2ComposeLabel"DefaultValue="Insert custom message #2"/>
< /bt:ShortStrings>
< bt:LongStrings>
< bt:Stringid="paneReadSuperTipDescription"DefaultValue="Opens a pane displaying all available properties. This is an example of a button that opens a task pane."/>
< bt:Stringid="menuComposeButtonTooltip"DefaultValue="Inserts your choice of text into body of the message."/>
< bt:Stringid="menuComposeSuperTipDescription"DefaultValue="Inserts your choice of text into body of the message. This is an example of a drop-down menu button."/>
< bt:Stringid="menuItem1ComposeTip"DefaultValue="Inserts custom message #1 into the body of the email." />
< bt:Stringid="menuItem2ComposeTip"DefaultValue="Inserts custom message #2 into the body of the email." />
< /bt:LongStrings>

最後,在 functions/functions.js 的結尾處添加一些自定義的 JavaScript 函數:

// Adds text into the body of the item, then reports the results to the info bar.
function addTextToBody(text, icon, event) {
Office.context.mailbox.item.body.setSelectedDataAsync(text,
{ coercionType: Office.CoercionType.Text },
function (asyncResult) {
if (asyncResult.status == Office.AsyncResultStatus.Succeeded) {
statusUpdate(icon, "\"" + text + "\" inserted successfully.");
} else {
Office.context.mailbox.item.notificationMessages.addAsync("addTextError", {
type: "errorMessage",
message: "Failed to insert \"" + text + "\": "
+ asyncResult.error.message
});
}
event.completed();
});
}
function addMsg1ToBody(event) {
addTextToBody("Custom message #1", "icon16", event);
}
function addMsg2ToBody(event) {
addTextToBody("Custom message #2", "icon16", event);
}

現在運行外接程序查看新菜單。因為我們將菜單添加到MessageCompose上,你需要點擊Outlook 2016左上角的創建新郵件圖標創建一封新郵件。

就是這個!您已成功添加外界命令程序。如果想學習更多並深入探究如何將命令添加到Office Add-in可以查閱Overview of add-in commands for mail和Create a manifest for add-in commands。

Visual Studio 2015 Update 2 RC 發布,微軟集成開發環境 http://www.linuxidc.com/Linux/2016-03/128935.htm

Visual Studio Code 簡單試用體驗 http://www.linuxidc.com/Linux/2015-05/116887.htm

Visual Studio Code試用體驗 http://www.linuxidc.com/Linux/2015-07/120378.htm

Visual Studio 2010 & Help Library Manager 安裝說明 http://www.linuxidc.com/Linux/2012-11/74814.htm

OpenCV 2.3.x/2.4.x在Visual Studio 2005/2008和Visual Studio 2010配置方法詳解 http://www.linuxidc.com/Linux/2012-08/68302.htm

使用OpenCV-2.4.0.exe文件編譯x86或x64平台Visual Studio 2005/2008/2010目標文件 http://www.linuxidc.com/Linux/2012-08/68305.htm

Visual Studio LightSwitch增加對HTML5和JavaScript的支持 http://www.linuxidc.com/Linux/2012-06/63397.htm

Visual Studio 11:使用 C++ 開發一個最簡單的 Metro 應用 http://www.linuxidc.com/Linux/2012-06/62657.htm

Visual Studio 的詳細介紹:請點這裡
Visual Studio 的下載地址:請點這裡

Copyright © Linux教程網 All Rights Reserved