コード例 #1
0
ファイル: CellStyle.java プロジェクト: Thatoneguy123/SVDP
  public CellStyle(Writer styleWriter, JRExporterGridCell gridCell) {
    super(styleWriter);

    JRPrintElement element = gridCell.getElement();

    if (element != null && element.getModeValue() == ModeEnum.OPAQUE) {
      // fill = "solid";
      backcolor = JRColorUtil.getColorHexa(element.getBackcolor());
    } else {
      // fill = "none";
      if (gridCell.getBackcolor() != null) {
        backcolor = JRColorUtil.getColorHexa(gridCell.getBackcolor());
      }
    }

    RotationEnum rotation =
        element instanceof JRPrintText
            ? ((JRPrintText) element).getRotationValue()
            : RotationEnum.NONE;
    VerticalAlignEnum vAlign = VerticalAlignEnum.TOP;
    HorizontalAlignEnum hAlign = HorizontalAlignEnum.LEFT;

    JRAlignment alignment = element instanceof JRAlignment ? (JRAlignment) element : null;
    if (alignment != null) {
      vAlign = alignment.getVerticalAlignmentValue();
      hAlign = alignment.getHorizontalAlignmentValue();
    }

    horizontalAlignment = ParagraphStyle.getHorizontalAlignment(hAlign, vAlign, rotation);
    verticalAlignment = ParagraphStyle.getVerticalAlignment(hAlign, vAlign, rotation);

    setBox(gridCell.getBox());
  }
コード例 #2
0
  public void exportElement(
      JRDocxExporterContext exporterContext,
      JRGenericPrintElement element,
      JRExporterGridCell gridCell) {
    JRDocxExporter exporter = (JRDocxExporter) exporterContext.getExporterRef();

    JRExporterGridCell newGridCell = getGridCellReplacement(exporterContext, element, gridCell);

    exporter.exportText(
        exporterContext.getTableHelper(), (JRPrintText) newGridCell.getElement(), newGridCell);
  }