Click here to Skip to main content
15,906,947 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
my code like as

C#
private void btnOnlineSubmit_Click(object sender, EventArgs e)
       {
           string dpath = @"E:\ClusterGroups";
           DirectoryInfo d1 = new DirectoryInfo(dpath);
           DirectoryInfo[] d2 = d1.GetDirectories("*.*");
           foreach (DirectoryInfo d3 in d2)
           {
               filecnt = d2.Length;
               string DeleteFPath = "";
               FileInfo[] filenames = d3.GetFiles("*.*");

               for (int i = 0; i <= filenames.Length - 1; i++)
               {



                   Fileinfo f1 = new Fileinfo();
                   Fileinfo f2 = new Fileinfo();
                   f1.Ffullname = filenames[i].FullName;

                   f1.Fextension = filenames[i].Extension;

                   string fs = "";
                   string fs1 = "";

                   if (filenames[i].Extension == ".pdf" && FExtension == ".pdf")
                   {

                       fs = ExtractTextFromPdf(f1.Ffullname);
                       fs1 = Extract(OPath);

                   }
                   else if (filenames[i].Extension == ".txt" && FExtension == ".txt")
                   {

                 <pre lang="c#">      fs = File.ReadAllText(f1.Ffullname);

fs1 = File.ReadAllText(OPath);
}
else if (filenames[i].Extension == ".docx" && FExtension == ".docx")
{
TextExtractor extractor = new TextExtractor(f1.Ffullname);
TextExtractor extractor1 = new TextExtractor(OPath);
fs = extractor.ExtractText();
fs1 = extractor1.ExtractText();
}




in this above code first problem is reads the data from text file

C#
fs = File.ReadAllText(f1.Ffullname);


this above statment not read the content from text file.this statement read the datetime only.i had found by break points.
fs string read datetime.this can be found by breakpoint only
please slove the probelm

another problem is raise error like as

"cannot find central directory"

this error raise at
C#
fs = extractor.ExtractText();


if u want to read the data from .docx file use the namespace i.e

using Code7248.word_reader;

in this textextrator added in library.

please help me.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900