Excel Secondary Development Series (3): Create an Excel Secondary Development Environment

Source: Internet
Author: User

Excel Secondary Development Series

Previously we talked about the Excel programming model and common Excel operations. In this section, I will explain how to create an Excel application-level secondary development program.

Many useful materials can be found on Microsoft's basic website. Here we mainly talk about the secondary development of Office projects: http://msdn.microsoft.com/zh-cn/library/cc668205.aspx.

1. Create an Excel Project, for example:

2. The solution is as follows:

3. to better develop an Excel project, you can directly add a functional area to the project as an example of our development:

4. As shown in the following figure:

In this case, you can use the toolbar to add the desired control to group1. At this time, an application-level Excel Add-in (plug-in) has been created.

5. Generally, usercontrol is used in the secondary development process ). Add a user control (Usercontrol1) to the project, and then you can present it when loading the plug-in or calling it. The Code is as follows:

 

Private void button#click (object sender, RibbonControlEventArgs e)

{

Usercontrol = new UserControl1 ();

MyCustomTaskPane = Globals. ThisAddIn. CustomTaskPanes. Add (usercontrol, "table information"); // add a Pane for this usercontrol

MyCustomTaskPane. Visible = true;

MyCustomTaskPane. DockPosition = Office. MsoCTPDockPosition. msoCTPDockPositionFloating; // set the position for this pane.

MyCustomTaskPane. Height = 220; // set the size for this pane.

MyCustomTaskPane. Width = 480;

// Window excel = e. Control. Context as Window;

// Worksheet sheet = excel. ActiveSheet as Worksheet;

}

6. The following is the same as normal Windows development. Add the corresponding controls on usercontrol to register the events you want to complete. Everything is OK. I will explain how to operate Excel later.

 

7. Here I will explain that this series is based on office 2007 (Secondary Development of Excel ). So in the web or windows mentioned above, I will share it with you later.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.