This project has moved. For the latest updates, please go here.

Comma separated values coming in separae columns

Jun 19, 2011 at 3:14 PM
Edited Jun 19, 2011 at 3:15 PM

Hi,

I am generating excel on the fly using EPPLUS. I am taking values from SQL database and putting it to excel. The problem is, i have database column which is having comma separated values like "a, b". "11111, 222222". etc When generating excel it should appear in only one column however its appearing in two columns e.g. "a" in one column and "b" in separate column. I checked all types of formatting to excel column but, it still coming in separate column. My question is, what i am doing wrong?? how can i get comma separated value to appear in just one cell??? Any help will be appreciated.

Thanks

Coordinator
Jun 22, 2011 at 6:31 PM

Sounds strange, can you provide some code how you do?

May 3, 2013 at 10:51 AM
Edited May 3, 2013 at 10:51 AM
I have the same problem; here is my code:
using (ExcelPackage pck = new ExcelPackage())
{
   //Create the 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 my , text in 3 parts");
   }
}
what I'm doing wrong?
Thank you.
Jun 20, 2013 at 1:46 PM
You could try creating a new format and setting its delimiter, e.g.
            var format = new ExcelTextFormat();
            format.Delimiter = '$'; // default is the comma
            range.LoadFromText("this, splits my, text in 3 parts", format);