Aspose is a powerful control that can be used to manipulate files such as Word,excel,ppt

Source: Internet
Author: User

Aspose is a powerful control that can be used to manipulate files such as word,excel,ppt, and it is very convenient to import and export data using this control. Where Aspose.cells is used to manipulate Excel, there are many features. I'm using the most basic functionality, reading the data from Excel and importing it into a dataset or database. The code for reading the Excel tabular data is as follows:

The first step is to introduce a namespace: using Aspose.cells;

New Workbook (); Workbook. Open ("c:\\test.xlsx"); Cells cells = workbook. Worksheets[0]. Cells;         For (int i = 0; i < cells. Maxdatarow + 1; i++)    {for        (//A row of read data, the code inserted into the database can also be written here}}    

Return to DataTable:

Cells cells = workbook. WORKSHEETS[1]. Cells; System.Data.DataTable DataTable1 = cells. Exportdatatable (1, 0, cells. Maxdatarow,cells. Maxcolumn); //nonetitlesystem.data.datatable dataTable2 = cells. Exportdatatable (0, 0, cells. Maxdatarow+1,cells. Maxcolumn,true);//showtitle


Originating From: http://www.cnblogs.com/ricky_li/p/3738005.html

Aspose is a powerful control that can be used to manipulate files such as Word,excel,ppt

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.