Package org.jsoup.nodes

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


          for (int j = 0; j < tds.size(); j++) {
            Element td = tds.get(j);
            // System.out.println(td.text());
            HSSFCell cell = null;
            if (td.hasAttr("formula")) {
              String formula = td.attr("formula");
              String excelFormula = formula;
              if (formula.startsWith("=")) {
                excelFormula = formula.substring(1);
              }
              if (StringUtils.isBlank(excelFormula)) {
View Full Code Here


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

          for(int tdi=0;tdi<tds.size();tdi++){
            Element td = tds.get(tdi);
            int colspan = 1;
            if(td.hasAttr("colspan")){
              try{
                colspan = Integer.parseInt(td.attr("colspan"));
              }catch(NumberFormatException e){
                e.printStackTrace();
              }
              for(int coli=0;coli<colspan-1;coli++){
                td.after("<td style=\"display: none;\"/>");
View Full Code Here

              }
            }
            int rowspan = 1;
            if(td.hasAttr("rowspan")){
              try{
                rowspan = Integer.parseInt(td.attr("rowspan"));
              }catch(NumberFormatException e){
                e.printStackTrace();
              }
              for(int rowi=1;rowi<rowspan;rowi++){
                if(tri+rowi<trs.size()){
View Full Code Here

      Element body = doc.body();
      for(int i=0;i<book.getNumberOfSheets();i++){
        Sheet sheet = book.getSheetAt(i);
        if(!ExcelUtility.isEmptySheet(sheet)){
          Element table = body.appendElement("table");
          table.attr("title",sheet.getSheetName());
          ExcelUtility.convertSheet2HTMLTable(sheet, table);
        }
      }
      result.setSucceed();
      result.setData(doc.select("table").toString());
View Full Code Here

      HSSFWorkbook book = new HSSFWorkbook();
      for(int i=0;i<tables.size();i++){
        Element table = tables.get(i);
        HSSFSheet sheet = null;
        if(table.hasAttr("title")){
           sheet = book.createSheet(table.attr("title"));
        }else{
          sheet = book.createSheet();
        }
      }
      WorkbookStyleContainer styleContainer = new WorkbookStyleContainer();
View Full Code Here

        Elements tableElements = doc.select("table");
        for(int i=0;i<tableElements.size();i++){
          Element table = tableElements.get(i);
          if(table.hasAttr("title")){
            if(wb.getNumberOfSheets()>i){
              wb.setSheetName(i, table.attr("title"));
            }
          }
        }
        return wb;
      } catch (Exception e) {
View Full Code Here

        Elements tds = tr.children();
        if(tds.size()>column){
          Element td = tds.get(column);
          if(!StringUtils.isBlank(formula)){
            if(formula.startsWith("=")){
              td.attr("formula",formula);
            }else{
              td.attr("formula","="+formula);
            }
          }
        }
View Full Code Here

          Element td = tds.get(column);
          if(!StringUtils.isBlank(formula)){
            if(formula.startsWith("=")){
              td.attr("formula",formula);
            }else{
              td.attr("formula","="+formula);
            }
          }
        }
      }
    }
View Full Code Here

      Elements trs = element.select("tr");
      for(int tri=0;tri<trs.size();tri++){
        Element tr = trs.get(tri);
        int trHeight = -1;
        if(tr.hasAttr("height")){
          String trHeightS = tr.attr("height");
          try{
            trHeight = Integer.parseInt(trHeightS);
          }catch(NumberFormatException e){
            e.printStackTrace();
          }
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.