c# - Finding the number of cells in a row that has data -
so i'm having problem finding number of rows in excel document has data in it. here's have far:
(int = 2; <= b; i++) { if (!(worksheet.get_range("a" + i, misvalue).formula == null)) { a.add(worksheet.get_range("a" + i, misvalue).formula); } }
at moment i'm crudely shuffling through large number of lines, questioning whether it's null or not, adding contents list. there has easier way google has yet show me. in advanced
i might not understanding question properly, i'm guessing you're trying find cells in column have value in them , i'm assuming you're using excel interop
in c#...
for that, can use range.specialcells
method.
so, example, cells constant values or formulas use:
worksheet.range("a:a").specialcells( microsoft.office.interop.excel.xlcelltype.xlcelltypeconstants | microsoft.office.interop.excel.xlcelltype.xlcelltypeformulas)
that return range can loop through , add list, a
....
see documentation here
hope helps...
Comments
Post a Comment