@Override
  protected void exportCell(
      String bandName,
      BandElement bandElement,
      Object value,
      int gridRow,
      int row,
      int column,
      int cols,
      int rowSpan,
      int colSpan,
      boolean isImage) {

    if (newRow) {
      // rowNo for a table (it is reset in createTable)
      rowNo++;

      // for first row in page header and page footer we do not add the table row because it will be
      // duplicated
      if (((!ReportLayout.PAGE_HEADER_BAND_NAME.equals(bandName)
              && !ReportLayout.PAGE_FOOTER_BAND_NAME.equals(bandName)))
          || (rowNo > 1)) {
        if (tableRow != null) {
          if (ReportLayout.PAGE_HEADER_BAND_NAME.equals(bandName)) {
            tableHeader.getContent().add(tableRow);
          } else if (ReportLayout.PAGE_FOOTER_BAND_NAME.equals(bandName)) {
            tableFooter.getContent().add(tableRow);
          } else {
            table.getContent().add(tableRow);
          }
        }
        tableRow = factory.createTr();
      }
      // create table header to be available on every page
      if (bean.getReportLayout().isHeaderOnEveryPage()) {
        if (ReportLayout.HEADER_BAND_NAME.equals(bandName)) {
          TrPr rowProperties = new TrPr();
          BooleanDefaultTrue bdt = Context.getWmlObjectFactory().createBooleanDefaultTrue();
          rowProperties
              .getCnfStyleOrDivIdOrGridBefore()
              .add(Context.getWmlObjectFactory().createCTTrPrBaseTblHeader(bdt));
          tableRow.setTrPr(rowProperties);
        }
      }
    }

    renderDocxCell(bandName, bandElement, value, gridRow, rowSpan, colSpan, isImage, column);
  }
  protected void exportCell(
      String bandName,
      BandElement bandElement,
      Object value,
      int gridRow,
      int row,
      int column,
      int cols,
      int rowSpan,
      int colSpan,
      boolean isImage) {

    if (ReportLayout.PAGE_HEADER_BAND_NAME.equals(bandName)) {
      renderCellToHeaderFooter(
          headerS,
          bandName,
          bandElement,
          value,
          gridRow,
          row,
          column,
          cols,
          rowSpan,
          colSpan,
          isImage);
    } else if (ReportLayout.PAGE_FOOTER_BAND_NAME.equals(bandName)) {
      renderCellToHeaderFooter(
          footerS,
          bandName,
          bandElement,
          value,
          gridRow,
          row,
          column,
          cols,
          rowSpan,
          colSpan,
          isImage);
    } else {

      int sheetRow = pageRow % fragmentsize;
      if (column == 0) {
        if (sheetRow == 0) {
          if (page > 1) {
            // wb.write(out);
          }

          if ((page == 1) || (pageRow > 0)) {
            newPage();
            pageRow = 0;
          }
        }
        xlsRow = xlsSheet.createRow(sheetRow);
      }
      if (bean.getReportLayout().isUseSize()) {
        int width = (int) (bean.getReportLayout().getColumnsWidth().get(column) * POINTS_FOR_PIXEL);
        // System.out.println("row="+row+ "  col="+column +
        // "  width="+width);
        xlsSheet.setColumnWidth(column, width);
      }

      renderCell(
          bandElement, bandName, value, gridRow, sheetRow, column, rowSpan, colSpan, isImage);
    }
  }
  private void renderDocxCell(
      String bandName,
      BandElement bandElement,
      Object value,
      int gridRow,
      int rowSpan,
      int colSpan,
      boolean image,
      int column) {
    Map<String, Object> style = buildCellStyleMap(bandElement, value, gridRow, column, colSpan);

    String verticalMergedVal = null;
    if (rowSpan > 1) {
      verticalMergedVal = "restart";
      rowSpanForColumn.put(column, rowSpan);
    } else {
      int span = rowSpanForColumn.get(column);
      if (span > 1) {
        rowSpanForColumn.put(column, span - 1);
        if (span == 2) {
          // last cell to merge vertically
          verticalMergedVal = "close";
        } else {
          verticalMergedVal = "";
        }
      }
    }

    int width = headerwidths[column];
    if (colSpan > 1) {
      for (int i = 1; i < colSpan; i++) {
        width += headerwidths[column + i];
      }
    }

    if (image) {
      if (value == null) {
        addTableCell(tableRow, bandElement, "", width, style, colSpan, verticalMergedVal);
      } else {
        ImageBandElement ibe = (ImageBandElement) bandElement;
        P pImage;
        try {
          byte[] imageD = getImage((String) value);
          byte[] imageBytes = getImage(imageD, ibe.getWidth(), ibe.getHeight());
          int imageW;
          if (ibe.getWidth() == null) {
            imageW = getRealImageSize(imageBytes)[0];
          } else {
            imageW = ibe.getWidth();
          }
          pImage = newImage(wordMLPackage, imageBytes, null, null, 0, 1, pixelsToDxa(imageW));
          addTableCell(
              tableRow, bandElement, pImage, width, style, colSpan, verticalMergedVal, true);
        } catch (Exception e) {
          e.printStackTrace();
        }
      }
    } else if (bandElement instanceof HyperlinkBandElement) {
      Hyperlink hyperlink = ((HyperlinkBandElement) bandElement).getHyperlink();
      addHyperlinkTableCell(
          tableRow, bandElement, hyperlink, width, style, colSpan, verticalMergedVal);

    } else if (bandElement instanceof ReportBandElement) {
      Report report = ((ReportBandElement) bandElement).getReport();
      ExporterBean eb = null;
      try {
        eb = getSubreportExporterBean(report);
        DocxExporter subExporter = new DocxExporter(eb, width);
        subExporter.export();
        Tbl innerTable = subExporter.getTable();
        addSubreportTableCell(
            tableRow, bandElement, innerTable, width, style, colSpan, verticalMergedVal);
      } catch (Exception e) {
        addTableCell(tableRow, bandElement, "", width, style, colSpan, verticalMergedVal);
        e.printStackTrace();
      } finally {
        if ((eb != null) && (eb.getResult() != null)) {
          eb.getResult().close();
        }
      }
    } else if (((bandElement instanceof VariableBandElement)
            && (VariableFactory.getVariable(((VariableBandElement) bandElement).getVariable())
                instanceof PageNoVariable))
        || ((bandElement instanceof ExpressionBandElement)
            && ((ExpressionBandElement) bandElement)
                .getExpression()
                .contains(PageNoVariable.PAGE_NO_PARAM))) {

      // limitation: if header or footer contains PAGE_NO varaible, only this will be shown,
      // all other cells from header/footer will be ignored
      if (ReportLayout.PAGE_HEADER_BAND_NAME.equals(bandName)) {
        hasPageNoHeader = true;
      } else if (ReportLayout.PAGE_FOOTER_BAND_NAME.equals(bandName)) {
        hasPageNoFooter = true;
      }
      // does not work (we should add pageNo to header or footer directly and not inside a table
      // P numP = createPageNumParagraph();
      // addTableCell(tableRow, bandElement, bandElement.getText(), numP, width, style, colSpan,
      // verticalMergedVal);

    } else if (bandElement instanceof ImageColumnBandElement) {
      try {
        String v = StringUtil.getValueAsString(value, null);
        if (StringUtil.BLOB.equals(v)) {
          addTableCell(
              tableRow, bandElement, StringUtil.BLOB, width, style, colSpan, verticalMergedVal);
        } else {
          ImageColumnBandElement icbe = (ImageColumnBandElement) bandElement;
          byte[] imageD = StringUtil.decodeImage(v);
          byte[] imageBytes = getImage(imageD, icbe.getWidth(), icbe.getHeight());
          int imageW;
          if (icbe.getWidth() == null) {
            imageW = getRealImageSize(imageBytes)[0];
          } else {
            imageW = icbe.getWidth();
          }
          P pImage = newImage(wordMLPackage, imageBytes, null, null, 0, 1, pixelsToDxa(imageW));
          addTableCell(
              tableRow, bandElement, pImage, width, style, colSpan, verticalMergedVal, true);
        }
      } catch (Exception e) {
        e.printStackTrace();
        addTableCell(
            tableRow, bandElement, IMAGE_NOT_LOADED, width, style, colSpan, verticalMergedVal);
      }
    } else {
      String stringValue;
      if (style.containsKey(StyleFormatConstants.PATTERN)) {
        stringValue =
            StringUtil.getValueAsString(
                value, (String) style.get(StyleFormatConstants.PATTERN), getReportLanguage());
      } else {
        stringValue = StringUtil.getValueAsString(value, null, getReportLanguage());
      }
      if (stringValue == null) {
        stringValue = "";
      }
      addTableCell(tableRow, bandElement, stringValue, width, style, colSpan, verticalMergedVal);
    }
  }