엑셀관련 기능 소스 이동

main
이범준 2 months ago
parent bb3a585d01
commit 104330bd75

@ -1,68 +0,0 @@
package cokr.xit.fims.cmmn.xls;
import java.io.File;
import java.util.Map;
import org.apache.poi.hssf.util.HSSFColor;
import cokr.xit.base.docs.xls.Comment;
import cokr.xit.base.docs.xls.Format;
import cokr.xit.base.docs.xls.Style;
import cokr.xit.foundation.data.DataFormat;
public class FormatMaker {
@SuppressWarnings("rawtypes")
public static Format photoCellForApproval(Format format, Comment comment, String key) {
return format.of(key)
.value(obj -> {
if(((Map)obj).get(key) == null) {
return "없음";
}
String value = (String)((Map)obj).get(key);
if(value.equals("")) {
return "없음";
}
if(!(new File(value)).exists()) {
return "이미지 경로 존재하지 않음";
}
if((new File(value)).length() == 0) {
return "이미지 크기 오류";
}
if((new File(value)).length() > (1024 * 1024 * 3)){
return "사진크기(3MB)초과";
}
return " ";
})
.onCell(obj -> {
if(((Map)obj).get(key) == null) { return; }
String value = (String)((Map)obj).get(key);
if(value.equals("")) { return; }
if(!(new File(value)).exists()) { return; }
if((new File(value)).length() == 0) { return; }
if((new File(value)).length() > (1024 * 1024 * 3)){ return; }
comment.setImageComment((String)((Map)obj).get(key));
})
.style(new Style().foregroundColor(HSSFColor.HSSFColorPredefined.YELLOW.getIndex()));
}
@SuppressWarnings("rawtypes")
public static Format yyyy_mm_dd_hh_mm_ss(Format format, String key) {
return format.of(key).value(o -> {
return DataFormat.yyyy_mm_dd_hh_mm_ss(((Map) o).get(key));
});
}
@SuppressWarnings("rawtypes")
public static Format yyyy_mm_dd(Format format, String key) {
return format.of(key).value(o -> {
return DataFormat.yyyy_mm_dd(((Map) o).get(key));
});
}
}

@ -1,24 +0,0 @@
package cokr.xit.fims.cmmn.xls;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Font;
import org.apache.poi.ss.usermodel.HorizontalAlignment;
import cokr.xit.base.docs.xls.Style;
import cokr.xit.base.docs.xls.XLSWriter;
public class StyleMaker {
public static Style headerStyle(XLSWriter xlsx) {
return new Style()
.foregroundColor(HSSFColor.HSSFColorPredefined.GREY_25_PERCENT.getIndex())
.configure(styl -> {
Font font = xlsx.workbook().createFont();
font.setColor(HSSFColor.HSSFColorPredefined.BLACK.getIndex());
styl.font(font);
styl.alignment(HorizontalAlignment.CENTER);
});
}
}
Loading…
Cancel
Save