|
|
@ -236,7 +236,53 @@ public class WriteCellStyle { |
|
|
|
return null; |
|
|
|
return null; |
|
|
|
} |
|
|
|
} |
|
|
|
WriteCellStyle writeCellStyle = new WriteCellStyle(); |
|
|
|
WriteCellStyle writeCellStyle = new WriteCellStyle(); |
|
|
|
if (styleProperty != null) { |
|
|
|
buildStyleProperty(styleProperty, writeCellStyle); |
|
|
|
|
|
|
|
buildFontProperty(fontProperty, writeCellStyle); |
|
|
|
|
|
|
|
return writeCellStyle; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void buildFontProperty(FontProperty fontProperty, WriteCellStyle writeCellStyle) { |
|
|
|
|
|
|
|
if (fontProperty == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (writeCellStyle.getWriteFont() == null) { |
|
|
|
|
|
|
|
writeCellStyle.setWriteFont(new WriteFont()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
WriteFont writeFont = writeCellStyle.getWriteFont(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(fontProperty.getFontName())) { |
|
|
|
|
|
|
|
writeFont.setFontName(fontProperty.getFontName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getFontHeightInPoints() != null) { |
|
|
|
|
|
|
|
writeFont.setFontHeightInPoints(fontProperty.getFontHeightInPoints()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getItalic() != null) { |
|
|
|
|
|
|
|
writeFont.setItalic(fontProperty.getItalic()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getStrikeout() != null) { |
|
|
|
|
|
|
|
writeFont.setStrikeout(fontProperty.getStrikeout()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getColor() != null) { |
|
|
|
|
|
|
|
writeFont.setColor(fontProperty.getColor()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getTypeOffset() != null) { |
|
|
|
|
|
|
|
writeFont.setTypeOffset(fontProperty.getTypeOffset()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getUnderline() != null) { |
|
|
|
|
|
|
|
writeFont.setUnderline(fontProperty.getUnderline()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getCharset() != null) { |
|
|
|
|
|
|
|
writeFont.setCharset(fontProperty.getCharset()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getBold() != null) { |
|
|
|
|
|
|
|
writeFont.setBold(fontProperty.getBold()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static void buildStyleProperty(StyleProperty styleProperty, WriteCellStyle writeCellStyle) { |
|
|
|
|
|
|
|
if (styleProperty == null) { |
|
|
|
|
|
|
|
return; |
|
|
|
|
|
|
|
} |
|
|
|
if (styleProperty.getDataFormatData() != null) { |
|
|
|
if (styleProperty.getDataFormatData() != null) { |
|
|
|
if (writeCellStyle.getDataFormatData() == null) { |
|
|
|
if (writeCellStyle.getDataFormatData() == null) { |
|
|
|
writeCellStyle.setDataFormatData(styleProperty.getDataFormatData()); |
|
|
|
writeCellStyle.setDataFormatData(styleProperty.getDataFormatData()); |
|
|
@ -304,42 +350,7 @@ public class WriteCellStyle { |
|
|
|
if (styleProperty.getShrinkToFit() != null) { |
|
|
|
if (styleProperty.getShrinkToFit() != null) { |
|
|
|
writeCellStyle.setShrinkToFit(styleProperty.getShrinkToFit()); |
|
|
|
writeCellStyle.setShrinkToFit(styleProperty.getShrinkToFit()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty != null) { |
|
|
|
|
|
|
|
if (writeCellStyle.getWriteFont() == null) { |
|
|
|
|
|
|
|
writeCellStyle.setWriteFont(new WriteFont()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
WriteFont writeFont = writeCellStyle.getWriteFont(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.isNotBlank(fontProperty.getFontName())) { |
|
|
|
|
|
|
|
writeFont.setFontName(fontProperty.getFontName()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getFontHeightInPoints() != null) { |
|
|
|
|
|
|
|
writeFont.setFontHeightInPoints(fontProperty.getFontHeightInPoints()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getItalic() != null) { |
|
|
|
|
|
|
|
writeFont.setItalic(fontProperty.getItalic()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getStrikeout() != null) { |
|
|
|
|
|
|
|
writeFont.setStrikeout(fontProperty.getStrikeout()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getColor() != null) { |
|
|
|
|
|
|
|
writeFont.setColor(fontProperty.getColor()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getTypeOffset() != null) { |
|
|
|
|
|
|
|
writeFont.setTypeOffset(fontProperty.getTypeOffset()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getUnderline() != null) { |
|
|
|
|
|
|
|
writeFont.setUnderline(fontProperty.getUnderline()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getCharset() != null) { |
|
|
|
|
|
|
|
writeFont.setCharset(fontProperty.getCharset()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if (fontProperty.getBold() != null) { |
|
|
|
|
|
|
|
writeFont.setBold(fontProperty.getBold()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return writeCellStyle; |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|