| @@ -45,7 +45,7 @@ public class HtmlToExcelServer { | |||
| .getLogger(HtmlToExcelServer.class); | |||
| //样式 | |||
| private final List<ICssConvertToExcel> STYLE_APPLIERS = new LinkedList<ICssConvertToExcel>(); | |||
| private static final List<ICssConvertToExcel> STYLE_APPLIERS = new LinkedList<ICssConvertToExcel>(); | |||
| { | |||
| STYLE_APPLIERS.add(new AlignCssConvertImpl()); | |||
| STYLE_APPLIERS.add(new BackgroundCssConvertImpl()); | |||
| @@ -54,7 +54,7 @@ public class HtmlToExcelServer { | |||
| } | |||
| //Cell 高宽 | |||
| private final List<ICssConvertToExcel> SHEET_APPLIERS = new LinkedList<ICssConvertToExcel>(); | |||
| private static final List<ICssConvertToExcel> SHEET_APPLIERS = new LinkedList<ICssConvertToExcel>(); | |||
| { | |||
| SHEET_APPLIERS.add(new WidthCssConverImpl()); | |||
| SHEET_APPLIERS.add(new HeightCssConverImpl()); | |||
| @@ -31,12 +31,6 @@ public class BorderCssConverImpl implements ICssConvertToExcel, ICssConvertToHtm | |||
| @Override | |||
| public String convertToHtml(Cell cell, CellStyle cellStyle, CellStyleEntity style) { | |||
| return null; | |||
| } | |||
| @Override | |||
| public void convertToExcel(Cell cell, CellStyle cellStyle, CellStyleEntity style) { | |||
| CellStyleBorderEntity border = new CellStyleBorderEntity(); | |||
| border.setBorderBottom(cellStyle.getBorderBottom()); | |||
| border.setBorderBottomColor(cellStyle.getBottomBorderColor()); | |||
| @@ -47,6 +41,11 @@ public class BorderCssConverImpl implements ICssConvertToExcel, ICssConvertToHtm | |||
| border.setBorderTop(cellStyle.getBorderTop()); | |||
| border.setBorderTopColor(cellStyle.getTopBorderColor()); | |||
| style.setBorder(border); | |||
| return null; | |||
| } | |||
| @Override | |||
| public void convertToExcel(Cell cell, CellStyle cellStyle, CellStyleEntity style) { | |||
| } | |||
| } | |||
| @@ -15,6 +15,8 @@ | |||
| */ | |||
| package org.jeecgframework.poi.excel.html.entity; | |||
| import org.apache.commons.lang3.builder.ReflectionToStringBuilder; | |||
| /** | |||
| * 边框样式 | |||
| * @author JueYue | |||
| @@ -22,84 +24,92 @@ package org.jeecgframework.poi.excel.html.entity; | |||
| */ | |||
| public class CellStyleBorderEntity { | |||
| private short borderLeft; | |||
| private short borderRight; | |||
| private short borderTop; | |||
| private short borderBottom; | |||
| private short borderLeftColor; | |||
| private short borderRightColor; | |||
| private short borderTopColor; | |||
| private short borderBottomColor; | |||
| public short getBorderLeft() { | |||
| return borderLeft; | |||
| } | |||
| public void setBorderLeft(short borderLeft) { | |||
| this.borderLeft = borderLeft; | |||
| } | |||
| public short getBorderRight() { | |||
| return borderRight; | |||
| } | |||
| public void setBorderRight(short borderRight) { | |||
| this.borderRight = borderRight; | |||
| } | |||
| public short getBorderTop() { | |||
| return borderTop; | |||
| } | |||
| public void setBorderTop(short borderTop) { | |||
| this.borderTop = borderTop; | |||
| } | |||
| public short getBorderBottom() { | |||
| return borderBottom; | |||
| } | |||
| public void setBorderBottom(short borderBottom) { | |||
| this.borderBottom = borderBottom; | |||
| } | |||
| public short getBorderLeftColor() { | |||
| return borderLeftColor; | |||
| } | |||
| public void setBorderLeftColor(short borderLeftColor) { | |||
| this.borderLeftColor = borderLeftColor; | |||
| } | |||
| public short getBorderRightColor() { | |||
| return borderRightColor; | |||
| } | |||
| public void setBorderRightColor(short borderRightColor) { | |||
| this.borderRightColor = borderRightColor; | |||
| } | |||
| public short getBorderTopColor() { | |||
| return borderTopColor; | |||
| } | |||
| public void setBorderTopColor(short borderTopColor) { | |||
| this.borderTopColor = borderTopColor; | |||
| } | |||
| public short getBorderBottomColor() { | |||
| return borderBottomColor; | |||
| } | |||
| public void setBorderBottomColor(short borderBottomColor) { | |||
| this.borderBottomColor = borderBottomColor; | |||
| } | |||
| private short borderLeft; | |||
| private short borderRight; | |||
| private short borderTop; | |||
| private short borderBottom; | |||
| private short borderLeftColor; | |||
| private short borderRightColor; | |||
| private short borderTopColor; | |||
| private short borderBottomColor; | |||
| public short getBorderLeft() { | |||
| return borderLeft; | |||
| } | |||
| public void setBorderLeft(short borderLeft) { | |||
| this.borderLeft = borderLeft; | |||
| } | |||
| public short getBorderRight() { | |||
| return borderRight; | |||
| } | |||
| public void setBorderRight(short borderRight) { | |||
| this.borderRight = borderRight; | |||
| } | |||
| public short getBorderTop() { | |||
| return borderTop; | |||
| } | |||
| public void setBorderTop(short borderTop) { | |||
| this.borderTop = borderTop; | |||
| } | |||
| public short getBorderBottom() { | |||
| return borderBottom; | |||
| } | |||
| public void setBorderBottom(short borderBottom) { | |||
| this.borderBottom = borderBottom; | |||
| } | |||
| public short getBorderLeftColor() { | |||
| return borderLeftColor; | |||
| } | |||
| public void setBorderLeftColor(short borderLeftColor) { | |||
| this.borderLeftColor = borderLeftColor; | |||
| } | |||
| public short getBorderRightColor() { | |||
| return borderRightColor; | |||
| } | |||
| public void setBorderRightColor(short borderRightColor) { | |||
| this.borderRightColor = borderRightColor; | |||
| } | |||
| public short getBorderTopColor() { | |||
| return borderTopColor; | |||
| } | |||
| public void setBorderTopColor(short borderTopColor) { | |||
| this.borderTopColor = borderTopColor; | |||
| } | |||
| public short getBorderBottomColor() { | |||
| return borderBottomColor; | |||
| } | |||
| public void setBorderBottomColor(short borderBottomColor) { | |||
| this.borderBottomColor = borderBottomColor; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return new StringBuilder().append(borderBottom).append(borderBottomColor).append(borderLeft) | |||
| .append(borderLeftColor).append(borderRight).append(borderRightColor).append(borderTop) | |||
| .append(borderTopColor).toString(); | |||
| } | |||
| } | |||
| @@ -15,83 +15,91 @@ | |||
| */ | |||
| package org.jeecgframework.poi.excel.html.entity; | |||
| import org.apache.commons.lang3.builder.ReflectionToStringBuilder; | |||
| /** | |||
| * Cell 具有的样式 | |||
| * @author JueYue | |||
| * 2016年3月20日 下午4:56:51 | |||
| */ | |||
| public class CellStyleEntity { | |||
| /** | |||
| * 宽 | |||
| */ | |||
| private String width; | |||
| /** | |||
| * 高 | |||
| */ | |||
| private String height; | |||
| /** | |||
| * 边框 | |||
| */ | |||
| private CellStyleBorderEntity border; | |||
| /** | |||
| * 背景 | |||
| */ | |||
| private String background; | |||
| /** | |||
| * 水平位置 | |||
| */ | |||
| private String align; | |||
| /** | |||
| * 垂直位置 | |||
| */ | |||
| private String vetical; | |||
| public String getWidth() { | |||
| return width; | |||
| } | |||
| public void setWidth(String width) { | |||
| this.width = width; | |||
| } | |||
| public String getHeight() { | |||
| return height; | |||
| } | |||
| /** | |||
| * 宽 | |||
| */ | |||
| private String width; | |||
| /** | |||
| * 高 | |||
| */ | |||
| private String height; | |||
| /** | |||
| * 边框 | |||
| */ | |||
| private CellStyleBorderEntity border; | |||
| /** | |||
| * 背景 | |||
| */ | |||
| private String background; | |||
| /** | |||
| * 水平位置 | |||
| */ | |||
| private String align; | |||
| /** | |||
| * 垂直位置 | |||
| */ | |||
| private String vetical; | |||
| public String getWidth() { | |||
| return width; | |||
| } | |||
| public void setWidth(String width) { | |||
| this.width = width; | |||
| } | |||
| public String getHeight() { | |||
| return height; | |||
| } | |||
| public void setHeight(String height) { | |||
| this.height = height; | |||
| } | |||
| this.height = height; | |||
| } | |||
| public CellStyleBorderEntity getBorder() { | |||
| return border; | |||
| } | |||
| public CellStyleBorderEntity getBorder() { | |||
| return border; | |||
| } | |||
| public void setBorder(CellStyleBorderEntity border) { | |||
| this.border = border; | |||
| } | |||
| public void setBorder(CellStyleBorderEntity border) { | |||
| this.border = border; | |||
| } | |||
| public String getBackground() { | |||
| return background; | |||
| } | |||
| public String getBackground() { | |||
| return background; | |||
| } | |||
| public void setBackground(String background) { | |||
| this.background = background; | |||
| } | |||
| public void setBackground(String background) { | |||
| this.background = background; | |||
| } | |||
| public String getAlign() { | |||
| return align; | |||
| } | |||
| public String getAlign() { | |||
| return align; | |||
| } | |||
| public void setAlign(String align) { | |||
| this.align = align; | |||
| } | |||
| public void setAlign(String align) { | |||
| this.align = align; | |||
| } | |||
| public String getVetical() { | |||
| return vetical; | |||
| } | |||
| public String getVetical() { | |||
| return vetical; | |||
| } | |||
| public void setVetical(String vetical) { | |||
| this.vetical = vetical; | |||
| } | |||
| public void setVetical(String vetical) { | |||
| this.vetical = vetical; | |||
| } | |||
| @Override | |||
| public String toString() { | |||
| return new StringBuilder().append(align).append(background).append(border).append(height) | |||
| .append(vetical).append(width).toString(); | |||
| } | |||
| } | |||