Introduction
This article explains how to create a task pane app for Office using Visual Studio C#. We can create a task pane app without Visual Studio. If you do not have Visual Studio then you can do development in the Napa tool. The "Napa" Office 365 Development Tools app. We can use an app in Office 365 using a web browser or Office desktop client.
Office apps
We can now build our Office app with web technologies such like HTML, CSS, JavaScript, Rest API and so on. We can use HTML, ASP, PHP or an aspx page in our Office app. We can publish our app on the Office store. Microsoft has introduce cloud-based technologies for Office as Office 365. Office 365 is a subscription model.
Prerequisite to build Office App
We need the following components to build an Office app. You can build your Office app without Visual Studio.
Using Visual Studio
- Microsoft Visual Studio 2013 and the Microsoft Office Developer Tools for Visual Studio 2013 (March 2014 Update)
-Or-
- Microsoft Visual Studio 2012 and the Microsoft Office Developer Tools for Visual Studio 2012
- Office 2013
Without Visual Studio
- Office 365 developer account
- If you do not have Visual Studio then you can do development in the Napa tool. The "Napa" Office 365 Development Tools app.
How to create a task pane Office app in C#?
In this article, we will create a task pane app in Excel. We will create a very simple app to create a task pane app.
Create a project for task pane app in Visual Studio 2012
- Open Visual Studio 2012
- Click "File" -> "New" -> "Project..."
- The New Project dialog box opens
- Click Templates -> Visual C# -> Office/SharePoint
- Expand Office/SharePoint , Choose Apps and then select “Apps for Office 2013”
- Provide an appropriate name for your project and click on the Ok button.
- In our sample, I have given the project name as “MyFirstTaskPane”. You can see it in the following screen shot.
Figure 1
- After clicking on Ok button, you can see the next dialog box open about choosing the type of app you want to create, such as Excel, Word, PowerPoint or Project
- By default Task Pane App is selected. We can select the Office application of where we want to display the task pane app.
- Leave the checkboxes for all selected Office applications (Excel, Word, PowerPoint and Project)
- Click on the Finish button.
- After clicking on the Finish button, you can see two projects created in the Solution Explorer. One is “MyFirstTaskPane” and “MyFirstTaskPaneWeb”.
Figure 2
Develop the task pane App
To design the functionality and develop your app, you can add your JavaScript in your aspx or HTML page, but in this example, we will go with following procedure to create a task pane app.
- By Default two files (“MyFirstTaskPane.js” and “MyFirstTaskPane.html”) are opened after creating the task pane project.
- Now, we want to create a Task Pane App.
- Open MyFirstTaskPane.html, find the <body> tag.
- In opening and closing body tags, you can see the div tag.
- Replace or type your content between opening and closing div tags, whatever you want to type it will display in your task pane.
- Add the elements "<h1> <b> My First Task Pane </b> </h1>" to your div tags .You can see them in the following screen shot.
Figure 3
- You can see in the HTML page that there are two input buttons created (set data and get data) in the div tag. We can get the value from the cell using the Get data button. If you want to set the value from your task pane then you can enter a value in the TextBox and click on the set data button.
- Run the task pane app in Excel. Press F5 to run your app. You can see the output the same as shown in the following screen shot.
Figure 4
Publish Office Apps
After completing your task pane app, you can publish our Office app on the Office store. I am not covering here how to publish Office Apps. You can refer to the following link.
http://msdn.microsoft.com/en-us/library/office/jj220068 SummaryIn this article, we discussed how to create a task pane app in C#. After that, we saw how to use various options (Excel, Word or PowerPoint) for creating the app. See the following link to learn more about task pane apps.
Reference: http://msdn.microsoft.com/en-us/library/office/fp142161(v=office.15).aspx