예제 #1
0
  /**
   * Resolve original style for Sheet.
   *
   * @param fods
   * @param table
   * @return Style display name.
   */
  public static String getTopParentStyleName(Workbook fods, Sheet table) {
    String result = table.getStyleName();

    if (result == null) {
      return null;
    }

    // Look for automatic style
    for (AutomaticStyle s : fods.getAutomaticStyles()) {
      if (s.getName().equals(result)) {
        result = s.getMasterPageName();
        break;
      }
    }

    // Next style should be a master style
    for (Style s : fods.getMasterStyles()) {
      if (s.getName().equals(result)) {
        result = s.getDisplayName();
        break;
      }
    }

    return result;
  }
예제 #2
0
  /**
   * Resolve original style for Cell.
   *
   * @param fods
   * @param cell
   * @return Style display name.
   */
  public static String getTopParentStyleName(Workbook fods, Cell cell) {
    String result = cell.getStyle();

    if (result == null) {
      return null;
    }

    // Look for automatic style
    for (AutomaticStyle s : fods.getAutomaticStyles()) {
      if (s.getName().equals(result)) {
        result = s.getParentName();
        break;
      }
    }

    // Next style should be a standard style
    for (Style s : fods.getStyles()) {
      if (s.getName().equals(result)) {
        result = s.getDisplayName();
        break;
      }
    }

    return result;
  }