Package org.jsoup.nodes

Examples of org.jsoup.nodes.Element.children()


  private static void setColumnWidth(HSSFSheet sheet, Element table) {
    Elements colgroups = table.select("colgroup");
    // 首先设置列宽
    if (colgroups.size() > 0) {
      Element colgroup = colgroups.get(0);
      Elements cols = colgroup.children();
      for (int i = 0; i < cols.size(); i++) {
        Element col = cols.get(i);
        int width = DEFAULT_COLUMN_WIDTH;
        try {
          if (col.hasAttr("width")) {
View Full Code Here


  private static void hideHTMLCells(Element table,int startrow,int startcolumn,int endrow,int endcolumn){
    if(table!=null){
      Elements trs = table.select("tr");
      for(int i=startrow;i<=endrow&&i<trs.size();i++){
        Element tr = trs.get(i);
        Elements tds = tr.children();
        for(int j=startcolumn;j<=endcolumn&&j<tds.size();j++){
          Element td = tds.get(j);
          if(i==startrow&&j==startcolumn){
           
          }else{
View Full Code Here

        int startColumn = rangeAddress.getFirstColumn();
        int rowspan = rangeAddress.getLastRow()-startRow+1;
        int colspan = rangeAddress.getLastColumn()-startColumn+1;
        if(startRow<trs.size()){
          Element tr = trs.get(startRow);
          Elements tds = tr.children();
          if(startColumn<tds.size()){
            Element td = tds.get(startColumn);
            if(rowspan>1){
              td.attr("rowspan",String.valueOf(rowspan));
            }
View Full Code Here

            }
            if(colspan>1){
              for(int j=0;j<rowspan;j++){
                if(startRow+j<trs.size()){
                  Element spanTr = trs.get(startRow+j);
                  Elements spanTds = spanTr.children();
                  if(startColumn<spanTds.size()){
                    Element spanTd = spanTds.get(startColumn);
                    spanTd.attr("colspan",String.valueOf(colspan));
                  }
                }
View Full Code Here

    Elements trs = table.select("tr");
    // 首先设置列宽
    if (trs.size() > 0) {
      for (int i = 0; i < trs.size(); i++) {
        Element tr = trs.get(i);
        Elements tds = tr.children();
        HSSFRow row = sheet.getRow(i);
        if (tds != null) {
          if (row == null) {
            row = sheet.createRow(i);
          }
View Full Code Here

    Elements trs = table.select("tr");
    // 首先设置列宽
    if (trs.size() > 0) {
      for (int i = 0; i < trs.size(); i++) {
        Element tr = trs.get(i);
        Elements tds = tr.children();
        HSSFRow row = sheet.getRow(i);
        if (tds != null) {
          if (row == null) {
            row = sheet.createRow(i);
          }
View Full Code Here

      int totalMaxColumns = 0;
      final int[] colspans = new int[trs.size()];
      for(int tri=0;tri<trs.size();tri++){
        Element tr = trs.get(tri);
//        Elements tds = tr.select("td");
        Elements tds = tr.children();
        int totalColumns = 0;
        for(int tdi=0;tdi<tds.size();tdi++){
          Element td = tds.get(tdi);
          int colspan = 1;
          if(td.hasAttr("colspan")){
View Full Code Here

    int totalColumns = -1;
    if(table!=null){
      Elements colgroups = table.select("colgroup");
      if(colgroups.size()>0){
        Element colgroup = colgroups.get(0);
        totalColumns = column+colgroup.children().size();
        for(int i=0;i<column;i++){
          colgroup.prepend("<col width=\"67\" />");
        }
      }
      Elements tbodys = table.select("tbody");
View Full Code Here

          tbody.prepend("<tr/>");
          for(int j=0;j<totalColumns;j++){
            tbody.child(0).append("<td/>");
          }
        }
        for(int i=row;i<tbody.children().size();i++){
          Element tr = tbody.child(i);
          for(int j=0;j<column;j++){
            tr.prepend("<td/>");
          }
        }
View Full Code Here

  public static void setTableFormula(Element table,int row,int column,String formula){
    if(table!=null){
      Elements trs = table.select("tr");
      if(trs.size()>row){
        Element tr = trs.get(row);
        Elements tds = tr.children();
        if(tds.size()>column){
          Element td = tds.get(column);
          if(!StringUtils.isBlank(formula)){
            if(formula.startsWith("=")){
              td.attr("formula",formula);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.