Browse Source

统计问题处理

Bob 5 months ago
parent
commit
9be3aa0bf9

+ 3 - 3
src/main/java/cn/kdan/ExcelUtil.java

@@ -275,19 +275,19 @@ public class ExcelUtil {
                 for (File file : directoryListing) {
                     String appName = extractAppNameFromFile(file);
                     for (Sheet sheet : workbook) {
-                        if (sheet.getSheetName().contains(appName)) {
+                        if (sheet.getSheetName().contains(appName + ")")) {
                             int rowNum = 0;
                             try (BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(file), "UTF-16LE"))) { // 指定编码为 UTF-16LE
                                 String line;
                                 while ((line = br.readLine()) != null) {
-                                    if (++rowNum > 3) { // Start from the fourth line
+                                    if (++rowNum > 1) { // Start from the fourth line
                                         // 使用正则表达式找到任意字符后面跟着两个空格的位置
                                         Pattern pattern = Pattern.compile("(.).\\s\\s");
                                         Matcher matcher = pattern.matcher(line);
                                         if (matcher.find()) {
                                             int index = matcher.start() + 2; // 匹配的起始位置加上三个字符长度
 
-                                            Row row = sheet.createRow(rowNum - 3 + 1) ;
+                                            Row row = sheet.createRow(rowNum) ;
                                             // 在找到的位置进行分割
                                             String part1 = line.substring(0, index).trim();
                                             Cell cell = row.createCell(0);

BIN
src/main/resources/windows/InstalledSoftwareList(何璇).txt


BIN
src/main/resources/windows/InstalledSoftwareList(刘佳).txt