Excel InterOP Encapsulation

Source: Internet
Author: User

I have recently started DOTNET development for office. I am a little persistent about full encapsulation, because I can useCodeControl the performance in Word and Excel. If you use a host instance or an office script, it is not so casual.

When processing Excel, we found that the Office InterOP class provided by Microsoft was not very well-encapsulated and decided to encapsulate it by ourselves.
Encapsulation options:
1. encapsulate the main Excel classes and provide certain helper functions externally. It also provides functions for directly accessing classes under Microsoft. Office. InterOP. Excel.
Disadvantage: the customer's code must reference this office library. The customer needs to understand the Microsoft. Office. InterOP. excel model. Even more miserable, you need to know a lot of Enum that cannot be automatically prompted.
Advantage: The amount of encapsulated code is small, and the release of resources is completed by the customer code (you cannot predict when the customer does not need to use a resource. The best resource release mode is, no, release immediately)

2. Full encapsulation: All Excel classes
Disadvantage: the code is too large to release resources (resources are always allocated and code tracing is required), and the function design is troublesome (no one knows the customer's code requirements)
Advantage: the customer code is much simpler.

Despite the trouble, I chose 2 for full encapsulation.

The Code has not been completed. Haha/files/jeasonzhao/jeasonzhao.office.rar

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.