i want remove empty rows @ end of program exection. in details inserting results after calculation using c# in predefined excel sheets. @ end need delete/remove empty rows programatically. 1 suggest solution. code little big unable include here. understanding giving input , output view of excel. in below output excel rows d , e having empty row want remove programatically without mentioning range.
input excel /pre defined excel files
a 1 2 3 4 b c d e
output excel
a 1 2 3 4 b abc cde nac 123 c cdf fed x2 123 d e
you can using range object. assume here using excel interop.
let have book open, set range delete it should this
applicationclass excel = new applicationclass(); //... microsoft.office.interop.excel.range cel = (range)excel.cells[rowindex, columnindex]; cel.delete();
you can try using:
for(int = 1; <=20; i++) { excelrange = (excel.range)excelworksheet.cells[i, 1]; if (!string.isnullorempty(excelrange.text.tostring())) { ((range)excelworksheet.rows[i]).delete(excelrange); } }
check out link below
and
https://stackoverflow.com/a/9952004/4373895 here "something" null value.
hope helps.
Comments
Post a Comment