/// <summary>
        /// pptword解析
        /// </summary>
        /// <param name="data">输入文本路径</param>
        /// <param name="strout">输出解析文本</param>
        public void PptWordExtract(string data, out string strout)
        {
            IOfficeFile _file;

            strout = "";
            string ans = "";

            //检查文件数据
            if (File.Exists(data))
            {
                try
                {
                    _file = OfficeFileFactory.CreateOfficeFile(data);
                    ans   = string.Format((_file == null ? "Failed to open \"{0}\"." : ""), data);

                    ShowSummary(_file.SummaryInformation);
                    strout = ShowContent(_file);                    //展示文件内容
                    ShowSummary(_file.DocumentSummaryInformation);
                }
                catch (Exception ex)
                {
                    ans = string.Format("Error: {0}", ex.Message);
                    Console.WriteLine(ans);
                }
            }
        }
Exemplo n.º 2
0
 private void OpenFile(String filePath)
 {
     try
     {
         this._file = OfficeFileFactory.CreateOfficeFile(this.dlgOpen.FileName);
         this.tbInformation.Text = String.Format((this._file == null ? "Failed to open \"{0}\"." : ""), this.dlgOpen.FileName);
         this.Text = String.Format("{0} - {1}", filePath, PROGRAM_TITLE);
     }
     catch (Exception ex)
     {
         this.CloseFile();
         this.tbInformation.Text = String.Format("Error: {0}", ex.Message);
     }
 }
        private IOfficeFile _file;          //텍스트 추출 객체

        public void OpenFile(String filePath)
        {
            string fileName      = System.IO.Path.GetFileNameWithoutExtension(filePath);
            string fileExtension = System.IO.Path.GetExtension(filePath);
            string addName       = fileName + fileExtension;

            try
            {
                this._file = OfficeFileFactory.CreateOfficeFile(filePath);
            }
            catch (Exception e)
            {
                this.CloseFile();
            }
        }
        public void OpenFile(String filePath)
        {
            string fileName      = System.IO.Path.GetFileNameWithoutExtension(filePath);
            string fileExtension = System.IO.Path.GetExtension(filePath);
            string addName       = fileName + fileExtension;

            try
            {
                this._file = OfficeFileFactory.CreateOfficeFile(filePath);
                Console.WriteLine(String.Format((this._file == null ? "Failed to open \"{0}\"." : ""), filePath));
            }
            catch (Exception ex)
            {
                this.CloseFile();
                Console.WriteLine(ex.Message);
            }
        }