Populate textbox with dynamic uploaded word file
Hi Please help me in completing my requirement.
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Amitesh VermaPosted Jul 30, 2015, 1:01 AM
{
try
{
String directory = ConfigurationSettings.AppSettings["path"];
string filepath = directory + "//" + destinationName;
string text = File.ReadAllText(filepath);
string[] lines = text.Split(new string[] { "\r\n", "\n" }, StringSplitOptions.None);
int linecount = lines.Length;
int count = 0;
File.AppendAllText(errorfile, "" + Environment.NewLine);
File.AppendAllText(errorfile, "" + Environment.NewLine);
string section = string.Empty;
for (int i = 0; i < linecount; i++)
{
count++;
string[] newlinedata = lines[i].Split(':');
for (int a = 0; a < newlinedata.Length; a++)
{
string[] linedata = newlinedata[a].Split(' ');
for (int b = 0; b < linedata.Length; b++)
{
string data = linedata[b];
if (data.Length > 6)
{
string matchCase = data.Substring(0, 6);
if (matchCase == "------")
{
section = linedata[b].Substring(6, 2);
if (section.Substring(1, 1) == ".")
{
section = "Section No:" + section.Substring(0, 1)+" ";
}
else
{
section = "Section No:" + section.Substring(0, 2);
}
}
//else
//{
// section = string.Empty;
//}
}
section =section;
if (data.Length > 4)
{
if (data == "Flash" || data == "FLASH" || data=="flash")
{
if (linedata.Length > b + 1)
{
string dataNew = linedata[b + 1];
if (dataNew == "Point" || dataNew == "Point." || dataNew == "Point:" || dataNew == "Point " || dataNew == "POINT" || dataNew == "POINT:" || dataNew=="point")
{
if (section == "Section No:" || section=="")
{
section = "";
}
else
{
label4.Visible = true;
File.AppendAllText(errorfile, "Error Type 4. Line No:" + count + " " + section + " " + lines[i] + Environment.NewLine);
label4.Text = "Error Type 4. FLash Point Found";
}
}
}
}
}
}
}
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
Raman GulatiPosted Jul 29, 2015, 11:58 AM
Raman GulatiPosted Jul 29, 2015, 11:58 AM
Amitesh VermaPosted Jul 29, 2015, 1:16 AM