Example usage for org.apache.poi.ss.usermodel Picture getClientAnchor

List of usage examples for org.apache.poi.ss.usermodel Picture getClientAnchor

Introduction

In this page you can find the example usage for org.apache.poi.ss.usermodel Picture getClientAnchor.

Prototype

ClientAnchor getClientAnchor();

Source Link

Usage

From source file:org.tiefaces.components.websheet.utility.PicturesUtility.java

License:MIT License

/**
 * Generate picture style.//from   w ww  . ja va 2  s .c om
 *
 * @param sheet1
 *            the sheet 1
 * @param fcell
 *            the fcell
 * @param cell
 *            the cell
 * @param pic
 *            the pic
 * @return the string
 */
public static String generatePictureStyle(final Sheet sheet1, final FacesCell fcell, final Cell cell,
        final Picture pic) {

    ClientAnchor anchor = pic.getClientAnchor();
    if (anchor != null) {
        AnchorSize anchorSize = getAnchorSize(sheet1, fcell, cell, anchor);
        if (anchorSize != null) {
            return "MARGIN-LEFT:" + String.format("%.2f", anchorSize.getPercentLeft()) + "%;MARGIN-TOP:"
                    + String.format("%.2f", anchorSize.getPercentTop()) + "%;width:"
                    + String.format("%.2f", anchorSize.getPercentWidth()) + "%;";
        }
    }
    return "";

}