Develop MS Office Plugins


Published on

For Developers working on Microsoft technologies and want to learn how to create MS Office Plugins from scratch.

Published in: Technology, Education
1 Like
  • Be the first to comment

No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Develop MS Office Plugins

  1. 1. Microsoft Office Plugin(s) By-Rahul Gupta Mindfire Solutions, Noida Mindfire Solutions Confidential
  2. 2. About me Working with Mindfire Solutions,Noida since November 2013 Certifications: MCP:70-480 - Specialist certification in HTML5 with JavaScript and CSS3 Exam MCTS-70-515 - Microsoft .NET 4.0, Web App Development Skills: C#,TFS,JavaScript,Oracle 11g,SQL Server,WebServices Connect me: Twitter: Linkedin: Email: Skype ID: Mfsi_rahul.gupta Mindfire Solutions Confidential
  3. 3. Contents  What is Plugin  Why to develop/create Plugin  Accessing the Object Model of the Host Application  Getting started with the Plugins  Customizing the ribbon and action method  Prerequisites Check before Deploying the Plugin  Publishing and deploying the Plugin  Installing the Plugin  FAQs Mindfire Solutions Confidential
  4. 4. What is Plug-in • In Computing, a plug-in (or plugin, extension, or add-on / addin) is a software component that adds a specific feature to an existing software application. When an application supports plug-ins,it enables customization. • It is developed using Microsoft Visual Studio and .NET Framework. Add-in(s) are version specific hence we need to carefully select the version during development phase. • Microsoft has a very elegant COM architecture for all its application exposing API's for third party developers to extend. • Visual Studio has several types of project templates that support different business scenarios for Microsoft Office Applications, Some of them are: Document Level Customizations Application –Level Add-ins For details on Office Application and Project type, Please refer It details out All Microsoft Office Applications along with its corresponding Project types and associated features like Custom XML Parts,ClickOnce Deployment etc. Mindfire Solutions Confidential
  5. 5. Why to develop/create Plugin • Enhance Productivity and usability of the MS Office Suite. • Ease the life of end user and easy installable. • The Application can be dynamically extended to include new features. Plugin based architecture supports Parallel development hence many developer can simultaneously implement different components. • Overall reduce the complexity of the application. Plug-in(s) are of different types: 1)Built-in add-ins 2)Downloadable add-ins 3)Custom Add ins Mindfire Solutions Confidential
  6. 6. Accessing the Object Model of the Host Application Host Application Return Value Type • Microsoft Office Excel Microsoft.Office.Interop.Excel.Application • Microsoft Office InfoPath Microsoft.Office.Interop.InfoPath.Application • Microsoft Office Outlook Microsoft.Office.Interop.Outlook.Application • Microsoft Office PowerPoint Microsoft.Office.Interop.PowerPoint.Application • Microsoft Office Project Microsoft.Office.Interop.MSProject.Application • Microsoft Office Visio Microsoft.Office.Interop.Visio.Application • Microsoft Office Word Microsoft.Office.Interop.Word.Application Mindfire Solutions Confidential
  7. 7. Creating a Custom Microsoft Office Plugin • • Before begin with the development cross check that compatible MS Office version is present/installed on system. Select the PowerPoint Add-in template under the Office Tab as shown in figure. Mindfire Solutions Confidential
  8. 8. Creating a Custom Microsoft Office Plugin(Continued) • Add the Customized Ribbon File and this in turn will add the Ribbon.cs file as well in the Solution as shown below in figure. Mindfire Solutions Confidential
  9. 9. Customizing the ribbon • Add the code in Ribbon.xml file to customize the Office Tab and bind the tab with the Ribbon file to get associated with the ThisAddin Class file which in turn load this Addin when MSOffice Loads by parsing the FontExtractionRibbon.xml file. Mindfire Solutions Confidential
  10. 10. Defining the Action method • Implement an action method in Ribbon.cs file in the Helper region as specified in Ribbon.xml file and include the Office Core Library in the references as shown below. Implement the Plugin Functionality in this region Mindfire Solutions Confidential
  11. 11. Binding the Ribbon File with the Addin(s) • Once the method is implemented in Ribbon file. Bind the ribbon file with the Addin Class to Populate the MS Office Application’s Ribbon with this add in(s) by overriding the Ribbon Extensibility Object. This is very important step as skipping this may lead to incorrect/improper functioning of Addin(s). Mindfire Solutions Confidential
  12. 12. Publishing and Deploying the Plugin Before Deploying the Plugin make sure that following requirements are met on the target machine otherwise It may lead to incorrect/improper functioning of the Plugin. Required Prerequisite Components on the Target Computer  .NET Framework needs to be present on the system  It can be installed on the same type of machine format(say 64 bit)on which it was originally developed.  Microsoft Visual Studio Tools for office runtime as it provides a runtime environment that manages add-ins.  The Primary Interop assemblies for the required version of Microsoft Office.  Any Project Specific Assemblies(dll) referenced by the projects that target the .NET Framework on which plugin is developed  Exactly same version of Hosting application(MS Office) needs to be present on the system  User must have administrative privilege to install/run the plugin. Note-Once the plugin is installed it will loaded in Hosted Application (MS office )by default every time the Application launches hence we need to either remove or disable the addin if required from MS Office . Mindfire Solutions Confidential
  13. 13. Publishing and Deploying the Plugin(Continued..) • • • Once all the Required Prerequisite are met. The Developed plugin can be published and deployed on the target machine. Right Click the Project and Publish it.Enter the Publish location and Installation path as shown in fig and click next. The Publish Location can be any of the below: publish to a Web site or network share and have the users install from there publish to a staging Web site and then copy the files to another Web site for installation. publish to a network share to test installations and then have users install from a Web site or build CDs for installation. Mindfire Solutions Confidential
  14. 14. Publishing and Deploying the Plugin(Continued..) • Specify the Installation path in the wizard. It will be same as Publish path (if not provided).Select a corresponding option from the wizard and click o next and then finally say finish. Mindfire Solutions Confidential
  15. 15. Publishing and Deploying the Plugin(Continued..) • • Once the publish is successful. Navigate to the published path specified in the publish wizard. There will be following files as shown below The VSTO file is a copy of the deployment manifest file. Mindfire Solutions Confidential
  16. 16. Publishing and Deploying the Plugin(Continued..) Click on Application files and navigate through it.It contains the following files    Customization Assembly(has .Deploy file name extension) Application Manifest file, an XML file which provides the runtime with the information it needs to load and update customization assemblies Copy of Deployment manifest. Mindfire Solutions Confidential
  17. 17. Installing the Plugin(s) Once published, the Plugins is now ready to be installed. Close all the MS office Instances (if open any). Double Click on VSTO File provided and click on install. The Plugin will be installed. Restart the MS Office to start working with it. Mindfire Solutions Confidential
  18. 18. FAQs Q-I cannot install the plugin in my system using VSTO File. It says WIN32 exception A-Please make sure that system type on which plugin is developed and machine on which plugin installed are same. Please Contact plugin administrator to get the details. In case of mismatch upgrade your system type during windows installation. Q-I can not load the plugin in my development machine. It says the PowerPoint has encountered a serious problem. How to debug/locate the problem? A-Please note during development if any exception occurs them Microsoft office disable that addin so that it does not load again when MS Office restarts. You may go to option in PowerPoint and click on managed Addins to enable the addins. Q-I cannot install plugin on the other machine,eventhough I have provided the correct VSTO and manifest file, it is working fine on development machine. A-Make sure that correct version of hosting environment(MS office in this case)is installed on the target machine also cross check that you have provided the required DLL(s)(if any) and Customization Assembly as well. Refer Slide number 11 and 15 for more details. For Developers References: Mindfire Solutions Confidential
  19. 19. Thanks for your time Any Questions? Mindfire Solutions Confidential