In Excel, rows and columns are actually still in range, but the method for getting rows and columns is a little different from what appeared in the previous articles, to use the get_item method of the rows and columns attributes of worksheet, the following example code demonstrates how to select a row, copy data between rows, and insert rows:
Thisapplication = new excel. Application ();
Thisworkbook = thisapplication. workbooks. open ("Z: \ book1.xls", type. missing, type. missing, type. missing, type. missing, type. missing, type. missing, type. missing, type. missing, type. missing, type. missing, type. missing, type. missing );
Thisapplication. displayalerts = false;
Xlsheet = (Excel. worksheet) thisworkbook. worksheets. get_item (1 );
// Excel. Range = xlsheet. get_range ("G4", type. Missing );
Excel. Range = (Excel. Range) xlsheet. Rows. get_item (18, type. Missing );
Excel. Range range1 = (Excel. Range) xlsheet. Rows. get_item (19, type. Missing );
Range. value = "123 ";
Range. Copy (range1 );
Range1.rows. insert (xlinsertshiftdirection. xlshiftdown );
Thisworkbook. saveas ("Z: \ book2.xls", type. Missing, type. Missing,
Type. Missing, Excel. xlsaveasaccessmode. xlnochange,
Type. Missing, type. Missing );
With regard to the release of the Excel process, the previous articles are already available, so we will not repeat them here.
Source: http://www.cnblogs.com/dahuzizyd/archive/2007/01/10/Excel_6.html