示例#1
0
  /**
   * The reference for the cell in the top-left part of the table (see Open Office XML Part 4:
   * chapter 3.5.1.2, attribute ref)
   *
   * @return
   */
  public CellReference getStartCellReference() {

    if (startCellReference == null) {
      String ref = ctTable.getRef();
      String[] boundaries = ref.split(":");
      String from = boundaries[0];
      startCellReference = new CellReference(from);
    }
    return startCellReference;
  }
示例#2
0
  /**
   * The reference for the cell in the bottom-right part of the table (see Open Office XML Part 4:
   * chapter 3.5.1.2, attribute ref)
   *
   * @return
   */
  public CellReference getEndCellReference() {

    if (endCellReference == null) {

      String ref = ctTable.getRef();
      String[] boundaries = ref.split(":");
      String from = boundaries[1];
      endCellReference = new CellReference(from);
    }
    return endCellReference;
  }
示例#3
0
  public List<XSSFXmlColumnPr> getXmlColumnPrs() {

    if (xmlColumnPr == null) {
      xmlColumnPr = new Vector<XSSFXmlColumnPr>();
      for (CTTableColumn column : ctTable.getTableColumns().getTableColumnArray()) {
        if (column.getXmlColumnPr() != null) {
          XSSFXmlColumnPr columnPr = new XSSFXmlColumnPr(this, column, column.getXmlColumnPr());
          xmlColumnPr.add(columnPr);
        }
      }
    }
    return xmlColumnPr;
  }
示例#4
0
  /**
   * Calculates the xpath of the root element for the table. This will be the common part of all the
   * mapping's xpaths
   *
   * @return the xpath of the table's root element
   */
  public String getCommonXpath() {

    if (commonXPath == null) {

      String[] commonTokens = {};

      for (CTTableColumn column : ctTable.getTableColumns().getTableColumnArray()) {
        if (column.getXmlColumnPr() != null) {
          String xpath = column.getXmlColumnPr().getXpath();
          String[] tokens = xpath.split("/");
          if (commonTokens.length == 0) {
            commonTokens = tokens;

          } else {
            int maxLenght =
                commonTokens.length > tokens.length ? tokens.length : commonTokens.length;
            for (int i = 0; i < maxLenght; i++) {
              if (!commonTokens[i].equals(tokens[i])) {
                List<String> subCommonTokens = Arrays.asList(commonTokens).subList(0, i);

                String[] container = {};

                commonTokens = subCommonTokens.toArray(container);
                break;
              }
            }
          }
        }
      }

      commonXPath = "";

      for (int i = 1; i < commonTokens.length; i++) {
        commonXPath += "/" + commonTokens[i];
      }
    }

    return commonXPath;
  }
示例#5
0
 /**
  * the number of mapped table columns (see Open Office XML Part 4: chapter 3.5.1.4)
  *
  * @return
  */
 public long getNumerOfMappedColumns() {
   return ctTable.getTableColumns().getCount();
 }