Jiaju Zhuang
5 years ago
22 changed files with 835 additions and 100 deletions
@ -0,0 +1,89 @@
|
||||
package com.alibaba.excel.annotation.write.style; |
||||
|
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
import org.apache.poi.common.usermodel.fonts.FontCharset; |
||||
import org.apache.poi.hssf.usermodel.HSSFPalette; |
||||
import org.apache.poi.ss.usermodel.Font; |
||||
import org.apache.poi.ss.usermodel.IndexedColors; |
||||
|
||||
/** |
||||
* Custom content styles. |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
@Target({ElementType.FIELD}) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Inherited |
||||
public @interface ContentFontStyle { |
||||
|
||||
/** |
||||
* The name for the font (i.e. Arial) |
||||
*/ |
||||
String fontName(); |
||||
|
||||
/** |
||||
* Height in the familiar unit of measure - points |
||||
*/ |
||||
short fontHeightInPoints() default -1; |
||||
|
||||
/** |
||||
* Whether to use italics or not |
||||
*/ |
||||
boolean italic() default false; |
||||
|
||||
/** |
||||
* Whether to use a strikeout horizontal line through the text or not |
||||
*/ |
||||
boolean strikeout() default false; |
||||
|
||||
/** |
||||
* The color for the font |
||||
* |
||||
* @see Font#COLOR_NORMAL |
||||
* @see Font#COLOR_RED |
||||
* @see HSSFPalette#getColor(short) |
||||
* @see IndexedColors |
||||
*/ |
||||
short color() default -1; |
||||
|
||||
/** |
||||
* Set normal,super or subscript. |
||||
* |
||||
* @see Font#SS_NONE |
||||
* @see Font#SS_SUPER |
||||
* @see Font#SS_SUB |
||||
*/ |
||||
short typeOffset() default -1; |
||||
|
||||
/** |
||||
* set type of text underlining to use |
||||
* |
||||
* @see Font#U_NONE |
||||
* @see Font#U_SINGLE |
||||
* @see Font#U_DOUBLE |
||||
* @see Font#U_SINGLE_ACCOUNTING |
||||
* @see Font#U_DOUBLE_ACCOUNTING |
||||
*/ |
||||
|
||||
byte underline() default -1; |
||||
|
||||
/** |
||||
* Set character-set to use. |
||||
* |
||||
* @see FontCharset |
||||
* @see Font#ANSI_CHARSET |
||||
* @see Font#DEFAULT_CHARSET |
||||
* @see Font#SYMBOL_CHARSET |
||||
*/ |
||||
int charset() default -1; |
||||
|
||||
/** |
||||
* Bold |
||||
*/ |
||||
boolean bold() default false; |
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.alibaba.excel.annotation.write.style; |
||||
|
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
/** |
||||
* The regions of the loop merge |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
@Target({ElementType.FIELD}) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Inherited |
||||
public @interface ContentLoopMerge { |
||||
/** |
||||
* Each row |
||||
* |
||||
* @return |
||||
*/ |
||||
int eachRow() default -1; |
||||
|
||||
/** |
||||
* Extend column |
||||
* |
||||
* @return |
||||
*/ |
||||
int columnExtend() default 1; |
||||
} |
@ -0,0 +1,159 @@
|
||||
package com.alibaba.excel.annotation.write.style; |
||||
|
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
import org.apache.poi.ss.usermodel.BorderStyle; |
||||
import org.apache.poi.ss.usermodel.BuiltinFormats; |
||||
import org.apache.poi.ss.usermodel.FillPatternType; |
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment; |
||||
import org.apache.poi.ss.usermodel.IgnoredErrorType; |
||||
import org.apache.poi.ss.usermodel.IndexedColors; |
||||
import org.apache.poi.ss.usermodel.VerticalAlignment; |
||||
|
||||
/** |
||||
* Custom content styles |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
@Target({ElementType.FIELD}) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Inherited |
||||
public @interface ContentStyle { |
||||
/** |
||||
* Set the data format (must be a valid format). Built in formats are defined at {@link BuiltinFormats}. |
||||
*/ |
||||
short dataFormat(); |
||||
|
||||
/** |
||||
* Set the cell's using this style to be hidden |
||||
*/ |
||||
boolean hidden(); |
||||
|
||||
/** |
||||
* Set the cell's using this style to be locked |
||||
*/ |
||||
boolean locked(); |
||||
|
||||
/** |
||||
* Turn on or off "Quote Prefix" or "123 Prefix" for the style, which is used to tell Excel that the thing which |
||||
* looks like a number or a formula shouldn't be treated as on. Turning this on is somewhat (but not completely, see |
||||
* {@link IgnoredErrorType}) like prefixing the cell value with a ' in Excel |
||||
*/ |
||||
boolean quotePrefix(); |
||||
|
||||
/** |
||||
* Set the type of horizontal alignment for the cell |
||||
*/ |
||||
HorizontalAlignment horizontalAlignment(); |
||||
|
||||
/** |
||||
* Set whether the text should be wrapped. Setting this flag to <code>true</code> make all content visible within a |
||||
* cell by displaying it on multiple lines |
||||
* |
||||
*/ |
||||
boolean wrapped(); |
||||
|
||||
/** |
||||
* Set the type of vertical alignment for the cell |
||||
*/ |
||||
VerticalAlignment verticalAlignment(); |
||||
|
||||
/** |
||||
* Set the degree of rotation for the text in the cell. |
||||
* |
||||
* Note: HSSF uses values from -90 to 90 degrees, whereas XSSF uses values from 0 to 180 degrees. The |
||||
* implementations of this method will map between these two value-ranges accordingly, however the corresponding |
||||
* getter is returning values in the range mandated by the current type of Excel file-format that this CellStyle is |
||||
* applied to. |
||||
*/ |
||||
short rotation(); |
||||
|
||||
/** |
||||
* Set the number of spaces to indent the text in the cell |
||||
*/ |
||||
short indent(); |
||||
|
||||
/** |
||||
* Set the type of border to use for the left border of the cell |
||||
*/ |
||||
BorderStyle borderLeft(); |
||||
|
||||
/** |
||||
* Set the type of border to use for the right border of the cell |
||||
*/ |
||||
BorderStyle borderRight(); |
||||
|
||||
/** |
||||
* Set the type of border to use for the top border of the cell |
||||
*/ |
||||
BorderStyle borderTop(); |
||||
|
||||
/** |
||||
* Set the type of border to use for the bottom border of the cell |
||||
*/ |
||||
BorderStyle borderBottom(); |
||||
|
||||
/** |
||||
* Set the color to use for the left border |
||||
* |
||||
* @see IndexedColors |
||||
*/ |
||||
short leftBorderColor(); |
||||
|
||||
/** |
||||
* Set the color to use for the right border |
||||
* |
||||
* @see IndexedColors |
||||
* |
||||
*/ |
||||
short rightBorderColor(); |
||||
|
||||
/** |
||||
* Set the color to use for the top border |
||||
* |
||||
* @see IndexedColors |
||||
* |
||||
*/ |
||||
short topBorderColor(); |
||||
|
||||
/** |
||||
* Set the color to use for the bottom border |
||||
* |
||||
* @see IndexedColors |
||||
* |
||||
*/ |
||||
short bottomBorderColor(); |
||||
|
||||
/** |
||||
* Setting to one fills the cell with the foreground color... No idea about other values |
||||
* |
||||
* @see FillPatternType#SOLID_FOREGROUND |
||||
*/ |
||||
FillPatternType fillPatternType(); |
||||
|
||||
/** |
||||
* Set the background fill color. |
||||
* |
||||
* @see IndexedColors |
||||
* |
||||
*/ |
||||
short fillBackgroundColor(); |
||||
|
||||
/** |
||||
* Set the foreground fill color <i>Note: Ensure Foreground color is set prior to background color.</i> |
||||
* |
||||
* @see IndexedColors |
||||
* |
||||
*/ |
||||
short fillForegroundColor(); |
||||
|
||||
/** |
||||
* Controls if the Cell should be auto-sized to shrink to fit if the text is too long |
||||
*/ |
||||
boolean shrinkToFit(); |
||||
|
||||
} |
@ -0,0 +1,89 @@
|
||||
package com.alibaba.excel.annotation.write.style; |
||||
|
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
import org.apache.poi.common.usermodel.fonts.FontCharset; |
||||
import org.apache.poi.hssf.usermodel.HSSFPalette; |
||||
import org.apache.poi.ss.usermodel.Font; |
||||
import org.apache.poi.ss.usermodel.IndexedColors; |
||||
|
||||
/** |
||||
* Custom header styles. |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
@Target({ElementType.FIELD}) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Inherited |
||||
public @interface HeadFontStyle { |
||||
|
||||
/** |
||||
* The name for the font (i.e. Arial) |
||||
*/ |
||||
String fontName(); |
||||
|
||||
/** |
||||
* Height in the familiar unit of measure - points |
||||
*/ |
||||
short fontHeightInPoints() default -1; |
||||
|
||||
/** |
||||
* Whether to use italics or not |
||||
*/ |
||||
boolean italic() default false; |
||||
|
||||
/** |
||||
* Whether to use a strikeout horizontal line through the text or not |
||||
*/ |
||||
boolean strikeout() default false; |
||||
|
||||
/** |
||||
* The color for the font |
||||
* |
||||
* @see Font#COLOR_NORMAL |
||||
* @see Font#COLOR_RED |
||||
* @see HSSFPalette#getColor(short) |
||||
* @see IndexedColors |
||||
*/ |
||||
short color() default -1; |
||||
|
||||
/** |
||||
* Set normal,super or subscript. |
||||
* |
||||
* @see Font#SS_NONE |
||||
* @see Font#SS_SUPER |
||||
* @see Font#SS_SUB |
||||
*/ |
||||
short typeOffset() default -1; |
||||
|
||||
/** |
||||
* set type of text underlining to use |
||||
* |
||||
* @see Font#U_NONE |
||||
* @see Font#U_SINGLE |
||||
* @see Font#U_DOUBLE |
||||
* @see Font#U_SINGLE_ACCOUNTING |
||||
* @see Font#U_DOUBLE_ACCOUNTING |
||||
*/ |
||||
|
||||
byte underline() default -1; |
||||
|
||||
/** |
||||
* Set character-set to use. |
||||
* |
||||
* @see FontCharset |
||||
* @see Font#ANSI_CHARSET |
||||
* @see Font#DEFAULT_CHARSET |
||||
* @see Font#SYMBOL_CHARSET |
||||
*/ |
||||
int charset() default -1; |
||||
|
||||
/** |
||||
* Bold |
||||
*/ |
||||
boolean bold() default false; |
||||
} |
@ -0,0 +1,159 @@
|
||||
package com.alibaba.excel.annotation.write.style; |
||||
|
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
import org.apache.poi.ss.usermodel.BorderStyle; |
||||
import org.apache.poi.ss.usermodel.BuiltinFormats; |
||||
import org.apache.poi.ss.usermodel.FillPatternType; |
||||
import org.apache.poi.ss.usermodel.HorizontalAlignment; |
||||
import org.apache.poi.ss.usermodel.IgnoredErrorType; |
||||
import org.apache.poi.ss.usermodel.IndexedColors; |
||||
import org.apache.poi.ss.usermodel.VerticalAlignment; |
||||
|
||||
/** |
||||
* Custom header styles |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
@Target({ElementType.FIELD}) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Inherited |
||||
public @interface HeadStyle { |
||||
/** |
||||
* Set the data format (must be a valid format). Built in formats are defined at {@link BuiltinFormats}. |
||||
*/ |
||||
short dataFormat() default -1; |
||||
|
||||
/** |
||||
* Set the cell's using this style to be hidden |
||||
*/ |
||||
boolean hidden() default false; |
||||
|
||||
/** |
||||
* Set the cell's using this style to be locked |
||||
*/ |
||||
boolean locked() default false; |
||||
|
||||
/** |
||||
* Turn on or off "Quote Prefix" or "123 Prefix" for the style, which is used to tell Excel that the thing which |
||||
* looks like a number or a formula shouldn't be treated as on. Turning this on is somewhat (but not completely, see |
||||
* {@link IgnoredErrorType}) like prefixing the cell value with a ' in Excel |
||||
*/ |
||||
boolean quotePrefix() default false; |
||||
|
||||
/** |
||||
* Set the type of horizontal alignment for the cell |
||||
*/ |
||||
HorizontalAlignment horizontalAlignment(); |
||||
|
||||
/** |
||||
* Set whether the text should be wrapped. Setting this flag to <code>true</code> make all content visible within a |
||||
* cell by displaying it on multiple lines |
||||
* |
||||
*/ |
||||
boolean wrapped() default false; |
||||
|
||||
/** |
||||
* Set the type of vertical alignment for the cell |
||||
*/ |
||||
VerticalAlignment verticalAlignment(); |
||||
|
||||
/** |
||||
* Set the degree of rotation for the text in the cell. |
||||
* |
||||
* Note: HSSF uses values from -90 to 90 degrees, whereas XSSF uses values from 0 to 180 degrees. The |
||||
* implementations of this method will map between these two value-ranges accordingly, however the corresponding |
||||
* getter is returning values in the range mandated by the current type of Excel file-format that this CellStyle is |
||||
* applied to. |
||||
*/ |
||||
short rotation() default -1; |
||||
|
||||
/** |
||||
* Set the number of spaces to indent the text in the cell |
||||
*/ |
||||
short indent() default -1; |
||||
|
||||
/** |
||||
* Set the type of border to use for the left border of the cell |
||||
*/ |
||||
BorderStyle borderLeft(); |
||||
|
||||
/** |
||||
* Set the type of border to use for the right border of the cell |
||||
*/ |
||||
BorderStyle borderRight(); |
||||
|
||||
/** |
||||
* Set the type of border to use for the top border of the cell |
||||
*/ |
||||
BorderStyle borderTop(); |
||||
|
||||
/** |
||||
* Set the type of border to use for the bottom border of the cell |
||||
*/ |
||||
BorderStyle borderBottom(); |
||||
|
||||
/** |
||||
* Set the color to use for the left border |
||||
* |
||||
* @see IndexedColors |
||||
*/ |
||||
short leftBorderColor() default -1; |
||||
|
||||
/** |
||||
* Set the color to use for the right border |
||||
* |
||||
* @see IndexedColors |
||||
* |
||||
*/ |
||||
short rightBorderColor() default -1; |
||||
|
||||
/** |
||||
* Set the color to use for the top border |
||||
* |
||||
* @see IndexedColors |
||||
* |
||||
*/ |
||||
short topBorderColor() default -1; |
||||
|
||||
/** |
||||
* Set the color to use for the bottom border |
||||
* |
||||
* @see IndexedColors |
||||
* |
||||
*/ |
||||
short bottomBorderColor() default -1; |
||||
|
||||
/** |
||||
* Setting to one fills the cell with the foreground color... No idea about other values |
||||
* |
||||
* @see FillPatternType#SOLID_FOREGROUND |
||||
*/ |
||||
FillPatternType fillPatternType(); |
||||
|
||||
/** |
||||
* Set the background fill color. |
||||
* |
||||
* @see IndexedColors |
||||
* |
||||
*/ |
||||
short fillBackgroundColor() default -1; |
||||
|
||||
/** |
||||
* Set the foreground fill color <i>Note: Ensure Foreground color is set prior to background color.</i> |
||||
* |
||||
* @see IndexedColors |
||||
* |
||||
*/ |
||||
short fillForegroundColor() default -1; |
||||
|
||||
/** |
||||
* Controls if the Cell should be auto-sized to shrink to fit if the text is too long |
||||
*/ |
||||
boolean shrinkToFit() default false; |
||||
|
||||
} |
@ -0,0 +1,45 @@
|
||||
package com.alibaba.excel.annotation.write.style; |
||||
|
||||
import java.lang.annotation.ElementType; |
||||
import java.lang.annotation.Inherited; |
||||
import java.lang.annotation.Retention; |
||||
import java.lang.annotation.RetentionPolicy; |
||||
import java.lang.annotation.Target; |
||||
|
||||
/** |
||||
* Merge the cells once |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
@Target({ElementType.TYPE}) |
||||
@Retention(RetentionPolicy.RUNTIME) |
||||
@Inherited |
||||
public @interface OnceAbsoluteMerge { |
||||
/** |
||||
* First row |
||||
* |
||||
* @return |
||||
*/ |
||||
int firstRowIndex() default -1; |
||||
|
||||
/** |
||||
* Last row |
||||
* |
||||
* @return |
||||
*/ |
||||
int lastRowIndex() default -1; |
||||
|
||||
/** |
||||
* First column |
||||
* |
||||
* @return |
||||
*/ |
||||
int firstColumnIndex() default -1; |
||||
|
||||
/** |
||||
* Last row |
||||
* |
||||
* @return |
||||
*/ |
||||
int lastColumnIndex() default -1; |
||||
} |
@ -0,0 +1,31 @@
|
||||
package com.alibaba.excel.write.handler; |
||||
|
||||
import org.apache.poi.ss.usermodel.Row; |
||||
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
||||
import com.alibaba.excel.write.metadata.holder.WriteTableHolder; |
||||
|
||||
/** |
||||
* Abstract row write handler |
||||
* |
||||
* @author Jiaju Zhuang |
||||
**/ |
||||
public abstract class AbstractRowWriteHandler implements RowWriteHandler { |
||||
@Override |
||||
public void beforeRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Integer rowIndex, |
||||
Integer relativeRowIndex, Boolean isHead) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void afterRowCreate(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, |
||||
Integer relativeRowIndex, Boolean isHead) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void afterRowDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, |
||||
Integer relativeRowIndex, Boolean isHead) { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,21 @@
|
||||
package com.alibaba.excel.write.handler; |
||||
|
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; |
||||
|
||||
/** |
||||
* Abstract sheet write handler |
||||
* |
||||
* @author Jiaju Zhuang |
||||
**/ |
||||
public abstract class AbstractSheetWriteHandler implements SheetWriteHandler { |
||||
@Override |
||||
public void beforeSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void afterSheetCreate(WriteWorkbookHolder writeWorkbookHolder, WriteSheetHolder writeSheetHolder) { |
||||
|
||||
} |
||||
} |
@ -0,0 +1,26 @@
|
||||
package com.alibaba.excel.write.handler; |
||||
|
||||
import com.alibaba.excel.write.metadata.holder.WriteWorkbookHolder; |
||||
|
||||
/** |
||||
* Abstract workbook write handler |
||||
* |
||||
* @author Jiaju Zhuang |
||||
**/ |
||||
public abstract class AbstractWorkbookWriteHandler implements WorkbookWriteHandler { |
||||
|
||||
@Override |
||||
public void beforeWorkbookCreate() { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void afterWorkbookCreate(WriteWorkbookHolder writeWorkbookHolder) { |
||||
|
||||
} |
||||
|
||||
@Override |
||||
public void afterWorkbookDispose(WriteWorkbookHolder writeWorkbookHolder) { |
||||
|
||||
} |
||||
} |
@ -1,58 +1,64 @@
|
||||
package com.alibaba.excel.write.merge; |
||||
|
||||
import org.apache.poi.ss.usermodel.Cell; |
||||
import org.apache.poi.ss.usermodel.Sheet; |
||||
import org.apache.poi.ss.usermodel.Row; |
||||
import org.apache.poi.ss.util.CellRangeAddress; |
||||
|
||||
import com.alibaba.excel.metadata.Head; |
||||
import com.alibaba.excel.write.handler.AbstractRowWriteHandler; |
||||
import com.alibaba.excel.write.metadata.holder.WriteSheetHolder; |
||||
import com.alibaba.excel.write.metadata.holder.WriteTableHolder; |
||||
|
||||
/** |
||||
* The regions of the loop merge |
||||
* |
||||
* @author Jiaju Zhuang |
||||
*/ |
||||
public class LoopMergeStrategy extends AbstractMergeStrategy { |
||||
public class LoopMergeStrategy extends AbstractRowWriteHandler { |
||||
/** |
||||
* Each row |
||||
*/ |
||||
private int eachRow; |
||||
private int columnCount; |
||||
/** |
||||
* Extend column |
||||
*/ |
||||
private int columnExtend; |
||||
/** |
||||
* The number of the current column |
||||
*/ |
||||
private int columnIndex; |
||||
|
||||
public LoopMergeStrategy(int eachRow, int columnIndex) { |
||||
this(eachRow, 1, columnIndex); |
||||
} |
||||
|
||||
public LoopMergeStrategy(int eachRow, int columnCount, int columnIndex) { |
||||
public LoopMergeStrategy(int eachRow, int columnExtend, int columnIndex) { |
||||
if (eachRow < 1) { |
||||
throw new IllegalArgumentException("EachRows must be greater than 1"); |
||||
} |
||||
if (columnCount < 1) { |
||||
throw new IllegalArgumentException("ColumnCount must be greater than 1"); |
||||
if (columnExtend < 1) { |
||||
throw new IllegalArgumentException("ColumnExtend must be greater than 1"); |
||||
} |
||||
if (columnCount == 1 && eachRow == 1) { |
||||
throw new IllegalArgumentException("ColumnCount or eachRows must be greater than 1"); |
||||
if (columnExtend == 1 && eachRow == 1) { |
||||
throw new IllegalArgumentException("ColumnExtend or eachRows must be greater than 1"); |
||||
} |
||||
if (columnIndex < 0) { |
||||
throw new IllegalArgumentException("ColumnIndex must be greater than 0"); |
||||
} |
||||
this.eachRow = eachRow; |
||||
this.columnCount = columnCount; |
||||
this.columnExtend = columnExtend; |
||||
this.columnIndex = columnIndex; |
||||
} |
||||
|
||||
@Override |
||||
protected void merge(Sheet sheet, Cell cell, Head head, Integer relativeRowIndex) { |
||||
if (relativeRowIndex == null) { |
||||
public void afterRowDispose(WriteSheetHolder writeSheetHolder, WriteTableHolder writeTableHolder, Row row, |
||||
Integer relativeRowIndex, Boolean isHead) { |
||||
if (isHead) { |
||||
return; |
||||
} |
||||
Integer currentColumnIndex; |
||||
if (head != null) { |
||||
currentColumnIndex = head.getColumnIndex(); |
||||
} else { |
||||
currentColumnIndex = cell.getColumnIndex(); |
||||
} |
||||
if (currentColumnIndex == columnIndex && relativeRowIndex % eachRow == 0) { |
||||
CellRangeAddress cellRangeAddress = new CellRangeAddress(cell.getRowIndex(), |
||||
cell.getRowIndex() + eachRow - 1, cell.getColumnIndex(), cell.getColumnIndex() + columnCount - 1); |
||||
sheet.addMergedRegionUnsafe(cellRangeAddress); |
||||
if (relativeRowIndex % eachRow == 0) { |
||||
CellRangeAddress cellRangeAddress = new CellRangeAddress(row.getRowNum(), row.getRowNum() + eachRow - 1, |
||||
columnIndex, columnIndex + columnExtend - 1); |
||||
writeSheetHolder.getSheet().addMergedRegionUnsafe(cellRangeAddress); |
||||
} |
||||
} |
||||
|
||||
} |
||||
|
Loading…
Reference in new issue