|
|
@@ -22,6 +22,7 @@ import java.io.FileOutputStream;
|
|
|
import java.io.IOException;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
|
|
|
public class PdfAddContextUtils {
|
|
|
|
|
|
@@ -68,6 +69,44 @@ public class PdfAddContextUtils {
|
|
|
}
|
|
|
return "";
|
|
|
}
|
|
|
+ public static String getExcelFullTitleByProjectName(org.apache.poi.ss.usermodel.Workbook workbook, String projectName) {
|
|
|
+ Sheet sheet = workbook.getSheetAt(0);
|
|
|
+ sheet.setForceFormulaRecalculation(true);
|
|
|
+ for (int i = 0; i < 6; i++) {
|
|
|
+ Row row = sheet.getRow(i);
|
|
|
+ if (row == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ short cellNum = row.getLastCellNum();
|
|
|
+ for (int j = 0; j < cellNum; j++) {
|
|
|
+ Cell cell = row.getCell(j);
|
|
|
+ if (cell == null || cell.getCellTypeEnum() != CellType.STRING) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ String cellValue = cell.getStringCellValue();
|
|
|
+ if (cellValue == null || cellValue.isEmpty()) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ if (Objects.equals(cellValue, projectName) && i + 1 < sheet.getLastRowNum()) {
|
|
|
+ Row row1 = sheet.getRow(i + 1);
|
|
|
+ if (row1 == null) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ for (int k = 0; k < row1.getLastCellNum(); k++) {
|
|
|
+ Cell cell1 = row1.getCell(k);
|
|
|
+ if (cell1 == null || cell1.getCellTypeEnum() != CellType.STRING) {
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ cellValue = cell1.getStringCellValue();
|
|
|
+ if (cellValue != null && cellValue.trim().length() > 2) {
|
|
|
+ return cellValue;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return "";
|
|
|
+ }
|
|
|
|
|
|
|
|
|
public static boolean containsAllCharactersInOrder(String str, String str1) {
|