Quickly export to excel in COM mode, batch Export

Source: Internet
Author: User

When it comes to populating excel in development, one's fill is too slow, and the existing array method fills an example, which can be used to quickly populate the COM method.

C#,VBA is similar in usage

Application scenario: Use Excel in a way that requires automation, and the chart is automatically created in addition to populating the data.

It is recommended to use Npoi when using only data export on the server.

Premise: Refer to the relevant library first

Operation under VS2013:

Project-Add Reference-com-type library-microsoft Excel 12.0 Object Library

Can not insert pictures, tried several times are unsuccessful, but do.

Code similar to the following

1         usingExcel =Microsoft.Office.Interop.Excel;2 3         Static voidInsertexcel () {4  5             //If there are multiple data types, use object[,]6             string[,] Stringarray =New string[Ten, -];7  8Excel.Worksheet worksheet=NULL;9Excel.Range Stringrange = worksheet.cells[2,1];Ten  OneStringrange =Stringrange.get_resize ( AStringarray.getlonglength (0),   -Stringarray.getlonglength (0)); -  theStringrange.value2 =Stringarray; -  -}

Quickly export to excel in COM mode, batch Export

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.