![]() |
OpenXML - Excel - .NET - Rows and Cells
Hi,
I'm using OpnXML to manipulate an existing Excel file. I'm using Visual Studio 2005, and referencing the .NET framework 3, but I cannot use LINQ syntax, I have to navigate thru the structures by using loops. I have 3 questions: 1) Is there a better way to access cells in my case that LINQ is unavailable than looping? 2) When iterating thru the rows, and the cells in each row as below: For Each oRow As Spreadsheet.Row In oRows 'aCells is defined before, outside the loops. aCells = oRow.Descendants(Of Spreadsheet.Cell)() For Each oCell As Spreadsheet.Cel in aCells <do something Next Next I noticed some cells are skipped. For example, row 1 starts, and the 1st iteration in the loop that processes all the cells for that row. The 1st cell we looped thru showed cell column "A" (in the oCell.CellReference.Value member), and the 2nd iteration had column "I". It seems that some columns are being skipped although the skipped columns are visible in the spreadsheet. Any ideas of why is that happening? 3) When looping thru the rows and columns using for example: For Each oRow As Spreadsheet.Row In oRows ... Next do the OpenXML library return the rows ordered by their row number and/or the cells ordered by their column name (letters)? They seem to come in order by stepping thru the code, but is that guaranteed? Thank you in advance, Richard |
All times are GMT +1. The time now is 01:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com