c# - How to get column or selected cell values using objectlistview? -
i want copy content of selected column or cells using objectlistview
. when draw selected rectangle using mouse , try ctrl + c copies content of selected row's , columns not want it. 2ndly want add serial number header of row.is object list view allow or handle automatically configuration.
if see image. if press ctrl + c ctrl + v copies rows this:
zafbgb003ynbgz6 b003ynbnz6 $22.61 $22.40 $ -0.21 % -0.93 1 2391817 acceptable merchant 21 10 zafbnb003ynbnz6 b003ynbnz6 $126.69 $22.40 $ -104.29 % -82.32 1 2391817 new acceptable merchant 21 10
while want copy these values this.
2391817 2391817
if know column want, can simple this:
var olvcolumn = olv.getcolumn(6); // whichever column want var sb = new stringbuilder(); foreach (object model in olv.selectedobjects) sb.appendline(olvcolumn.getstringvalue(model)); var selectedcellsastext = sb.tostring();
now, can selectedcellsastext
Comments
Post a Comment