All Downloads are FREE. Search and download functionalities are using the official Maven repository.

io.github.xinshepherd.excel.annotation.Excel Maven / Gradle / Ivy

The newest version!
package io.github.xinshepherd.excel.annotation;

import io.github.xinshepherd.excel.core.DefaultFontStyle;
import io.github.xinshepherd.excel.core.FontStyle;
import org.apache.poi.hssf.util.HSSFColor;
import org.apache.poi.ss.usermodel.Sheet;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

/**
 * @author Fuxin
 * @since 1.1.0
 */
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.TYPE)
public @interface Excel {

    /**
     * 设置sheet名称
     *
     * @return sheet名称
     */
    String value() default "";

    /**
     * 全局设置表头单元格颜色
     * 请参考 {@link HSSFColor#getIndex()} 以及 {@link HSSFColor.HSSFColorPredefined#getIndex()}
     *
     * 如果需要自定义颜色,请使用调色板 {@link org.apache.poi.hssf.usermodel.HSSFPalette}
     * 例如:
     * 
     *   //creating a custom palette for the workbook
     *   HSSFPalette palette = wb.getCustomPalette();
     *   palette.setColorAtIndex(index, r, b, g);
     *   cellStyle.setFillForegroundColor(index);
     * 
     *
     * @return 颜色
     */
    short headerColor() default -1;

    /**
     * 设置所有数据行的高度, 默认 255
     *
     * @see Sheet#getDefaultRowHeight()
     * @see org.apache.poi.ss.usermodel.Row#setHeight
     * @return 数据行高度
     */
    short rowHigh() default -1;

    /**
     * 设置头部行的高度,默认 255
     *
     * @see Sheet#getDefaultRowHeight()
     * @see org.apache.poi.ss.usermodel.Row#setHeight
     * @return 头部行高度
     */
    short herderHigh() default -1;

    /**
     * 设置头部行的字体样式
     *
     * @see FontStyle
     * @return 头部字体样式
     */
    Class fontStyle() default DefaultFontStyle.class;


    /**
     * 设置是否冻结表头
     *
     * @return true or false
     */
    boolean freezePane() default true;

    /**
     * Get Horizontal position of split.
     *
     * @return Horizontal position of split
     * @see Sheet#createFreezePane(int, int)
     * @since 1.2.0
     */
    int colSplit() default 1;

    /**
     * Get Vertical position of split.
     *
     * @return Vertical position of split
     * @see Sheet#createFreezePane(int, int)
     * @since 1.2.0
     */
    int rowSplit() default 1;
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy