.net - How to load text containing commas in a single Excel cell with EPPlus -
i'm giving try epplus library , i'm stucked @ this: have load text in single cell, when text contains comma code i'm using split text along multiple cells (along right direction). here code i'm using load text:
using (excelpackage pck = new excelpackage()) { //create worksheet excelworksheet ws = pck.workbook.worksheets.add("mysheet"); using (excelrange range = ws.cells[1, 1]) { range.loadfromtext("this works"); } using (excelrange range = ws.cells[1, 2]) { range.loadfromtext("this, splits , text in 3 parts"); } } i don't find way operate on single cell or instruct loadfromtext method not split text.
you wrap in double quotes specifying textqualifier
using (excelrange range = ws.cells[1, 1]) { var format = new officeopenxml.exceltextformat(); format.delimiter = ','; format.textqualifier = '"'; format.datatypes = new[] { edatatypes.string }; range.loadfromtext("this, should, work, also, now", format); }
Comments
Post a Comment