WriteWorkbook.java 4.6 KB
Newer Older
Z
zhuangjiaju 已提交
1
package com.alibaba.excel.write.metadata;
Z
zhuangjiaju 已提交
2

Z
zhuangjiaju 已提交
3
import java.io.File;
Z
zhuangjiaju 已提交
4 5 6 7 8 9 10 11 12
import java.io.InputStream;
import java.io.OutputStream;

import com.alibaba.excel.support.ExcelTypeEnum;
import com.alibaba.excel.write.handler.WriteHandler;

/**
 * Workbook
 *
Z
zhuangjiaju 已提交
13
 * @author Jiaju Zhuang
Z
zhuangjiaju 已提交
14
 **/
Z
zhuangjiaju 已提交
15
public class WriteWorkbook extends WriteBasicParameter {
Z
zhuangjiaju 已提交
16
    /**
17
     * Excel type.The default is xlsx
Z
zhuangjiaju 已提交
18 19
     */
    private ExcelTypeEnum excelType;
Z
zhuangjiaju 已提交
20 21 22 23 24 25
    /**
     * Final output file
     * <p>
     * If 'outputStream' and 'file' all not empty,file first
     */
    private File file;
Z
zhuangjiaju 已提交
26
    /**
Z
zhuangjiaju 已提交
27
     * Final output stream
Z
zhuangjiaju 已提交
28 29
     * <p>
     * If 'outputStream' and 'file' all not empty,file first
Z
zhuangjiaju 已提交
30 31 32
     */
    private OutputStream outputStream;
    /**
Z
zhuangjiaju 已提交
33
     * Template input stream
Z
zhuangjiaju 已提交
34 35 36
     * <p>
     * If 'inputStream' and 'file' all not empty,file first
     */
Z
zhuangjiaju 已提交
37
    private InputStream templateInputStream;
Z
zhuangjiaju 已提交
38 39

    /**
Z
zhuangjiaju 已提交
40
     * Template file
Z
zhuangjiaju 已提交
41 42
     * <p>
     * If 'inputStream' and 'file' all not empty,file first
Z
zhuangjiaju 已提交
43
     */
Z
zhuangjiaju 已提交
44
    private File templateFile;
Z
zhuangjiaju 已提交
45
    /**
46
     * Default true.
Z
zhuangjiaju 已提交
47
     */
48
    private Boolean autoCloseStream;
Z
zhuangjiaju 已提交
49
    /**
Z
zhuangjiaju 已提交
50
     * Mandatory use 'inputStream' .Default is false
Z
zhuangjiaju 已提交
51
     */
Z
zhuangjiaju 已提交
52
    private Boolean mandatoryUseInputStream;
庄家钜's avatar
庄家钜 已提交
53 54 55 56 57 58 59
    /**
     * Whether the encryption
     * <p>
     * WARRING:Encryption is when the entire file is read into memory, so it is very memory intensive.
     *
     */
    private String password;
60 61 62 63 64 65
    /**
     * Write excel in memory. Default false,the cache file is created and finally written to excel.
     * <p>
     * Comment and RichTextString are only supported in memory mode.
     */
    private Boolean inMemory;
66 67 68 69
    /**
     * Excel is also written in the event of an exception being thrown.The default false.
     */
    private Boolean writeExcelOnException;
Z
zhuangjiaju 已提交
70
    /**
Z
zhuangjiaju 已提交
71
     * The default is all excel objects.Default is true.
罗成 已提交
72 73 74 75
     * <p>
     * if true , you can use {@link com.alibaba.excel.annotation.ExcelIgnore} ignore a field.
     * <p>
     * if false , you must use {@link com.alibaba.excel.annotation.ExcelProperty} to use a filed.
Z
zhuangjiaju 已提交
76
     *
Z
zhuangjiaju 已提交
77 78 79 80
     * @deprecated Just to be compatible with historical data, The default is always going to be convert all filed.
     */
    @Deprecated
    private Boolean convertAllFiled;
Z
zhuangjiaju 已提交
81 82
    /**
     * Write handler
Z
zhuangjiaju 已提交
83
     *
Z
zhuangjiaju 已提交
84 85 86 87
     * @deprecated please use {@link WriteHandler}
     */
    @Deprecated
    private com.alibaba.excel.event.WriteHandler writeHandler;
Z
zhuangjiaju 已提交
88 89 90 91 92 93 94 95 96

