Share: Excel processing method summary

Source: Internet
Author: User

I often see questions about how to deal with Excel files. I would like to summarize them here.
▲1. Use the Excel Interface★Restrictions: Excel 1.1 and interop must be installed. Reference: Creating an Excel Spreadsheet and Adding Data to It Programmatically http://www.csharphelp.com/archives/archive241.html#1.2、use a reflection technology. Reference: Calling a COM Component From C # (Late Binding) http://www.c-sharpcorner.com/1/call_com.asp
2. output files in csv format compatible with the Excel program (Note 1) as Excel files.★Restrictions: A, can only be used for output. B and csv can only generate single-page Excel files. (Note 2) C. Format cannot be controlled, such as Cell merging.
▲3. Use the xml import function supported by office 2003 to generate xml files that can be imported in Excel.★Restrictions: A, can only be used for output, B, does not support earlier versions.
4. Generate a binary file based on the excel file format (note 3. ▲4.1, use third-party controls, such as Aspose, website http://www.aspose.com.
★Restriction: cost-effective. ▲4.2. Write it by yourself. Refer to examples. If you are planning to take this path, you can go to the http://www.sourceforge.net to search opensource for information on Microsoft Office file formats. In fact, the Aspose mentioned in section 4.1 uses this information, but it uses obfuscators to package it and starts selling money.
★Limitation: heavy workload.
Note 1: Text Format of comma-separated columns and carriage return to separate rows NOTE 2: This method is common for "DataGrid output to Excel", such as an example on the home page of Meng xianhui, he is the Render of the redirection DataGrid, but it is just a gesture and cannot be copied under any circumstances. For example, if there is a CheckBox in the Grid and other complicated things, it won't work, it is better to generate a write loop directly from the DataTable. NOTE 3: Biff (Binary Interchange File Format) Format, refer to FILE: How to Create a BIFF5 File http://support.microsoft.com/default.aspx? Scid = kb; en-us; 150447

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.