|
@@ -29,6 +29,8 @@ import org.apache.http.client.methods.HttpGet;
|
|
|
import org.apache.http.impl.client.CloseableHttpClient;
|
|
|
import org.apache.http.impl.client.HttpClients;
|
|
|
import org.apache.pdfbox.pdmodel.PDDocument;
|
|
|
+import org.apache.poi.hwpf.extractor.WordExtractor;
|
|
|
+import org.apache.poi.ooxml.POIXMLDocument;
|
|
|
import org.apache.poi.ss.usermodel.Workbook;
|
|
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
|
|
import org.apache.poi.xwpf.usermodel.XWPFDocument;
|
|
@@ -42,12 +44,12 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
-import javax.swing.text.Document;
|
|
|
import javax.xml.parsers.DocumentBuilder;
|
|
|
import java.io.File;
|
|
|
import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
+import java.math.BigInteger;
|
|
|
import java.net.URLDecoder;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.text.ParseException;
|
|
@@ -162,11 +164,17 @@ public class InscriptionService {
|
|
|
String substring = srcFile.getName().substring(srcFile.getName().lastIndexOf(".")+1, srcFile.getName().length());
|
|
|
// //判断附件类型是doc,pdf,xls格式
|
|
|
// //word文件
|
|
|
- if (substring.equals("doc") || substring.equals("docx")){
|
|
|
+ if (substring.equals("doc") ){
|
|
|
//读取文件信息
|
|
|
FileInputStream inputStream = new FileInputStream(srcFile);
|
|
|
+ WordExtractor wordExtractor = new WordExtractor(inputStream);
|
|
|
+ total += wordExtractor.getSummaryInformation().getPageCount();
|
|
|
+ wordExtractor.close();
|
|
|
+ }
|
|
|
+ if ( substring.equals("docx")){
|
|
|
+ FileInputStream inputStream = new FileInputStream(srcFile);
|
|
|
XWPFDocument xwpfDocument = new XWPFDocument(inputStream);
|
|
|
- total+=xwpfDocument.getProperties().getExtendedProperties().getUnderlyingProperties().getPages();
|
|
|
+ total += xwpfDocument.getProperties().getExtendedProperties().getUnderlyingProperties().getPages();
|
|
|
xwpfDocument.close();
|
|
|
}
|
|
|
//excel文件
|