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