Sharing: Summary of Handling Excel methods

Source: Internet
Author: User
Excel
Often see how to deal with the question of Excel file, here a summary, welcome everyone to add.

▲1, through Excel interface Operation ★ Restriction: Need to install excel▲1. 1, the use of interop methods. Reference: "Creating an Excel spreadsheet and adding the Data to It programmatically" http://www.csharphelp.com/archives/ Archive241.html▲1. 2, the use of reflective technology. Reference: "Calling a COM Component from C # (Late Binding)" http://www.c-sharpcorner.com/1/call_com.asp

▲2, output Excel programs can be compatible with CSV-formatted files (note 1) as Excel files. ★ Limit: A, only for output, B, CSV only support single page (worksheet), that is, only a single page of Excel files. (note 2) C, cannot control the format, such as the merging of the cell can not be done.

▲3, using the XML import features supported by Office 2003, produces XML files that Excel can import. ★ Limit: A, only for output, B, not support low version.

▲4, based on the Excel file format (Note 3), is generated by writing a binary file. ▲4.  1, use the third party control, such as Aspose, website http://www.aspose.com. ★ Restrictions: To spend money. ▲4. 2, write their own, reference http://www.cnblogs.com/unruledboy/archive/2004/07/07/22093.html, a good Chinese introduction, but did not introduce his sources of information, as well, only to achieve a single sheet mode. Going this way can go http://www.sourceforge.net search opensource information about the file format for Microsoft Office. In fact, 4.  1 refers to the aspose is the use of this information, but it with a confusing device wrapped one, it began to sell money. ★ Limit: Heavy workload.

Note 1: A comma-delimited column, a carriage return separator line text Format Note 2: Common "DataGrid output to Excel" Is this method, such as the Mengxian on the homepage of the example, he is redirected to the DataGrid render, but it is only a gesture, can not be copied in any case, For example, if the grid has a checkbox and other things are too complex to die, it is best to write their own loops from the DataTable directly generated. Note 3: Biff (Binary Interchange File format), reference "File:how to Create a BIFF5 file" http://support.microsoft.com/ default.aspx?scid=kb;en-us;150447


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.