Package org.jsoup.nodes

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


      for (int i = 0; i < cols.size(); i++) {
        Element col = cols.get(i);
        int width = DEFAULT_COLUMN_WIDTH;
        try {
          if (col.hasAttr("width")) {
            String widthS = col.attr("width");
            if(widthS.endsWith("px")){
              widthS = widthS.replaceAll("px", "");
            }
            width = Integer.parseInt(widthS);
          }
View Full Code Here


      Row row = sheet.getRow(i);
      if(row!=null){
//        int firstColumn = row.getFirstCellNum();
        Element tr = table.appendElement("tr");
        if(row.getHeightInPoints()<DEFAULT_ROW_HEIGHT){
          tr.attr("height",String.valueOf(pointsToPixels(DEFAULT_ROW_HEIGHT-6))+"px");
        }else{
          tr.attr("height",String.valueOf(pointsToPixels(row.getHeightInPoints()))+"px");
        }
      }else{
        Element tr = table.appendElement("tr");
View Full Code Here

//        int firstColumn = row.getFirstCellNum();
        Element tr = table.appendElement("tr");
        if(row.getHeightInPoints()<DEFAULT_ROW_HEIGHT){
          tr.attr("height",String.valueOf(pointsToPixels(DEFAULT_ROW_HEIGHT-6))+"px");
        }else{
          tr.attr("height",String.valueOf(pointsToPixels(row.getHeightInPoints()))+"px");
        }
      }else{
        Element tr = table.appendElement("tr");
        tr.attr("height",String.valueOf(pointsToPixels(DEFAULT_ROW_HEIGHT))+"px");
      }
View Full Code Here

        }else{
          tr.attr("height",String.valueOf(pointsToPixels(row.getHeightInPoints()))+"px");
        }
      }else{
        Element tr = table.appendElement("tr");
        tr.attr("height",String.valueOf(pointsToPixels(DEFAULT_ROW_HEIGHT))+"px");
      }
    }
  }
 
  private static void setRowHeight(HSSFSheet sheet, Element table) {
View Full Code Here

      for (int i = 0; i < trs.size(); i++) {
        Element tr = trs.get(i);
        int height = DEFAULT_ROW_HEIGHT;
        try {
          if (tr.hasAttr("height")) {
            String heightS = tr.attr("height");
            if (heightS.endsWith("px")) {
              heightS = StringUtils.replace(heightS, "px", "");
            }
            height = Integer.parseInt(heightS);
          }
View Full Code Here

          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));
            }
            if(colspan>1){
              for(int j=0;j<rowspan;j++){
                if(startRow+j<trs.size()){
                  Element spanTr = trs.get(startRow+j);
View Full Code Here

                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));
                  }
                }
              }
            }
            if(rowspan>1||colspan>1){
View Full Code Here

          for (int j = 0; j < tds.size(); j++) {
            Element td = tds.get(j);
            int rowspan = 1;
            if (td.hasAttr("rowspan")) {
              try {
                rowspan = Integer.parseInt(td.attr("rowspan"));
              } catch (NumberFormatException e) {
                e.printStackTrace();
              }
            }
            int colspan = 1;
View Full Code Here

              }
            }
            int colspan = 1;
            if (td.hasAttr("colspan")) {
              try {
                colspan = Integer.parseInt(td.attr("colspan"));
              } catch (NumberFormatException e) {
                e.printStackTrace();
              }
            }
            if (rowspan > 1) {
View Full Code Here

              }else{
                Cell cell = row.getCell(j);
                Element td = tr.appendElement("td");
                if(cell!=null){
                  if(cell.getCellType()==Cell.CELL_TYPE_FORMULA){
                    td.attr("formula","="+cell.getCellFormula());
                  }else if(cell.getCellType()==Cell.CELL_TYPE_BLANK){
                   
                  }else if(cell.getCellType()==Cell.CELL_TYPE_BOOLEAN){
                    td.text(String.valueOf(cell.getBooleanCellValue()));
                  }else if(cell.getCellType()==Cell.CELL_TYPE_ERROR){
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.