C # operating Excel files

Source: Internet
Author: User

Excel is a software in Microsoft Office Automation suite. It is mainly used to process workbooks. Excel has been welcomed by many users for its powerful functions and friendly interfaces. When designing an application system, different users have different requirements for printing. If you want to make the printing function in the program suitable for every user, you can imagine that the program design is very complicated. Because the Excel table is powerful, and almost every machine has installed it, if you put the results of program processing in the Excel table, in this way, each user can customize their own printing in Excel according to their own needs. This not only makes the program design simple, but also meets the requirements of many users and is more practical. So how can I use Visual C # To Call Excel and store data in an Excel table? This article will discuss the solutions to the above problems.

  ExcelObject
Microsoft's Excel object model contains 128 different objects, from simple objects such as Rectangles and text boxes to complex objects such as pivot tables and charts. next, we will briefly introduce the most important and most commonly used four objects.

(1) Application object. The Application object is at the top level of the Excel object hierarchy, indicating the Excel running environment.
(2) Workbook object. The Workbook object is directly in the lower layer of the Application object, indicating an Excel worksheet file.
(3) Worksheet object. The Worksheet object is included in the Workbook object, indicating an Excel Worksheet.
(4) Range object. The Range object contains the Worksheet object, which indicates one or more cells in an Excel Worksheet.

  C # Managed code and unmanaged code in 
Programs running in the. net public language framework are managed code. All types of managed code in the program are strictly checked, with no pointers. The management of memory is completely controlled by the operating system. Under control, programming is easier and less error-prone, so we can spend more time solving practical problems rather than computer language problems. Relatively speaking, programs running outside the. NET Framework are unmanaged code. For example, COM components, ActiveX components, Win32 API functions, and pointer operations. C # in programming, you must use unmanaged code in certain situations. For example, you must use a mature COM component or call an API function, or use pointers to write real-time/efficient programs.

  Visual C # Calling Excel Of COM Components
One. NET component is actually.. net dll, which contains not only the running program itself, but also the description of the DLL (Meta Data, that is, metadata ), a com component uses its class library (TLB) to store its description information. These COM
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.