|
|
|
@ -5,6 +5,7 @@ import java.io.FileOutputStream;
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
import java.util.LinkedHashSet;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.Set;
|
|
|
|
@ -275,6 +276,16 @@ public class XLSWriter extends XLS {
|
|
|
|
|
if (style.dataFormat() != null) {
|
|
|
|
|
cellStyle.setDataFormat(workbook.createDataFormat().getFormat(style.dataFormat()));
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int width = style.width();
|
|
|
|
|
if (width > 0) {
|
|
|
|
|
int column = cell.getColumnIndex();
|
|
|
|
|
worksheet.setColumnWidth(column, width * 256);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
short height = style.height();
|
|
|
|
|
if (height > 0)
|
|
|
|
|
row.setHeight(height);
|
|
|
|
|
}
|
|
|
|
|
return cellStyle;
|
|
|
|
|
}
|
|
|
|
@ -298,7 +309,7 @@ public class XLSWriter extends XLS {
|
|
|
|
|
*/
|
|
|
|
|
public XLSWriter trackWidth(int... cols) {
|
|
|
|
|
if (!isEmpty(cols))
|
|
|
|
|
worksheet.trackColumnsForAutoSizing(trackWidths = IntStream.of(cols).boxed().collect(Collectors.toSet()));
|
|
|
|
|
worksheet.trackColumnsForAutoSizing(trackWidths = IntStream.of(cols).boxed().collect(Collectors.toCollection(LinkedHashSet<Integer>::new)));
|
|
|
|
|
return this;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -342,6 +353,8 @@ public class XLSWriter extends XLS {
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
protected void clear(boolean all) {
|
|
|
|
|
if (trackWidths != null)
|
|
|
|
|
worksheet.untrackColumnsForAutoSizing(trackWidths);
|
|
|
|
|
super.clear(all);
|
|
|
|
|
trackWidths = null;
|
|
|
|
|
}
|
|
|
|
|