|
@@ -410,28 +410,27 @@ public class FileUtils {
|
|
|
file_path = "/Users/hongchuangyanfa/Desktop/";
|
|
|
} else if (SystemUtils.isWindows()) {
|
|
|
file_path = "C://upload";
|
|
|
- } else if (SystemUtils.isLinux()) {
|
|
|
- file_path = "/home/pdfFiles/";
|
|
|
}
|
|
|
return file_path;
|
|
|
}
|
|
|
|
|
|
|
|
|
public static void main123(String[] args) throws Exception {
|
|
|
- String excelUrl = "/Users/hongchuangyanfa/Downloads/C4.13路基压实度汇总表.xlsx";
|
|
|
+ String excelUrl = "/Users/hongchuangyanfa/Downloads/C10.28隧道注浆施工记录表.xlsx";
|
|
|
String old_html = "/Users/hongchuangyanfa/Desktop/pdf/old_html.html";
|
|
|
String old_xlsx = "/Users/hongchuangyanfa/Desktop/pdf/old_html.xlsx";
|
|
|
|
|
|
- // File data = new File(excelUrl);
|
|
|
- // InputStream inputStream = new FileInputStream(data);
|
|
|
- // excelInfo(inputStream,old_xlsx,old_html,"1");
|
|
|
+ File data = new File(excelUrl);
|
|
|
+ InputStream inputStream = new FileInputStream(data);
|
|
|
+ excelInfo(inputStream,old_xlsx,old_html,"1");
|
|
|
+
|
|
|
|
|
|
- String new_html = "/Users/hongchuangyanfa/Desktop/pdf/new_html.html";
|
|
|
+/* String new_html = "/Users/hongchuangyanfa/Desktop/pdf/new_html.html";
|
|
|
String new_xlsx = "/Users/hongchuangyanfa/Desktop/pdf/new_html.xlsx";
|
|
|
|
|
|
File data = new File(old_xlsx);
|
|
|
InputStream inputStream = new FileInputStream(data);
|
|
|
- excelInfo(inputStream, new_xlsx, new_html, "2");
|
|
|
+ excelInfo(inputStream,new_xlsx,new_html,"2");*/
|
|
|
}
|
|
|
|
|
|
|
|
@@ -478,11 +477,11 @@ public class FileUtils {
|
|
|
CellRange mergedCell = sheet.getCellRange(oldcell.getRow(), oldcell.getColumn());
|
|
|
String data = mergedCell.getDataValidation().getErrorMessage();
|
|
|
int k = 0;
|
|
|
- if (Func.isNumeric(data)) {
|
|
|
+ if(Func.isNumeric(data)){
|
|
|
k = Func.toInt(data);
|
|
|
}
|
|
|
if (maxVal < k) {
|
|
|
- maxVal = k;
|
|
|
+ maxVal = k;
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -491,25 +490,24 @@ public class FileUtils {
|
|
|
CellRange oldcell = mergedCells[i];
|
|
|
CellRange mergedCell = sheet.getCellRange(oldcell.getRow(), oldcell.getColumn());
|
|
|
String data = mergedCell.getDataValidation().getErrorMessage();
|
|
|
- System.out.println(mergedCell.getValue() + "---" + data);
|
|
|
if (StringUtils.isEmpty(data)) {
|
|
|
- if (maxVal <= 0) {
|
|
|
+ if(maxVal<=0){
|
|
|
j = j + 1;
|
|
|
- } else {
|
|
|
- maxVal = maxVal + 1;
|
|
|
- j = maxVal;
|
|
|
+ }else{
|
|
|
+ maxVal = maxVal+1;
|
|
|
+ j=maxVal;
|
|
|
}
|
|
|
} else {
|
|
|
- if (Func.isNumeric(data)) {
|
|
|
+ if(Func.isNumeric(data)){
|
|
|
j = Func.toInt(data);
|
|
|
- } else {
|
|
|
+ }else {
|
|
|
j = Func.toInt((data.trim().replaceAll("\r|\n", "")).split(":")[1] + "");
|
|
|
}
|
|
|
}
|
|
|
// 目标表添加备注信息
|
|
|
- sheet2.getCellRange(oldcell.getRow(), oldcell.getColumn()).getDataValidation().setErrorMessage(j + "");
|
|
|
- mergedCell.getDataValidation().setErrorMessage(j + "");
|
|
|
- mergedCell.setValue(j + "");
|
|
|
+ sheet2.getCellRange(oldcell.getRow(), oldcell.getColumn()).getDataValidation().setErrorMessage(j+"");
|
|
|
+ mergedCell.getDataValidation().setErrorMessage(j+"");
|
|
|
+ mergedCell.setText(j + "");
|
|
|
dataMap.put("x1", mergedCell.getRow());
|
|
|
dataMap.put("x2", mergedCell.getLastRow());
|
|
|
dataMap.put("y1", mergedCell.getColumn());
|
|
@@ -524,22 +522,22 @@ public class FileUtils {
|
|
|
String data = mergedCell.getDataValidation().getErrorMessage();
|
|
|
Map<String, Integer> dataMap = new HashMap<>();
|
|
|
if (StringUtils.isEmpty(data)) {
|
|
|
- if (maxVal <= 0) {
|
|
|
+ if(maxVal<=0){
|
|
|
j = j + 1;
|
|
|
- } else {
|
|
|
- maxVal = maxVal + 1;
|
|
|
- j = maxVal;
|
|
|
+ }else{
|
|
|
+ maxVal = maxVal+1;
|
|
|
+ j=maxVal;
|
|
|
}
|
|
|
} else {
|
|
|
- if (Func.isNumeric(data)) {
|
|
|
+ if(Func.isNumeric(data)){
|
|
|
j = Func.toInt(data);
|
|
|
- } else {
|
|
|
+ }else {
|
|
|
j = Func.toInt((data.trim().replaceAll("\r|\n", "")).split(":")[1] + "");
|
|
|
}
|
|
|
}
|
|
|
- sheet2.getCellRange(oldcell.getRow(), oldcell.getColumn()).getDataValidation().setErrorMessage(j + "");
|
|
|
+ sheet2.getCellRange(oldcell.getRow(), oldcell.getColumn()).getDataValidation().setErrorMessage(j+"");
|
|
|
oldcell.getComment().getRichText().setText(j + "");
|
|
|
- mergedCell.setValue(j + "");
|
|
|
+ mergedCell.setText(j + "");
|
|
|
dataMap.put("x1", mergedCell.getRow());
|
|
|
dataMap.put("x2", mergedCell.getLastRow());
|
|
|
dataMap.put("y1", mergedCell.getColumn());
|
|
@@ -571,9 +569,11 @@ public class FileUtils {
|
|
|
Elements td2 = trs2.get(i).select("td");
|
|
|
for (int x = 0; x < td1.size(); x++) {
|
|
|
Element cell1 = td1.get(x);
|
|
|
- if (cell1.children().size() >= 1) {
|
|
|
+ /*if (cell1.children().size() >= 1) {
|
|
|
+ String data = cell1.text();
|
|
|
cell1.empty();
|
|
|
- }
|
|
|
+ cell1.text(data);
|
|
|
+ }*/
|
|
|
Element cell2 = td2.get(x);
|
|
|
String html = cell2.text();
|
|
|
Map<String, Integer> xyMap = xyList.get(html);
|
|
@@ -582,7 +582,7 @@ public class FileUtils {
|
|
|
cell1.attr("x2", xyMap.get("x2") + "");
|
|
|
cell1.attr("y1", xyMap.get("y1") + "");
|
|
|
cell1.attr("y2", xyMap.get("y2") + "");
|
|
|
- cell1.attr("exceVal", html);
|
|
|
+ cell1.attr("exceVal",html);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -590,7 +590,7 @@ public class FileUtils {
|
|
|
File writeFile = new File(htmlUrl);
|
|
|
FileUtil.writeToFile(writeFile, doc1.html(), Boolean.parseBoolean("UTF-8"));
|
|
|
if (html2.exists()) {
|
|
|
- html2.delete();
|
|
|
+ // html2.delete();
|
|
|
}
|
|
|
fileInputStream.close();
|
|
|
wb2.dispose();
|