public List <UniqueWords> ReadFileContent() { if (DocumentInfo.Extension == ".doc") { try { Word2pdf w2p = new Word2pdf(); string pathToPdf = w2p.ConvertToPdf(DocumentInfo.Filename); ReadPdf(pathToPdf); } catch (COMException) { MessageBox.Show("Unable to read this document. It may be corrupt."); } } else if (DocumentInfo.Extension == ".docx") { try { var w2p = new Word2pdf(); string pathToPdf = w2p.ConvertToPdf(DocumentInfo.Filename); ReadPdf(pathToPdf); } catch (COMException) { MessageBox.Show("Unable to read this document. It may be corrupt."); } } else if (DocumentInfo.Extension == ".odt") { try { var w2p = new Word2pdf(); string pathToPdf = w2p.ConvertToPdf(DocumentInfo.Filename); ReadPdf(pathToPdf); } catch (COMException) { MessageBox.Show("Unable to read this document. It may be corrupt."); } } else { ReadPdf(DocumentInfo.Filename); } return(UniqueWordList); }
public List<UniqueWords> ReadFileContent() { if (DocumentInfo.Extension == ".doc") { try { Word2pdf w2p = new Word2pdf(); string pathToPdf = w2p.ConvertToPdf(DocumentInfo.Filename); ReadPdf(pathToPdf); } catch (COMException) { MessageBox.Show("Unable to read this document. It may be corrupt."); } } else if(DocumentInfo.Extension==".docx") { try { var w2p = new Word2pdf(); string pathToPdf = w2p.ConvertToPdf(DocumentInfo.Filename); ReadPdf(pathToPdf); } catch (COMException) { MessageBox.Show("Unable to read this document. It may be corrupt."); } } else if(DocumentInfo.Extension == ".odt") { try { var w2p = new Word2pdf(); string pathToPdf = w2p.ConvertToPdf(DocumentInfo.Filename); ReadPdf(pathToPdf); } catch (COMException) { MessageBox.Show("Unable to read this document. It may be corrupt."); } } else { ReadPdf(DocumentInfo.Filename); } return UniqueWordList; }