Home |
Search |
Today's Posts |
#11
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I was working on an excell automation task that had to copy data ranges. Just make sure you get the data range in 1 range as an array and not cell by cell. Pehaps this is very obvious but in my case the thing worked 100 times faster if I got all the data of a row as an array in stead of picking the cell data of that row cell by cell. In C# Application App = new Excel.ApplicationClass(); // Open Workbook ... // Get Sheet ... int RowIndex = 1; // Get Row Range Object Range ThisRow = (Excel.Range)ThisWorkSheet.Rows[RowIndex, System.Reflection.Missing.Value]; // Get Array of data (2 dimensional Array, in this case 1 by [column count], with VB style 1 based index) Array RowData = (Array)ThisRow.Value; // Loop over all Data for (int ColIndex = 1; ColIndex <= RowData.Count; ColIndex++) { object CellData = RowData[ColIndex]; } // This works MUCH faster then for (int ColIndex = 1; ColIndex <= RowData.Count; ColIndex++) { object CellData = ((Excel.Range)ThisWorkSheet.Cells[ThisRow, ColIndex]).Value } Microsoft Reference (in C++): Use MFC to Automate Excel and Obtain an Array from a Range (url: http://support.microsoft.com/default...b;EN-US;186122) *** Sent via Devdex http://www.devdex.com *** Don't just participate in USENET...get rewarded for it! |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How do I save an Excel 97-2003 version or 2007 version for Mac 200 | Excel Discussion (Misc queries) | |||
Speed and Excel Version | Excel Discussion (Misc queries) | |||
Recover earlier version of excel sheet after new version saved? | Excel Discussion (Misc queries) | |||
How can I update the version of Excel 2000 9.0 to version 10.0 | Excel Discussion (Misc queries) | |||
Office automation application which will work with any version of office C#.NET | Excel Programming |