Hi,
Recently i have been facing an issue while exporting data using C# and EPPLUS. I used below solution to get that done ::
Since my data is coming from stored procedure and this data is stored in a single column, i used a special character to seperate data.
ENTRY1***ENTRY2
so in excel this will be displayed as
ENTRY1
ENTRY2
if you send data from DB like for example :: ENTRY1\r\nENTRY2, it didnt work even if i convert that to a string. So, i replaced this special character in my c# code.
int rowCnt=ws.Dimension.End.Row;
for (int i = 1; i <= rowCnt; i++)
{
using (var rngs = ws.Cells["FD"+i])
{
var rt1 = rngs.RichText.Text;
if (!string.IsNullOrEmpty(rt1))
{
rngs.RichText.Clear();
rngs.Style.WrapText = true;
var rt2 = rng.RichText.Add(rt1.Replace("***", "\r\n"));
rngs.Style.WrapText = true;
}
}
}
Recently i have been facing an issue while exporting data using C# and EPPLUS. I used below solution to get that done ::
Since my data is coming from stored procedure and this data is stored in a single column, i used a special character to seperate data.
ENTRY1***ENTRY2
so in excel this will be displayed as
ENTRY1
ENTRY2
if you send data from DB like for example :: ENTRY1\r\nENTRY2, it didnt work even if i convert that to a string. So, i replaced this special character in my c# code.
int rowCnt=ws.Dimension.End.Row;
for (int i = 1; i <= rowCnt; i++)
{
using (var rngs = ws.Cells["FD"+i])
{
var rt1 = rngs.RichText.Text;
if (!string.IsNullOrEmpty(rt1))
{
rngs.RichText.Clear();
rngs.Style.WrapText = true;
var rt2 = rng.RichText.Add(rt1.Replace("***", "\r\n"));
rngs.Style.WrapText = true;
}
}
}
Cheers,
Ujjwal Soni