(Original) VSTO starts from scratch

Source: Internet
Author: User
The reason why the manager came into contact with this solution was that it had to do a secondary development based on excel. I checked it online and found that it was really powerful. NET Framework support. Compared with the previous VBA, the program has made great progress in both robustness and security. There are very few materials in this area, especially Chinese, and there are usually only a few words on msdn. So I hope that I can find something I can pull online to help people who come here, if you have any suggestions, please leave a message. First, I would like to thank Paladin. lao Boyou for helping me solve VSTO problems enthusiastically. VSTO notes start from below: Workshop :----------------------------------------------------------------------------------------------------------------------------------------------- (1) IntroductionWe usually have three methods to redevelop Excel: one is the extension plug-in (AddIn ). This is the first choice for developing custom functions in Excel. The second is VSTO (Visual Studio Tool for Office ). This is the first choice for developing Excel embedded functions (such as buttons and menus ). Third, RTD (Real Time Data ). This is the first choice for developing Excel real-time data applications. (From the family network commercial software channel Original article link: http://soft.ccw.com.cn/programing/other/htm2008/20080926_509725.shtml) for those who have higher requirements on the interface, such as the need to add buttons, floating toolbar, or 2007 Ribbon, VSTO is the first choice, VSTO uses Visual Studio as the platform. Generally, VSTO uses C # and VB. For VS 2005, only VSTO templates are provided by VB and C # When a new project is created. Addin is mostly called by EXCEL as a function library and can be written in C ++. The following describes how to establish a VSTO project.

 

(2) create a project

On the Visual Studio platform, you can see the Excel Workbook template in the C # language option, and a similar template in Visual Basic (Figure 1)

 

Figure 1

Next, select an excel file. Here, it should be noted that the "program" generated after VSTO development is an xls file, which is not available only in the final release, instead, it must be created when the project is created. A developer can create an xls instance or develop it based on other existing xls instances (Figure 2 ). In most cases, the data in the existing xls is often required for this operation. Therefore, the latter is selected more.

Note: selecting an existing xls file is not based on the original file for development, but copying the file to the project directory for development based on the copy.

Figure 2

Then there is the development interface of the Project. On the solution Management page, each sheet in the xls file corresponds to an item (Figure 3 ), developers can design their own interfaces and write functional code. Each sheet has its own startup and shutdown functions, and the entire project also has its own startup and shutdown. When running, the project startup is executed first, and then the startup of each sheet is executed.

Figure 3

In Figure 3, there are two. cs, one MyUserControl and the other WinForm, which are the controls I added later. Although you can add controls to the design interface of each sheet, the controls available for selection are limited, especially the lack of container controls. In addition, the control added to the sheet can only be seen in this sheet. Therefore, custom controls and custom windows must be introduced in the VSTO interface design and called dynamically to make the interface more flexible. The details will be summarized later.

 

(3) The last few references for VSTO are listed.

Chinese version: Guide to VSTO programming (by Eric Carter)-a reference book recommended by many people. I have also bought this book. However, this book covers a wide range of topics, but the details are not discussed. Therefore, some specific problems encountered in programming are of limited help. In addition, it only provides VB code.

 

English version: Visual Studio Tools for Office (Eric Carter)-English version of the VSTO programming guide, with the same comments as above.

Professional VSTO 2005 (by Alvin Bruney) -- although it is not thick, it provides in-depth explanations on the main aspects and helps me a lot in some aspects, it also provides two types of code: VB and C. Download:

Professional vsto 2005.pdf

 

Bytes -------------------------------------------------------------------------------------------

66 ℃ green tea space original, reprinted please indicate the source, thank you blog Park!

 

 

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.