    public ExcelTypeEnum getExcelType() {
        return excelType;
    }

    public void setExcelType(ExcelTypeEnum excelType) {
        this.excelType = excelType;
    }

Z
zhuangjiaju 已提交
97 98 99 100 101 102 103 104
    public File getFile() {
        return file;
    }

    public void setFile(File file) {
        this.file = file;
    }

Z
zhuangjiaju 已提交
105 106 107 108 109 110 111 112
    public OutputStream getOutputStream() {
        return outputStream;
    }

    public void setOutputStream(OutputStream outputStream) {
        this.outputStream = outputStream;
    }

Z
zhuangjiaju 已提交
113 114
    public InputStream getTemplateInputStream() {
        return templateInputStream;
Z
zhuangjiaju 已提交
115 116
    }

Z
zhuangjiaju 已提交
117 118
    public void setTemplateInputStream(InputStream templateInputStream) {
        this.templateInputStream = templateInputStream;
Z
zhuangjiaju 已提交
119 120
    }

Z
zhuangjiaju 已提交
121 122
    public File getTemplateFile() {
        return templateFile;
Z
zhuangjiaju 已提交
123 124
    }

Z
zhuangjiaju 已提交
125 126
    public void setTemplateFile(File templateFile) {
        this.templateFile = templateFile;
Z
zhuangjiaju 已提交
127
    }
128 129 130 131 132 133 134 135

    public Boolean getAutoCloseStream() {
        return autoCloseStream;
    }

    public void setAutoCloseStream(Boolean autoCloseStream) {
        this.autoCloseStream = autoCloseStream;
    }
Z
zhuangjiaju 已提交
136

Z
zhuangjiaju 已提交
137 138
    public Boolean getMandatoryUseInputStream() {
        return mandatoryUseInputStream;
Z
zhuangjiaju 已提交
139 140
    }

Z
zhuangjiaju 已提交
141 142
    public void setMandatoryUseInputStream(Boolean mandatoryUseInputStream) {
        this.mandatoryUseInputStream = mandatoryUseInputStream;
Z
zhuangjiaju 已提交
143 144
    }

Z
zhuangjiaju 已提交
145 146
    public Boolean getConvertAllFiled() {
        return convertAllFiled;
Z
zhuangjiaju 已提交
147 148
    }

Z
zhuangjiaju 已提交
149 150
    public void setConvertAllFiled(Boolean convertAllFiled) {
        this.convertAllFiled = convertAllFiled;
Z
zhuangjiaju 已提交
151 152
    }

Z
zhuangjiaju 已提交
153 154
    public com.alibaba.excel.event.WriteHandler getWriteHandler() {
        return writeHandler;
Z
zhuangjiaju 已提交
155 156
    }

Z
zhuangjiaju 已提交
157 158
    public void setWriteHandler(com.alibaba.excel.event.WriteHandler writeHandler) {
        this.writeHandler = writeHandler;
Z
zhuangjiaju 已提交
159
    }
庄家钜's avatar
庄家钜 已提交
160 161 162 163 164 165 166 167

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }
168 169 170 171 172 173 174 175

    public Boolean getInMemory() {
        return inMemory;
    }

    public void setInMemory(Boolean inMemory) {
        this.inMemory = inMemory;
    }
176 177 178 179 180 181 182 183

    public Boolean getWriteExcelOnException() {
        return writeExcelOnException;
    }

    public void setWriteExcelOnException(Boolean writeExcelOnException) {
        this.writeExcelOnException = writeExcelOnException;
    }
Z
zhuangjiaju 已提交
184
}