mirror of https://github.com/alibaba/easyexcel
Jiaju Zhuang
4 years ago
committed by
GitHub
6 changed files with 0 additions and 190 deletions
@ -1,21 +0,0 @@ |
|||||||
package com.alibaba.easyexcel.test.core.style; |
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty; |
|
||||||
import com.alibaba.excel.annotation.write.style.ContentFontStyle; |
|
||||||
import com.alibaba.excel.annotation.write.style.ContentStyle; |
|
||||||
import lombok.Data; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Pengliang Zhao |
|
||||||
*/ |
|
||||||
@Data |
|
||||||
public class AnnotationStyleData { |
|
||||||
@ContentStyle(dataFormat = (short)1, rotation = (short)1, indent = (short)1, leftBorderColor = (short)1, |
|
||||||
rightBorderColor = (short)1, topBorderColor = (short)1, bottomBorderColor = (short)1, |
|
||||||
fillForegroundColor = (short)1, fillBackgroundColor = (short)1) |
|
||||||
@ContentFontStyle(fontHeightInPoints = (short)1, color = (short)1, typeOffset = (short)1, charset = (short)1) |
|
||||||
@ExcelProperty("字符串") |
|
||||||
private String string; |
|
||||||
@ExcelProperty("字符串1") |
|
||||||
private String string1; |
|
||||||
} |
|
@ -1,17 +0,0 @@ |
|||||||
package com.alibaba.easyexcel.test.core.style; |
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty; |
|
||||||
import lombok.Data; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Pengliang Zhao |
|
||||||
*/ |
|
||||||
@Data |
|
||||||
public class LoopMergeData { |
|
||||||
@ExcelProperty(value = "洗漱种类", index = 0) |
|
||||||
private String category; |
|
||||||
@ExcelProperty(value = "毛巾名称", index = 1) |
|
||||||
private String towel; |
|
||||||
@ExcelProperty(value = "毛巾尺寸", index = 2) |
|
||||||
private String size; |
|
||||||
} |
|
@ -1,19 +0,0 @@ |
|||||||
package com.alibaba.easyexcel.test.core.style; |
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.ExcelProperty; |
|
||||||
import com.alibaba.excel.annotation.write.style.OnceAbsoluteMerge; |
|
||||||
import lombok.Data; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Pengliang Zhao |
|
||||||
*/ |
|
||||||
@Data |
|
||||||
@OnceAbsoluteMerge(firstRowIndex = (short)0, lastRowIndex = (short)2, firstColumnIndex = (short)0, lastColumnIndex = (short)2) |
|
||||||
public class OnceAbsoluteMergeData { |
|
||||||
@ExcelProperty(value = "洗漱种类", index = 0) |
|
||||||
private String category; |
|
||||||
@ExcelProperty(value = "毛巾名称", index = 1) |
|
||||||
private String towel; |
|
||||||
@ExcelProperty(value = "毛巾尺寸", index = 2) |
|
||||||
private String size; |
|
||||||
} |
|
@ -1,52 +0,0 @@ |
|||||||
package com.alibaba.easyexcel.test.core.style; |
|
||||||
|
|
||||||
import org.apache.poi.ss.usermodel.FillPatternType; |
|
||||||
import org.apache.poi.ss.usermodel.Font; |
|
||||||
import org.apache.poi.ss.usermodel.IndexedColors; |
|
||||||
|
|
||||||
import com.alibaba.excel.annotation.write.style.ContentFontStyle; |
|
||||||
import com.alibaba.excel.annotation.write.style.ContentStyle; |
|
||||||
import com.alibaba.excel.metadata.Head; |
|
||||||
import com.alibaba.excel.metadata.property.FontProperty; |
|
||||||
import com.alibaba.excel.metadata.property.StyleProperty; |
|
||||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle; |
|
||||||
import com.alibaba.excel.write.metadata.style.WriteFont; |
|
||||||
import com.alibaba.excel.write.style.AbstractVerticalCellStyleStrategy; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author Pengliang Zhao |
|
||||||
*/ |
|
||||||
public class SimpleVerticalCellStyleStrategy extends AbstractVerticalCellStyleStrategy { |
|
||||||
private StyleProperty styleProperty = StyleProperty.build(AnnotationStyleData.class.getAnnotation(ContentStyle.class)); |
|
||||||
private FontProperty fontProperty = FontProperty.build(AnnotationStyleData.class.getAnnotation(ContentFontStyle.class)); |
|
||||||
|
|
||||||
@Override |
|
||||||
protected WriteCellStyle headCellStyle(Head head) { |
|
||||||
WriteCellStyle writeCellStyle = WriteCellStyle.build(styleProperty, fontProperty); |
|
||||||
if (head.getColumnIndex() == 0) { |
|
||||||
writeCellStyle.setFillForegroundColor(IndexedColors.YELLOW.getIndex()); |
|
||||||
WriteFont writeFont = new WriteFont(); |
|
||||||
writeFont.setItalic(true); |
|
||||||
writeFont.setStrikeout(true); |
|
||||||
writeFont.setTypeOffset(Font.SS_NONE); |
|
||||||
writeFont.setUnderline(Font.U_DOUBLE); |
|
||||||
writeFont.setBold(true); |
|
||||||
writeFont.setCharset((int)Font.DEFAULT_CHARSET); |
|
||||||
} else { |
|
||||||
writeCellStyle.setFillForegroundColor(IndexedColors.BLUE.getIndex()); |
|
||||||
} |
|
||||||
return writeCellStyle; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected WriteCellStyle contentCellStyle(Head head) { |
|
||||||
WriteCellStyle writeCellStyle = new WriteCellStyle(); |
|
||||||
writeCellStyle.setFillPatternType(FillPatternType.SOLID_FOREGROUND); |
|
||||||
if (head.getColumnIndex() == 0) { |
|
||||||
writeCellStyle.setFillForegroundColor(IndexedColors.DARK_GREEN.getIndex()); |
|
||||||
} else { |
|
||||||
writeCellStyle.setFillForegroundColor(IndexedColors.PINK.getIndex()); |
|
||||||
} |
|
||||||
return writeCellStyle; |
|
||||||
} |
|
||||||
} |
|
Loading…
Reference in new issue