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

me.chyxion.xls.css.support.HeightApplier Maven / Gradle / Ivy

There is a newer version: 0.0.2
Show newest version
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