C # The difference between Com and InteropExcel is referenced directly when Excel is operated.

Source: Internet
Author: User
Both are based on MicroSoft Excel11.0, that is, Office2003.
However, when you call a method to open an Excel file, it is slightly different. If COM is referenced directly, the syntax is as follows: Code
1 Excel. Application xlApp = null;
2 xlApp = new Excel. Application ();
3 xlApp. Visible = true;
4 Excel. Workbook xlWb = null;
5 try
6 {
7 xlWb = xlApp. Workbooks. Open (this. _ filename, Missing. Value, Missing. Value,
8 Missing. Value,
9 Missing. Value,
10 Missing. Value,
11 Missing. Value, Missing. Value, Missing. Value );
12
13

However, if InteropExcel is referenced, the syntax is as follows: Code
1 xlWb = xlApp. Workbooks. Add (this. _ filename );

I don't know the differences between the two, but they can only be used in this way. Later, the methods used to call WorkSheet are the same.

Related Article

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.