Skip to content

Commit 48761a3

Browse files
committed
Merge pull request #51 from NatLee/master
Update
2 parents 06b144d + a873b19 commit 48761a3

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

MDIEditor/src/FileMenu.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff 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;

MDIEditor/src/TextToPDF.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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 {

0 commit comments

Comments
 (0)