Hi Friends ,
In my application which i am developing i am processing a CSV File.
Actually the Process is , the user will download a Excel Template for Website and make entries to Excel File and then will upload the excel file for the system to Process the record to sql.
From my application logic . i am storing the uploaded file in SQL using file stream , then when processing start , i download the file stream convert it to CSV (Pipe Seprated) and then process the file , so far i have not encountered any issue with processing ,but one column in the excel is (
Description)and users will copy paste the column , now the column has line breaks and paragraph breaks , so when i processing the file and reading the file Line by Line using Stream Reader Readline method , when it encounter the break and consider it as the end line
Any one pls suggest any solution for it below is the code for proper understanding
string fileinfo = ExcelConversion(FileName, FileID.Value);
byte[] output = UTF8Encoding.UTF8.GetBytes(fileinfo);
MemoryStream stream = new MemoryStream(output);
using (StreamReader reader = new StreamReader(stream))
{
char[] splitchar;
splitchar = new char[] { '|' };
SrcUpperBoundColumnIndex =Src_Excel_Issedetails._021_TargetCompletionDate;
DataTable IssueUploaded = CreateDataTable(reader.ReadLine());
string strIssueRecord;
while ((strIssueRecord = reader.ReadLine()) != null)
{
string[] Columns = strIssueRecord.Split(splitchar);
if (Columns.GetUpperBound(0) == (SrcUpperBoundColumnIndex.GetHashCode() + 1))
{
AddRow(Columns);
}
else
{
throw new Exception("File upload failed. Invalid column count found.");
}
}