Удалили объединения ячеек
This commit is contained in:
@@ -8,6 +8,7 @@ import org.apache.poi.ss.usermodel.Cell;
|
|||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
import org.apache.poi.ss.usermodel.WorkbookFactory;
|
||||||
|
import org.apache.poi.ss.util.CellRangeAddress;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileNotFoundException;
|
import java.io.FileNotFoundException;
|
||||||
@@ -95,4 +96,16 @@ public class Corrector1S {
|
|||||||
mapRecords.put(key, record);
|
mapRecords.put(key, record);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void removeMergedCells() {
|
||||||
|
while (sheet.getNumMergedRegions() > 5) {
|
||||||
|
for(int m = 0; m < sheet.getNumMergedRegions(); m++) {
|
||||||
|
CellRangeAddress cellRangeAddress = sheet.getMergedRegion(m);
|
||||||
|
if (cellRangeAddress.getFirstColumn() >= 10) {
|
||||||
|
sheet.removeMergedRegion(m);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ public class Main {
|
|||||||
corrector1S.setHonorarium((Double) optionSet.valueOf("fee"));
|
corrector1S.setHonorarium((Double) optionSet.valueOf("fee"));
|
||||||
corrector1S.check();
|
corrector1S.check();
|
||||||
corrector1S.createSnapshotData();
|
corrector1S.createSnapshotData();
|
||||||
|
corrector1S.removeMergedCells();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -138,7 +138,7 @@ public class MainController {
|
|||||||
}
|
}
|
||||||
corrector.setHonorarium(gonorar.getValue());
|
corrector.setHonorarium(gonorar.getValue());
|
||||||
|
|
||||||
progressBar.setProgress(0.3d);
|
progressBar.setProgress(0.10d);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
corrector.check();
|
corrector.check();
|
||||||
@@ -150,6 +150,8 @@ public class MainController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progressBar.setProgress(0.20d);
|
||||||
|
|
||||||
try {
|
try {
|
||||||
corrector.createSnapshotData();
|
corrector.createSnapshotData();
|
||||||
} catch (IOException | InvalidFormatException e) {
|
} catch (IOException | InvalidFormatException e) {
|
||||||
@@ -160,6 +162,9 @@ public class MainController {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
progressBar.setProgress(0.30d);
|
||||||
|
corrector.removeMergedCells();
|
||||||
|
|
||||||
progressBar.setProgress(1.0d);
|
progressBar.setProgress(1.0d);
|
||||||
buildInfoDialog("Информация", "Преобразование завершено успешно")
|
buildInfoDialog("Информация", "Преобразование завершено успешно")
|
||||||
.showAndWait();
|
.showAndWait();
|
||||||
|
|||||||
Reference in New Issue
Block a user