Test.java 6.3 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155
package leaf.plugin.word2pdf;

public class Test {

	public static void testWord(String path_word, String pafpath) throws Exception {
		String word1 = path_word + "01正方数字.docx";
		String word2 = path_word + "02正方数字.docx";
		String word3 = path_word + "03正方数字.doc";
		String word4 = path_word + "04正方数字.doc";
		String word5 = path_word + "05正方数字.docx";
		String word6 = path_word + "06正方数字.doc";

		AsposeUtil.trans(word1, pafpath + "aspose-word-01测试.pdf","word");
		AsposeUtil.trans(word2, pafpath + "aspose-word-02测试.pdf","word");
		AsposeUtil.trans(word3, pafpath + "aspose-word-03测试.pdf","word");
		AsposeUtil.trans(word4, pafpath + "aspose-word-04测试.pdf","word");
		AsposeUtil.trans(word5, pafpath + "aspose-word-05测试.pdf","word");
		AsposeUtil.trans(word6, pafpath + "aspose-word-06测试.pdf","word");
	}

	public static void testWord2(String path_word, String pafpath) throws Exception {
		String word1 = path_word + "01.docx";
		String word2 = path_word + "02.docx";
		String word3 = path_word + "03.doc";
		String word4 = path_word + "04.doc";
		String word5 = path_word + "05.docx";
		String word6 = path_word + "06.doc";

		AsposeUtil.trans(word1, pafpath + "aspose-word-01.pdf","word");
		AsposeUtil.trans(word2, pafpath + "aspose-word-02.pdf","word");
		AsposeUtil.trans(word3, pafpath + "aspose-word-03.pdf","word");
		AsposeUtil.trans(word4, pafpath + "aspose-word-04.pdf","word");
		AsposeUtil.trans(word5, pafpath + "aspose-word-05.pdf","word");
		AsposeUtil.trans(word6, pafpath + "aspose-word-06.pdf","word");

	}

	public static void testTxt(String path_word, String pafpath) throws Exception {
		String txt1 = path_word + "01jvm.txt";
		String txt2 = path_word + "02jvm.txt";
		String txt3 = path_word + "03jvm.txt";

		AsposeUtil.trans(txt1, pafpath + "aspose-txt-01测试.pdf","txt");
		AsposeUtil.trans(txt2, pafpath + "aspose-txt-02测试.pdf","txt");
		AsposeUtil.trans(txt3, pafpath + "aspose-txt-03测试.pdf","txt");
	}

	public static void testTxt2(String path_word, String pafpath) throws Exception {
		String txt1 = path_word + "01jvm.txt";
		String txt2 = path_word + "02jvm.txt";
		String txt3 = path_word + "03jvm.txt";

		AsposeUtil.trans(txt1, pafpath + "aspose-txt-01.pdf","txt");
		AsposeUtil.trans(txt2, pafpath + "aspose-txt-02.pdf","txt");
		AsposeUtil.trans(txt3, pafpath + "aspose-txt-03.pdf","txt");
	}

	public static void testExcel(String path_word, String pafpath) throws Exception {

		String txt1 = path_word + "01部门开发任务管理.xlsx";
		String txt2 = path_word + "02部门开发任务管理.xlsx";
		String txt3 = path_word + "03部门开发任务管理.xlsx";

		AsposeUtil.trans(txt1, pafpath + "aspose-excel-01测试.pdf","txt");
		AsposeUtil.trans(txt2, pafpath + "aspose-excel-02测试.pdf","txt");
		AsposeUtil.trans(txt3, pafpath + "aspose-excel-03测试.pdf","txt");
	}

	public static void testExcel2(String path_word, String pafpath) throws Exception {

		String txt1 = path_word + "01.xlsx";
		String txt2 = path_word + "02.xlsx";
		String txt3 = path_word + "03.xlsx";

		AsposeUtil.trans(txt1, pafpath + "aspose-excel-01.pdf","txt");
		AsposeUtil.trans(txt2, pafpath + "aspose-excel-02.pdf","txt");
		AsposeUtil.trans(txt3, pafpath + "aspose-excel-03.pdf","txt");
	}

	public static void testPPt(String path_ppt, String pafpath) throws Exception {
		String txt1 = path_ppt + "01jquery.pptx";
		String txt2 = path_ppt + "02jquery.pptx";
		String txt3 = path_ppt + "03jquery.ppt";

		AsposeUtil.trans(txt1, pafpath + "aspose-ppt-01测试.pdf","ppt");
		AsposeUtil.trans(txt2, pafpath + "aspose-ppt-02测试.pdf","ppt");
		AsposeUtil.trans(txt3, pafpath + "aspose-ppt-03测试.pdf","ppt");
	}

	public static void testPPt2(String path_ppt, String pafpath) throws Exception {
		String txt1 = path_ppt + "01jquery.pptx";
		String txt2 = path_ppt + "02jquery.pptx";
		String txt3 = path_ppt + "03jquery培训.ppt";

		AsposeUtil.trans(txt1, pafpath + "aspose-ppt-01.pdf","ppt");
		AsposeUtil.trans(txt2, pafpath + "aspose-ppt-02.pdf","ppt");
		AsposeUtil.trans(txt3, pafpath + "aspose-ppt-03.pdf","ppt");
	}

	public static void winTest() throws Exception {
		String path_word = "C:/Users/Administrator.DESKTOP-QN9A3AA/Desktop/office/测试文档/转换前文档/01word/";
		String path_txt = "C:/Users/Administrator.DESKTOP-QN9A3AA/Desktop/office/测试文档/转换前文档/02txt/";
		String path_excel = "C:/Users/Administrator.DESKTOP-QN9A3AA/Desktop/office/测试文档/转换前文档/03excel/";
		String path_ppt = "C:/Users/Administrator.DESKTOP-QN9A3AA/Desktop/office/测试文档/转换前文档/04ppt/";
		String pafpath = "C:/Users/Administrator.DESKTOP-QN9A3AA/Desktop/office/测试文档/pdf/";

		System.out.println("************************");
		testWord(path_word, pafpath);
		System.out.println("************************");
		testTxt(path_txt, pafpath);
		System.out.println("************************");
		testExcel(path_excel, pafpath);
		System.out.println("************************");
		testPPt(path_ppt, pafpath);
	}

	public static void LinuxTest() throws Exception {
		String path_word = "/software/songyan/hah/01word/";
		String path_txt = "/software/songyan/hah/02txt/";
		String path_excel = "/software/songyan/hah/03excel/";
		String path_ppt = "/software/songyan/hah/04ppt/";
		String pafpath = "/software/songyan/hah/pdf/";

		System.out.println("************************");
		testWord(path_word, pafpath);
		System.out.println("************************");
		testTxt(path_txt, pafpath);
		System.out.println("************************");
		testExcel(path_excel, pafpath);
		System.out.println("************************");
		testPPt(path_ppt, pafpath);
	}

	public static void LinuxTest2() throws Exception {
		String path_word = "/software/songyan/hah/01word/";
		String path_txt = "/software/songyan/hah/02txt/";
		String path_excel = "/software/songyan/hah/03excel/";
		String path_ppt = "/software/songyan/hah/04ppt/";
		String pafpath = "/software/songyan/hah/pdf/";

		System.out.println("************************");
		testWord2(path_word, pafpath);
		System.out.println("************************");
		testTxt2(path_txt, pafpath);
		System.out.println("************************");
		testExcel2(path_excel, pafpath);
		System.out.println("************************");
		testPPt2(path_ppt, pafpath);
	}

	public static void main(String[] args) throws Exception {
		winTest();
	}

}