StreamReader readerd = new StreamReader(File.OpenRead(cvsFiles)) (Type.Missing, xlWorkSheet, Type.Missing, Type.Missing) Worksheet xlWorkSheet įor (int i = 0 i < cvsFiles.Length i++) Array.Sort(lista, new AlphanumComparatorFast()) String cvsFiles = Directory.GetFiles(pathString) Īrray.Sort(cvsFiles, new AlphanumComparatorFast()) (System.IO.Path.GetFileName(fileNames).Replace(".pdf", "") + "-CSVs\\" + "Sheet_" + (i + 1).ToString()) + ".csv") Įxcel.Application xlApp = new .Application() Ĭonsole.WriteLine("Excel is not properly installed!!") String outfile = fileNames.Replace((System.IO.Path.GetFileName(fileNames)), string outfile = fileNames.Replace((System.IO.Path.GetFileName(fileNames)), (System.IO.Path.GetFileName(fileNames).Replace(".pdf", "") + "_" + (i + 1).ToString()) + ext) Įxtractor.LoadDocumentFromFile(outfilePDF)
String outfilePDF = fileNames.Replace((System.IO.Path.GetFileName(fileNames)), System.IO.Directory.CreateDirectory(pathString) String folderName = pathString = System.IO.Path.Combine(folderName, System.IO.Path.GetFileName(fileNames).Replace(".pdf", "")) + "-CSVs" String outfilePDFExcel1 = fileNames.Replace((System.IO.Path.GetFileName(fileNames)), string outfilePDF1 = fileNames.Replace((System.IO.Path.GetFileName(fileNames)), (System.IO.Path.GetFileName(fileNames).Replace(".pdf", "") + "_rez" + ".csv")) Excel.Application app = new Excel.Application() ĬSVExtractor extractor = new CSVExtractor() String ext = System.IO.Path.GetExtension(fileNames) Var matches = emailRegex.Matches(content) Public IEnumerable ExtractEmails(string content)
Here is example (not perfect) of reading PDF with iTextSharp and extracting emails: public string PdfToString(string fileName)įor (int page = 1 page. If you don't need rock solid solution, it would be easiest to read all PDF to a string and then retrieve emails using regular expression.
I recommend iTextSharp as it is popular and easy to use.
#How to export pdf to excel for free free#
If it contains textual data, then you are right about using "some free dll". You absolutely do not have to convert PDF to Excel.įirst of all, please determine whether your PDF contains textual data, or it is scanned image.