File tree Expand file tree Collapse file tree 2 files changed +6
-3
lines changed
Expand file tree Collapse file tree 2 files changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -115,6 +115,9 @@ public class FileMenu extends JFrame {
115115 //顯示開啟檔案對話盒
116116 if (result == JFileChooser .APPROVE_OPTION ) { //使用者按下 確認 按鈕
117117 File file = fcOpen .getSelectedFile (); //取得選取的檔案
118+ ExtractText extractor = new ExtractText ();
119+ String filePathArray []={file .getPath ()};
120+ extractor .startExtraction (filePathArray );
118121 try {
119122 openYee .loadAudio (Yee );//載入yee
120123 } catch (Exception YeeException ) {
@@ -123,8 +126,8 @@ public class FileMenu extends JFrame {
123126 openYee .play ();
124127 System .setProperty ("apple.awt.UIElement" , "true" );
125128 String FP , FN ;
126- FP = file .getPath ().replace ( ".pdf" , ". txt"); //去尾
127- FN = file .getName ().replace ( ".pdf" , ". txt"); //加上TXT
129+ FP = file .getPath ().substring ( 0 , file . getPath (). length () - 3 ) + " txt";
130+ FN = file .getName ().substring ( 0 , file . getName (). length () - 3 ) + " txt";
128131 MDIEditor .internalEditor .createInternalFrame (FP , FN );//以取得的檔案建立TextInternalFrame物件
129132 }
130133 break ;
Original file line number Diff line number Diff line change @@ -47,7 +47,7 @@ public TextToPDF() {
4747 public static void convert (File file ) throws DocumentException {
4848 Document document = new Document ();
4949 document .setPageSize (PageSize .A4 );
50- String fileName = file .getName ().replace ( ".txt" , ". pdf") ;
50+ String fileName = file .getName ().substring ( 0 , file . getName (). length () - 3 ) + " pdf" ;
5151
5252 FileReader reader = null ;
5353 try {
You can’t perform that action at this time.
0 commit comments