
me.chyxion.xls.css.support.HeightApplier Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of table-to-xls Show documentation
Show all versions of table-to-xls Show documentation
Convert HTML Table To Excel
package me.chyxion.xls.css.support;
import java.util.Map;
import java.util.HashMap;
import me.chyxion.xls.css.CssUtils;
import me.chyxion.xls.css.CssApplier;
import org.apache.poi.hssf.usermodel.HSSFRow;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFCellStyle;
/**
* @version 0.0.1
* @since 0.0.1
* @author Shaun Chyxion
* [email protected]
* Oct 24, 2014 5:18:57 PM
*/
public class HeightApplier implements CssApplier {
/**
* {@inheritDoc}
*/
public Map parse(Map style) {
Map mapRtn = new HashMap();
String height = style.get(HEIGHT);
if (CssUtils.isNum(height)) {
mapRtn.put(HEIGHT, height);
}
return mapRtn;
}
/**
* {@inheritDoc}
*/
public void apply(HSSFCell cell, HSSFCellStyle cellStyle, Map style) {
int height = Math.round(CssUtils.getInt(style.get(HEIGHT)) * 255 / 12.75F);
HSSFRow row = cell.getRow();
if (height > row.getHeight()) {
row.setHeight((short) height);
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy