Example usage for com.lowagie.text.rtf.table RtfBorder BORDER_SINGLE

List of usage examples for com.lowagie.text.rtf.table RtfBorder BORDER_SINGLE

Introduction

In this page you can find the example usage for com.lowagie.text.rtf.table RtfBorder BORDER_SINGLE.

Prototype

int BORDER_SINGLE

To view the source code for com.lowagie.text.rtf.table RtfBorder BORDER_SINGLE.

Click Source Link

Document

Constant for a single border

Usage

From source file:org.pentaho.reporting.engine.classic.core.modules.output.table.rtf.helper.RTFPrinter.java

License:Open Source License

private int translateBorderStyle(final BorderStyle borderStyle) {
    if (BorderStyle.DASHED.equals(borderStyle)) {
        return RtfBorder.BORDER_DASHED;
    }// w  w  w  .java  2  s  . co m
    if (BorderStyle.DOT_DASH.equals(borderStyle)) {
        return RtfBorder.BORDER_DOT_DASH;
    }
    if (BorderStyle.DOT_DOT_DASH.equals(borderStyle)) {
        return RtfBorder.BORDER_DOT_DOT_DASH;
    }
    if (BorderStyle.DOTTED.equals(borderStyle)) {
        return RtfBorder.BORDER_DOTTED;
    }
    if (BorderStyle.DOUBLE.equals(borderStyle)) {
        return RtfBorder.BORDER_DOUBLE;
    }
    if (BorderStyle.HIDDEN.equals(borderStyle)) {
        return RtfBorder.BORDER_NONE;
    }
    if (BorderStyle.NONE.equals(borderStyle)) {
        return RtfBorder.BORDER_NONE;
    }
    if (BorderStyle.GROOVE.equals(borderStyle)) {
        return RtfBorder.BORDER_ENGRAVE;
    }
    if (BorderStyle.RIDGE.equals(borderStyle)) {
        return RtfBorder.BORDER_EMBOSS;
    }
    if (BorderStyle.INSET.equals(borderStyle)) {
        return RtfBorder.BORDER_SINGLE;
    }
    if (BorderStyle.OUTSET.equals(borderStyle)) {
        return RtfBorder.BORDER_SINGLE;
    }
    if (BorderStyle.SOLID.equals(borderStyle)) {
        return RtfBorder.BORDER_SINGLE;
    }
    if (BorderStyle.WAVE.equals(borderStyle)) {
        return RtfBorder.BORDER_WAVY;
    }
    return RtfBorder.BORDER_NONE;
}

From source file:ro.nextreports.engine.exporter.RtfExporter.java

License:Apache License

private void setCellStyle(Font fnt, Map<String, Object> style, RtfCell cell) {
    if (style != null) {
        updateFont(fnt, style);//from   ww w. j av a2s . c om
        if (style.containsKey(StyleFormatConstants.BACKGROUND_COLOR)) {
            Color val = (Color) style.get(StyleFormatConstants.BACKGROUND_COLOR);
            cell.setBackgroundColor(val);
        }
        if (style.containsKey(StyleFormatConstants.HORIZONTAL_ALIGN_KEY)) {
            if (StyleFormatConstants.HORIZONTAL_ALIGN_LEFT
                    .equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
                cell.setHorizontalAlignment(Element.ALIGN_LEFT);
            }
            if (StyleFormatConstants.HORIZONTAL_ALIGN_RIGHT
                    .equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
                cell.setHorizontalAlignment(Element.ALIGN_RIGHT);
            }
            if (StyleFormatConstants.HORIZONTAL_ALIGN_CENTER
                    .equals(style.get(StyleFormatConstants.HORIZONTAL_ALIGN_KEY))) {
                cell.setHorizontalAlignment(Element.ALIGN_CENTER);
            }
        }

        if (style.containsKey(StyleFormatConstants.VERTICAL_ALIGN_KEY)) {
            if (StyleFormatConstants.VERTICAL_ALIGN_TOP
                    .equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
                cell.setVerticalAlignment(Element.ALIGN_TOP);
            }
            if (StyleFormatConstants.VERTICAL_ALIGN_MIDDLE
                    .equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE);
            }
            if (StyleFormatConstants.VERTICAL_ALIGN_BOTTOM
                    .equals(style.get(StyleFormatConstants.VERTICAL_ALIGN_KEY))) {
                cell.setVerticalAlignment(Element.ALIGN_BOTTOM);
            }
        }
        // if (style.containsKey(StyleFormatConstants.PADDING_LEFT)) {
        // Float val = (Float) style.get(StyleFormatConstants.PADDING_LEFT);
        // cell.setPaddingLeft(val);
        // }
        // if (style.containsKey(StyleFormatConstants.PADDING_RIGHT)) {
        // Float val = (Float)
        // style.get(StyleFormatConstants.PADDING_RIGHT);
        // cell.setPaddingRight(val);
        // }
        // if (style.containsKey(StyleFormatConstants.PADDING_TOP)) {
        // Float val = (Float) style.get(StyleFormatConstants.PADDING_TOP);
        // cell.setPaddingTop(val);
        // }
        // if (style.containsKey(StyleFormatConstants.PADDING_BOTTOM)) {
        // Float val = (Float)
        // style.get(StyleFormatConstants.PADDING_BOTTOM);
        // cell.setPaddingBottom(val);
        // }
        cell.setBorderWidth(0);

        Float val = Float.valueOf(1);
        RtfBorderGroup bg = new RtfBorderGroup();
        if (style.containsKey(StyleFormatConstants.BORDER_LEFT)) {
            val = (Float) style.get(StyleFormatConstants.BORDER_LEFT);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_LEFT_COLOR);
            bg.addBorder(Rectangle.LEFT, RtfBorder.BORDER_SINGLE, val, color);
        }
        if (style.containsKey(StyleFormatConstants.BORDER_RIGHT)) {
            val = (Float) style.get(StyleFormatConstants.BORDER_RIGHT);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_RIGHT_COLOR);
            bg.addBorder(Rectangle.RIGHT, RtfBorder.BORDER_SINGLE, val, color);
        }
        if (style.containsKey(StyleFormatConstants.BORDER_TOP)) {
            val = (Float) style.get(StyleFormatConstants.BORDER_TOP);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_TOP_COLOR);
            bg.addBorder(Rectangle.TOP, RtfBorder.BORDER_SINGLE, val, color);
        }
        if (style.containsKey(StyleFormatConstants.BORDER_BOTTOM)) {
            val = (Float) style.get(StyleFormatConstants.BORDER_BOTTOM);
            Color color = (Color) style.get(StyleFormatConstants.BORDER_BOTTOM_COLOR);
            bg.addBorder(Rectangle.BOTTOM, RtfBorder.BORDER_SINGLE, val, color);
        }
        cell.setBorders(bg);

        // cell.setNoWrap(true);
        // if (bandElement != null) {
        // if (bandElement.isWrapText()) {
        // cell.setNoWrap(false);
        // }
        // }
    }
}