jax导出示例



public class JexcelAPIUtils {

    public static final String report_type_cpumem = "1";//cpu mem access
    public static final String report_type_portlink = "2";
    public static final String report_type_ippool = "3";
    public static final String report_type_onlineuser = "4";
    public static final String report_type_etoe = "5";
    public static final String report_type_tcp = "6";
    public static final String report_type_dns = "7";
    public static final String report_type_alert = "8";
    public static final String report_type_temperature = "9";
    public static final String report_type_harddisk = "10";
    public static final String report_type_port5s = "11";
    public static final String report_type_compare = "12";
    public static final String report_type_adsldis = "13";
    public static final String report_type_portlinkGroup = "14";
    public static final String report_type_http = "15";
    public static final String report_type_ftp = "16";
    public static final String report_type_ping = "17";
    public static final String report_type_chuckpackage = "18";
    public static final String report_type_transferspackage = "19";
    public static final String report_type_logquery = "20";
    public static final String sla_report_type_PATH = "21";
    public static final String sla_report_type_Link = "23";
    public static final String sla_report_type_UsefulRate = "22";
    public static final String sla_report_type_CUP = "24";
    
    //光功
    public static final String report_type_portlaser = "25";
    private HttpServletRequest request;


    public JexcelAPIUtils(HttpServletRequest request) {
        super();
        // TODO Auto-generated constructor stub
        this.request = request;
    }

    public JexcelAPIUtils() {
    }

    public WritableWorkbook makeExcel(WritableWorkbook wwb) throws Exception{
        String rtype = (String) this.request.getAttribute("report_type");
        if(rtype.equals(JexcelAPIUtils.report_type_cpumem)){
            wwb = this.makeCUPMEMExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_portlink)){
            wwb = this.makePortLinkExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_portlaser)){
            wwb = this.makePortLaserExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_ippool)){
            wwb = this.makeIPPoolExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_onlineuser)){
            wwb = this.makeOnlineUserExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_etoe)){
            wwb = this.makeEtoeExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_tcp)){
            wwb = this.makeTCPExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_dns)){
            wwb = this.makeDNSExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_alert)){
            wwb = this.makeAlertExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_temperature)){
            wwb = this.makeTemperatureExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_harddisk)){
            wwb = this.makeHarddiskExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_port5s)){
            wwb = this.makePort5sExcel(wwb);
        }/*else if(rtype.equals(JexcelAPIUtils.report_type_compare)){
            wwb = this.makeCompareExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_adsldis)){
            wwb = this.makeAdslDisExcel(wwb);
        }*/else if(rtype.equals(JexcelAPIUtils.report_type_portlinkGroup)){
            wwb = this.makePortLinkGroupExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_http)){
            wwb = this.makeHTTPExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_ftp)){
            wwb = this.makeFTPExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_ping)){
            wwb = this.makePINGExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_chuckpackage)){
            wwb = this.makeChuckpackageExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_transferspackage)){
            wwb = this.makeChuckpackageExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.report_type_logquery)){
            wwb = this.makeLogQueryExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.sla_report_type_PATH)){
            wwb = this.makePathExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.sla_report_type_UsefulRate)){
            wwb = this.makeUsefulRateExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.sla_report_type_Link)){
            wwb = this.makeLinkExcel(wwb);
        }else if(rtype.equals(JexcelAPIUtils.sla_report_type_CUP)){
            wwb = this.makeCUPExcel(wwb);
        }
        return wwb;
    }
    private WritableWorkbook makeLogQueryExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        LogQueryForm form = (LogQueryForm) request.getAttribute("LogQueryForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,10);
        sheet.setColumnView(1,20);
        sheet.setColumnView(2,10);
        sheet.setColumnView(3,35);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        //sheet.setColumnView(10,10);

        int rownum = sheet.getRows();

        //标题
        String title = ResourceZl.getResource("log")+    ResourceApp.getResource("detail");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,6,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,6,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"user.name"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"create")+ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceZl.getString(locale,"log")+ResourceZl.getString(locale,"level"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceZl.getString(locale,"log")+ResourceZl.getString(locale,"detail"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceZl.getString(locale,"app")+ResourceZl.getString(locale,"class"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceZl.getString(locale,"sys")+ResourceZl.getString(locale,"class"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceZl.getString(locale,"oper")+ResourceZl.getString(locale,"class"),format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            LogQueryMod data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (LogQueryMod) l.get(i);

                label = new Label(0,rownum,data.getUsername(),format);
                sheet.addCell(label);
                label = new Label(1,rownum,data.getInsertdate(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(2,rownum,data.getLoglevel(),numf);
                sheet.addCell(nc);
                label = new Label(3,rownum,data.getSummary(),format);
                sheet.addCell(label);
                label = new Label(4,rownum,data.getAppclassname(),format);
                sheet.addCell(label);
                label = new Label(5,rownum,data.getSysclassname(),format);
                sheet.addCell(label);
                label = new Label(6,rownum,data.getOperclassname(),format);
                sheet.addCell(label);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,6,rownum);
        //条件
        String condate = form.getQuerytime();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query")+ResourceApp.getString(locale,"date")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,6,rownum);

        return wwb;
    }

    private WritableWorkbook makeChuckpackageExcel(WritableWorkbook wwb)throws Exception {
        /*    ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        sheet.setColumnView(7,15);
        //sheet.setColumnView(8,10);
        //sheet.setColumnView(9,10);
        //sheet.setColumnView(10,10);

        int rownum = sheet.getRows();

        String mt = StringUtil.fill_null(form.getMenutype());
        String temp ="",tstr="";
        if(mt.equals("14")){
            temp = ResourceApp.getString(request.getLocale(),"drop.package");
            tstr = ResourceApp.getString(request.getLocale(),"drop.package")+"("+
            ResourceApp.getString(request.getLocale(),"unit")+")";
        }else if(mt.equals("15")){
            temp = ResourceApp.getString(request.getLocale(),"abandon.package");
            tstr = ResourceApp.getString(request.getLocale(),"abandon.package")+"("+
            ResourceApp.getString(request.getLocale(),"unit")+")";
        }else if(mt.equals("19")){
            temp = ResourceApp.getString(request.getLocale(),"transfers.package");
            tstr = ResourceApp.getString(request.getLocale(),"packet")+"("+
            ResourceApp.getString(request.getLocale(),"unit")+")";
        }

        //标题
        String title = form.getAlias()+" "+temp+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,7,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,7,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"min")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"avg")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"max")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"min")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"avg")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"max")+
                tstr,format);
        sheet.addCell(label);
        //label = new Label(9,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        //sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            PortLinkDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (PortLinkDataModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(1,rownum,data.getMinin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getAvgin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getMaxin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getMinout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(5,rownum,data.getAvgout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(6,rownum,data.getMaxout(),numf);
                sheet.addCell(nc);
                //nc = new jxl.write.Number(9,rownum,data.getAvail(),numf);
                //sheet.addCell(nc);
                nc = new jxl.write.Number(7,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,7,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,7,rownum);
        */
        return wwb;
    }

    private WritableWorkbook makePINGExcel(WritableWorkbook wwb)throws Exception  {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        sheet.setColumnView(7,15);
        sheet.setColumnView(8,15);
        sheet.setColumnView(9,15);

        int rownum = sheet.getRows();

        //标题
        String title = "PING "+ form.getAlias()+
         ResourceApp.getString(request.getLocale(),"capability")+
            ResourceApp.getString(request.getLocale(),"history")+
            ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceOther.getString(locale,"serviceconfig.ping.sip"),format);
        sheet.addCell(label);

        label = new Label(2,rownum,ResourceOther.getString(locale,"serviceconfig.ping.sdesc"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceOther.getString(locale,"serviceconfig.ping.sport"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"min")+
                ResourceOther.getString(locale,"threshold.etoe.oututilmin"),format);
        sheet.addCell(label);
        label = new Label(8,rownum,ResourceApp.getString(locale,"avg")+
                ResourceOther.getString(locale,"threshold.etoe.oututilmin"),format);
        sheet.addCell(label);
        label = new Label(9,rownum,ResourceApp.getString(locale,"max")+
                ResourceOther.getString(locale,"threshold.etoe.oututilmin"),format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            ServerDataModal data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (ServerDataModal) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                label = new Label(1,rownum,data.getSip(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getSdesc(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getSport(),format);
                sheet.addCell(label);

                nc = new jxl.write.Number(4,rownum,data.getMin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(5,rownum,data.getAvg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(6,rownum,data.getMax(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(7,rownum,data.getLossmin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(8,rownum,data.getLossavg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(9,rownum,data.getLossmax(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);

        return wwb;
    }

    private WritableWorkbook makeFTPExcel(WritableWorkbook wwb)throws Exception  {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        sheet.setColumnView(7,15);

        int rownum = sheet.getRows();

        //标题
        String title = "FTP "+ form.getAlias()+
         ResourceApp.getString(request.getLocale(),"capability")+
            ResourceApp.getString(request.getLocale(),"history")+
            ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,7,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,7,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceOther.getString(locale,"serviceconfig.ftp.sip"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceOther.getString(locale,"serviceconfig.ftp.sdesc"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceOther.getString(locale,"serviceconfig.ftp.susername"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            ServerDataModal data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (ServerDataModal) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                label = new Label(1,rownum,data.getSip(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getSdesc(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getSusername(),format);
                sheet.addCell(label);

                nc = new jxl.write.Number(4,rownum,data.getMin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(5,rownum,data.getAvg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(6,rownum,data.getMax(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(7,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,7,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,7,rownum);

        return wwb;
    }

    private WritableWorkbook makeHTTPExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);

        int rownum = sheet.getRows();

        //标题
        String title = "HTTP "+ form.getAlias()+
         ResourceApp.getString(request.getLocale(),"capability")+
            ResourceApp.getString(request.getLocale(),"history")+
            ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,5,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,5,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceOther.getString(locale,"serviceconfig.http.sdesc"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            ServerDataModal data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (ServerDataModal) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                label = new Label(1,rownum,data.getSdesc(),format);
                sheet.addCell(label);

                nc = new jxl.write.Number(2,rownum,data.getMin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getAvg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getMax(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(5,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,5,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,5,rownum);

        return wwb;
    }

    /*private WritableWorkbook makeAdslDisExcel(WritableWorkbook wwb)throws Exception  {
        // TODO Auto-generated method stub
        AdslRateDistributeForm form = (AdslRateDistributeForm) request.getAttribute("adslRateDistributeForm");

        Locale locale = request.getLocale();
        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,45);
        sheet.setColumnView(1,45);

        int rownum = sheet.getRows();

        //标题
        String title = StringUtil.fill_null((String) request.getAttribute("titlename"));
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,1,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,1,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"rate.distribute")+"(KB)",format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"port")+
                "("+
                ResourceApp.getString(locale,"unit")+
                ")",format);
        sheet.addCell(label);

        //数据
        List l = form.getTabledata();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            CompareModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (CompareModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(1,rownum,data.getLine(),numf);
                sheet.addCell(nc);
            }
        }
        return wwb;
    }

    private WritableWorkbook makeCompareExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        HistoryCompareForm form = (HistoryCompareForm) request.getAttribute("historyCompareForm");

        Locale locale = request.getLocale();
        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,35);
        sheet.setColumnView(1,35);
        sheet.setColumnView(2,35);

        int rownum = sheet.getRows();

        //标题
        String title = StringUtil.fill_null((String) request.getAttribute("titlename"));
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,2,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,2,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"comparetime"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"begin")+
                ResourceApp.getString(locale,"date")+
                ResourceApp.getString(locale,"line")+
                request.getAttribute("unit"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"begin")+
                ResourceApp.getString(locale,"date")+
                ResourceApp.getString(locale,"line")+
                request.getAttribute("unit"),format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            CompareModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (CompareModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(1,rownum,data.getLine(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getCompareline(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,2,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,2,rownum);

        return wwb;
    }*/

    private WritableWorkbook makePort5sExcel(WritableWorkbook wwb)throws Exception  {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Port5sgenModel model = (Port5sgenModel)request.getAttribute("geninfo");
        LabelValueBean units = (LabelValueBean)request.getAttribute("units");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,30);
        sheet.setColumnView(1,30);
        sheet.setColumnView(2,30);

        int rownum = sheet.getRows();

        //标题
        //String cid = StringUtil.fill_null(form.getCid());
        String title = form.getAlias() + " " +
            form.getQuerytime() +
            ResourceApp.getString(request.getLocale(),"hour") +
            ResourceApp.getString(request.getLocale(),"in")+
            ResourceApp.getString(request.getLocale(),"out")+
            ResourceApp.getString(request.getLocale(),"speedrate");

        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,2,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"scout")+ResourceApp.getString(locale,"time")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,2,rownum);

        //统计数据
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"in")+ResourceApp.getString(locale,"min")+":" + model.getMinin() + units.getLabel() + "/s");
        label.setCellFormat(format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"in")+ResourceApp.getString(locale,"avg")+":" + model.getAvgin() + units.getLabel() + "/s");
        label.setCellFormat(format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"in")+ResourceApp.getString(locale,"max")+":" + model.getMaxin() + units.getLabel() + "/s");
        label.setCellFormat(format);
        sheet.addCell(label);
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"out")+ResourceApp.getString(locale,"min")+":" + model.getMinout() + units.getLabel() + "/s");
        label.setCellFormat(format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"out")+ResourceApp.getString(locale,"avg")+":" + model.getAvgout() + units.getLabel() + "/s");
        label.setCellFormat(format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"out")+ResourceApp.getString(locale,"max")+":" + model.getMaxout() + units.getLabel() + "/s");
        label.setCellFormat(format);
        sheet.addCell(label);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"time"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"speedrate") + "(" + units.getLabel() +"/s)",format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"speedrate") + "(" + units.getLabel() +"/s)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            Port5sModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (Port5sModel) l.get(i);

                label = new Label(0,rownum,data.getTime(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(1,rownum,data.getIn(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getOut(),numf);
                sheet.addCell(nc);
            }
        }

        return wwb;
    }

    private WritableWorkbook makeHarddiskExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        sheet.setColumnView(7,15);
        sheet.setColumnView(8,15);
        sheet.setColumnView(9,15);
        sheet.setColumnView(10,10);
        sheet.setColumnView(11,10);
        sheet.setColumnView(12,10);
        sheet.setColumnView(13,10);

        int rownum = sheet.getRows();

        //标题
        String filename = form.getAlias() + form.getCardname();
        String title = ResourceApp.getString(request.getLocale(),"harddisk") + "-"+filename +ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,13,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,13,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        /*label = new Label(1,rownum,ResourceApp.getString(locale,"device")+
                ResourceApp.getString(locale,"description"),format);
        sheet.addCell(label);    */
        /*label = new Label(2,rownum,ResourceApp.getString(locale,"branch")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);*/
        label = new Label(1,rownum,ResourceApp.getString(locale,"device")+
                ResourceApp.getString(locale,"alias"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,"IP"+ResourceApp.getString(locale,"address"),format);
        sheet.addCell(label);
        /*label = new Label(5,rownum,ResourceApp.getString(locale,"manufacturer"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);*/
        label = new Label(3,rownum,ResourceApp.getString(locale,"harddisk")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"storage")+
                ResourceApp.getString(locale,"type"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"capacity")+"(GB)",format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"usable"),format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"usable"),format);
        sheet.addCell(label);
        label = new Label(8,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"usable"),format);
        sheet.addCell(label);
        label = new Label(9,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            HarddiskDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (HarddiskDataModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                /*label = new Label(1,rownum,data.getPdesc(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getGrpname(),format);
                sheet.addCell(label);*/
                label = new Label(1,rownum,data.getSysalias(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getIpaddress(),format);
                sheet.addCell(label);
                /*label = new Label(5,rownum,data.getMfname(),format);
                sheet.addCell(label);
                label = new Label(6,rownum,data.getPrdtname(),format);
                sheet.addCell(label);*/
                label = new Label(3,rownum,data.getDname(),format);
                sheet.addCell(label);
                label = new Label(4,rownum,data.getStorage(),format);
                sheet.addCell(label);
                label = new Label(5,rownum,data.getDsize(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(6,rownum,data.getMin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(7,rownum,data.getAvg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(8,rownum,data.getMax(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(9,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,13,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,13,rownum);

        return wwb;
    }

    private WritableWorkbook makeTemperatureExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        /*ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        sheet.setColumnView(7,15);
        sheet.setColumnView(8,15);
        sheet.setColumnView(9,10);
        sheet.setColumnView(10,10);
        sheet.setColumnView(11,10);
        sheet.setColumnView(12,10);
        //sheet.setColumnView(13,10);

        int rownum = sheet.getRows();

        //标题
        String cid = StringUtil.fill_null(form.getCid());
        String filename = "";
        if(cid.indexOf("_")!=-1){
            filename = form.getAlias() + form.getCardname();
        }else{
            filename = form.getCardname();
        }
        String title = filename +ResourceApp.getString(request.getLocale(),"temperature") +ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,12,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,12,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"branch")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"device")+
                ResourceApp.getString(locale,"alias"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,"IP"+ResourceApp.getString(locale,"address"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"manufacturer"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"type"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"slotcard")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(8,rownum,ResourceApp.getString(locale,"temperature")+
                ResourceApp.getString(locale,"type"),format);
        sheet.addCell(label);
        label = new Label(9,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"temperature"),format);
        sheet.addCell(label);
        label = new Label(10,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"temperature"),format);
        sheet.addCell(label);
        label = new Label(11,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"temperature"),format);
        sheet.addCell(label);
        //label = new Label(12,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        //sheet.addCell(label);
        label = new Label(12,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            TemperatureDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (TemperatureDataModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                label = new Label(1,rownum,data.getGroupname(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getSysalias(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getIpaddress(),format);
                sheet.addCell(label);
                label = new Label(4,rownum,data.getMfname(),format);
                sheet.addCell(label);
                label = new Label(5,rownum,data.getPdesc(),format);
                sheet.addCell(label);
                label = new Label(6,rownum,data.getPrdtname(),format);
                sheet.addCell(label);
                label = new Label(7,rownum,data.getCardname(),format);
                sheet.addCell(label);
                label = new Label(8,rownum,data.getTemptype(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(9,rownum,data.getMin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(10,rownum,data.getAvg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(11,rownum,data.getMax(),numf);
                sheet.addCell(nc);
                //nc = new jxl.write.Number(12,rownum,data.getAvail(),numf);
                //sheet.addCell(nc);
                nc = new jxl.write.Number(12,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,12,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,12,rownum);

        return wwb;*/
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        /*sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        sheet.setColumnView(7,15);
        sheet.setColumnView(8,15);*/
        sheet.setColumnView(1,10);
        sheet.setColumnView(2,10);
        sheet.setColumnView(3,10);
        sheet.setColumnView(4,10);
        //sheet.setColumnView(13,10);

        int rownum = sheet.getRows();

        //标题
        String cid = StringUtil.fill_null(form.getCid());
        String filename = "";
        if(cid.indexOf("_")!=-1){
            filename = form.getAlias() + form.getCardname();
        }else{
            filename = form.getCardname();
        }
        String title = filename +ResourceApp.getString(request.getLocale(),"temperature") +ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        /*label = new Label(1,rownum,ResourceApp.getString(locale,"branch")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"device")+
                ResourceApp.getString(locale,"alias"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,"IP"+ResourceApp.getString(locale,"address"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"manufacturer"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"type"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"slotcard")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(8,rownum,ResourceApp.getString(locale,"temperature")+
                ResourceApp.getString(locale,"type"),format);
        sheet.addCell(label);*/
        label = new Label(1,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"temperature"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"temperature"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"temperature"),format);
        sheet.addCell(label);
        //label = new Label(12,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        //sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            TemperatureDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (TemperatureDataModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                /*label = new Label(1,rownum,data.getGroupname(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getSysalias(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getIpaddress(),format);
                sheet.addCell(label);
                label = new Label(4,rownum,data.getMfname(),format);
                sheet.addCell(label);
                label = new Label(5,rownum,data.getPdesc(),format);
                sheet.addCell(label);
                label = new Label(6,rownum,data.getPrdtname(),format);
                sheet.addCell(label);
                label = new Label(7,rownum,data.getCardname(),format);
                sheet.addCell(label);
                label = new Label(8,rownum,data.getTemptype(),format);
                sheet.addCell(label);*/
                nc = new jxl.write.Number(1,rownum,data.getMin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getAvg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getMax(),numf);
                sheet.addCell(nc);
                //nc = new jxl.write.Number(12,rownum,data.getAvail(),numf);
                //sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        return wwb;
    }

    private WritableWorkbook makeAlertExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        AlertCapabilityForm form = (AlertCapabilityForm) request.getAttribute("alertCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        for(int i=0;i<7;i++){
            sheet.setColumnView(i,15);
        }
        for(int i=7;i<21;i++){
            sheet.setColumnView(i,10);
        }

        int rownum = sheet.getRows();

        //标题
        String title = ResourceApp.getString(request.getLocale(),"alert")+" "+ form.getAlias()+
         ResourceApp.getString(request.getLocale(),"capability")+
            ResourceApp.getString(request.getLocale(),"history")+
            ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,14,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,14,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        /*label = new Label(1,rownum,ResourceApp.getString(locale,"branch") + ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"device")+ResourceApp.getString(locale,"alias"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,"IP"+ResourceApp.getString(locale,"address"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"manufacturer"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"type"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"product")+ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);*/
        label = new Label(1,rownum,ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,"TRAP"+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,"SYSLOG"+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"resource")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"capability")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"critical")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"mostly")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(8,rownum,ResourceApp.getString(locale,"minor")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(9,rownum,ResourceApp.getString(locale,"common")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(10,rownum,ResourceApp.getString(locale,"unsigned")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(11,rownum,ResourceApp.getString(locale,"info")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(12,rownum,ResourceApp.getString(locale,"device")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(13,rownum,ResourceApp.getString(locale,"port")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);
        label = new Label(14,rownum,ResourceApp.getString(locale,"link")+ResourceApp.getString(locale,"alert")+ResourceApp.getString(locale,"total"),format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            AlertDataModal data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (AlertDataModal) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                /*label = new Label(1,rownum,data.getGroupname(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getSysalias(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getIpaddress(),format);
                sheet.addCell(label);
                label = new Label(4,rownum,data.getMfname(),format);
                sheet.addCell(label);
                label = new Label(5,rownum,data.getPdesc(),format);
                sheet.addCell(label);
                label = new Label(6,rownum,data.getPrdtname(),format);
                sheet.addCell(label);*/

                nc = new jxl.write.Number(1,rownum,data.getTotal(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getSnmptrapd(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getSyslogd(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getResourced(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(5,rownum,data.getPerformance(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(6,rownum,data.getCritical(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(7,rownum,data.getMain(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(8,rownum,data.getMinor(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(9,rownum,data.getCommon(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(10,rownum,data.getUnisigned(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(11,rownum,data.getMessages(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(12,rownum,data.getDevices(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(13,rownum,data.getIfs(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(14,rownum,data.getLinks(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,14,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,14,rownum);

        return wwb;
    }

    private WritableWorkbook makeDNSExcel(WritableWorkbook wwb)throws Exception {
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,10);
        //sheet.setColumnView(7,10);

        int rownum = sheet.getRows();

        //标题
        String title = "DNS "+ form.getAlias()+
         ResourceApp.getString(request.getLocale(),"capability")+
            ResourceApp.getString(request.getLocale(),"history")+
            ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,6,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,6,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceOther.getString(locale,"serviceconfig.dns.sip"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceOther.getString(locale,"serviceconfig.dns.sdesc"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"dalay"),format);
        sheet.addCell(label);
        //label = new Label(6,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        //sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            ServerDataModal data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (ServerDataModal) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                label = new Label(1,rownum,data.getSip(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getSdesc(),format);
                sheet.addCell(label);

                nc = new jxl.write.Number(3,rownum,data.getMin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getAvg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(5,rownum,data.getMax(),numf);
                sheet.addCell(nc);
                //nc = new jxl.write.Number(6,rownum,data.getAvail(),numf);
                //sheet.addCell(nc);
                nc = new jxl.write.Number(6,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,6,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,6,rownum);

        return wwb;
    }

    private WritableWorkbook makeTCPExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,10);

        int rownum = sheet.getRows();

        //标题
        String title = "TCP "+ form.getAlias()+
             ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceOther.getString(locale,"serviceconfig.tcp.sip"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceOther.getString(locale,"serviceconfig.tcp.sdesc"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"port"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            ServerDataModal data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (ServerDataModal) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                label = new Label(1,rownum,data.getSip(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getSdesc(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getSport(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(4,rownum,data.getAvail(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        return wwb;
    }

    private WritableWorkbook makeEtoeExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,10);
        sheet.setColumnView(6,10);
        sheet.setColumnView(7,10);
        sheet.setColumnView(8,10);
        sheet.setColumnView(9,10);
        sheet.setColumnView(10,10);
        sheet.setColumnView(11,10);
        sheet.setColumnView(12,10);
        //sheet.setColumnView(10,10);

        int rownum = sheet.getRows();

        //标题
        String title = form.getAlias()+ResourceApp.getString(request.getLocale(),"to")+form.getCardname()+
            " " +ResourceApp.getString(request.getLocale(),"etoe") +ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,12,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,12,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"from")+
                ResourceApp.getString(locale,"alias"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"from")+"IP",format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"destination")+
                ResourceApp.getString(locale,"alias"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"destination")+"IP",format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"dalay")+
                "("+
                ResourceApp.getString(locale,"unit.millisecond")+
                ")",format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"dalay")+
                "("+
                ResourceApp.getString(locale,"unit.millisecond")+
                ")",format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"dalay")+
                "("+
                ResourceApp.getString(locale,"unit.millisecond")+
                ")",format);
        sheet.addCell(label);
        label = new Label(8,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"jitter")+
                "("+
                ResourceApp.getString(locale,"unit.millisecond")+
                ")",format);
        sheet.addCell(label);
        label = new Label(9,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"jitter")+
                "("+
                ResourceApp.getString(locale,"unit.millisecond")+
                ")",format);
        sheet.addCell(label);
        label = new Label(10,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"jitter")+
                "("+
                ResourceApp.getString(locale,"unit.millisecond")+
                ")",format);
        sheet.addCell(label);
        label = new Label(11,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"loss")+
                ResourceApp.getString(locale,"rate")+"(%)",format);
        sheet.addCell(label);
        //label = new Label(9,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        //sheet.addCell(label);
        label = new Label(12,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            EtoeDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (EtoeDataModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                label = new Label(1,rownum,data.getSrcname(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getSrcip(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getDesname(),format);
                sheet.addCell(label);
                label = new Label(4,rownum,data.getDesip(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(5,rownum,data.getMin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(6,rownum,data.getAvg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(7,rownum,data.getMax(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(8,rownum,data.getMinjt(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(9,rownum,data.getAvgjt(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(10,rownum,data.getMinjt(),numf);
                sheet.addCell(nc);

                nc = new jxl.write.Number(11,rownum,data.getAvgloss(),numf);
                sheet.addCell(nc);
                //nc = new jxl.write.Number(9,rownum,data.getAvail(),numf);
                //sheet.addCell(nc);
                nc = new jxl.write.Number(12,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,12,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,12,rownum);

        return wwb;
    }

    private WritableWorkbook makeOnlineUserExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        /*ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,10);
        sheet.setColumnView(7,10);
        sheet.setColumnView(8,10);
        sheet.setColumnView(9,10);
        //sheet.setColumnView(10,10);

        int rownum = sheet.getRows();

        //标题
        String title = form.getAlias()+" " +ResourceApp.getString(request.getLocale(),"onlineuser") +ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"branch")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"device")+
                ResourceApp.getString(locale,"alias"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,"IP"+ResourceApp.getString(locale,"address"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"manufacturer"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"user")+
                ResourceApp.getString(locale,"number"),format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"user")+
                ResourceApp.getString(locale,"number"),format);
        sheet.addCell(label);
        label = new Label(8,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"user")+
                ResourceApp.getString(locale,"number"),format);
        sheet.addCell(label);
        //label = new Label(9,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        //sheet.addCell(label);
        label = new Label(9,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            OnlineUserDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (OnlineUserDataModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                label = new Label(1,rownum,data.getGroupname(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getObjalias(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getIpaddress(),format);
                sheet.addCell(label);
                label = new Label(4,rownum,data.getManufactrname(),format);
                sheet.addCell(label);
                label = new Label(5,rownum,data.getPrdtname(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(6,rownum,data.getMin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(7,rownum,data.getAvg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(8,rownum,data.getMax(),numf);
                sheet.addCell(nc);
                //nc = new jxl.write.Number(9,rownum,data.getAvail(),numf);
                //sheet.addCell(nc);
                nc = new jxl.write.Number(9,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);

        return wwb;*/
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        /*sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);*/
        sheet.setColumnView(1,10);
        sheet.setColumnView(2,10);
        sheet.setColumnView(3,10);
        sheet.setColumnView(4,10);
        //sheet.setColumnView(10,10);

        int rownum = sheet.getRows();

        //标题
        String title = form.getAlias()+" " +ResourceApp.getString(request.getLocale(),"onlineuser") +ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
//        label = new Label(1,rownum,ResourceApp.getString(locale,"branch")+
//                ResourceApp.getString(locale,"name"),format);
//        sheet.addCell(label);
//        label = new Label(2,rownum,ResourceApp.getString(locale,"device")+
//                ResourceApp.getString(locale,"alias"),format);
//        sheet.addCell(label);
//        label = new Label(3,rownum,"IP"+ResourceApp.getString(locale,"address"),format);
//        sheet.addCell(label);
//        label = new Label(4,rownum,ResourceApp.getString(locale,"manufacturer"),format);
//        sheet.addCell(label);
//        label = new Label(5,rownum,ResourceApp.getString(locale,"product")+
//                ResourceApp.getString(locale,"name"),format);
//        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"user")+
                ResourceApp.getString(locale,"number"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"user")+
                ResourceApp.getString(locale,"number"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"user")+
                ResourceApp.getString(locale,"number"),format);
        sheet.addCell(label);
        //label = new Label(9,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        //sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            OnlineUserDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (OnlineUserDataModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                /*label = new Label(1,rownum,data.getGroupname(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getObjalias(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getIpaddress(),format);
                sheet.addCell(label);
                label = new Label(4,rownum,data.getManufactrname(),format);
                sheet.addCell(label);
                label = new Label(5,rownum,data.getPrdtname(),format);
                sheet.addCell(label);*/
                nc = new jxl.write.Number(1,rownum,data.getMin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getAvg(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getMax(),numf);
                sheet.addCell(nc);
                //nc = new jxl.write.Number(9,rownum,data.getAvail(),numf);
                //sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        return wwb;
    }

    private WritableWorkbook makeIPPoolExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        /*ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        sheet.setColumnView(7,10);
        sheet.setColumnView(8,10);
        sheet.setColumnView(9,10);
        sheet.setColumnView(10,10);
        sheet.setColumnView(11,10);

        int rownum = sheet.getRows();

        //标题
        String title = form.getAlias() +" IP" +ResourceApp.getString(request.getLocale(),"pool") +ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,11,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,11,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"branch")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"device")+
                ResourceApp.getString(locale,"alias"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,"IP"+ResourceApp.getString(locale,"address"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"manufacturer"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"type"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"use.ok")+
                "IP"+
                ResourceApp.getString(locale,"number"),format);
        sheet.addCell(label);
        label = new Label(8,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"use")+
                ResourceApp.getString(locale,"rate"),format);
        sheet.addCell(label);
        label = new Label(9,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"use")+
                ResourceApp.getString(locale,"rate"),format);
        sheet.addCell(label);
        label = new Label(10,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"use")+
                ResourceApp.getString(locale,"rate"),format);
        sheet.addCell(label);
        label = new Label(11,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            IPPoolDataModal data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (IPPoolDataModal) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                label = new Label(1,rownum,data.getGroupname(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getObjalias(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getIpaddress(),format);
                sheet.addCell(label);
                label = new Label(4,rownum,data.getManufactrname(),format);
                sheet.addCell(label);
                label = new Label(5,rownum,data.getPrddesc(),format);
                sheet.addCell(label);
                label = new Label(6,rownum,data.getPrdtname(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(7,rownum,data.getIpnum(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(8,rownum,data.getMinusenum(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(9,rownum,data.getAvgusenum(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(10,rownum,data.getMaxusenum(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(11,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,11,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,11,rownum);

        return wwb;*/
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        /*sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);*/
        sheet.setColumnView(1,10);
        sheet.setColumnView(2,10);
        sheet.setColumnView(3,10);
        sheet.setColumnView(4,10);
        sheet.setColumnView(5,10);

        int rownum = sheet.getRows();

        //标题
        String title = form.getAlias() +" IP" +ResourceApp.getString(request.getLocale(),"pool") +ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,5,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,5,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        /*label = new Label(1,rownum,ResourceApp.getString(locale,"branch")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"device")+
                ResourceApp.getString(locale,"alias"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,"IP"+ResourceApp.getString(locale,"address"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"manufacturer"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"type"),format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"product")+
                ResourceApp.getString(locale,"name"),format);
        sheet.addCell(label);*/
        label = new Label(1,rownum,ResourceApp.getString(locale,"use.ok")+
                "IP"+
                ResourceApp.getString(locale,"number"),format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"use")+
                ResourceApp.getString(locale,"rate"),format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"use")+
                ResourceApp.getString(locale,"rate"),format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"use")+
                ResourceApp.getString(locale,"rate"),format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            IPPoolDataModal data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (IPPoolDataModal) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                /*label = new Label(1,rownum,data.getGroupname(),format);
                sheet.addCell(label);
                label = new Label(2,rownum,data.getObjalias(),format);
                sheet.addCell(label);
                label = new Label(3,rownum,data.getIpaddress(),format);
                sheet.addCell(label);
                label = new Label(4,rownum,data.getManufactrname(),format);
                sheet.addCell(label);
                label = new Label(5,rownum,data.getPrddesc(),format);
                sheet.addCell(label);
                label = new Label(6,rownum,data.getPrdtname(),format);
                sheet.addCell(label);*/
                nc = new jxl.write.Number(1,rownum,data.getIpnum(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getMinusenum(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getAvgusenum(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getMaxusenum(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(5,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,5,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,5,rownum);

        return wwb;
    }

    private WritableWorkbook makePortLinkExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,10);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        sheet.setColumnView(7,15);
        sheet.setColumnView(8,10);
        sheet.setColumnView(9,10);
        //sheet.setColumnView(10,10);

        int rownum = sheet.getRows();

        String mt = StringUtil.fill_null(form.getMenutype());
        String temp ="";
        if(mt.equals("5")){
            temp = ResourceApp.getString(request.getLocale(),"port")+"流量";;
        }else if(mt.equals("6")){
            temp = ResourceApp.getString(request.getLocale(),"link");
        }

        //标题
        String title = form.getCardname()+" "+temp+ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"usable")+"(%)",format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(8,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"usable")+"(%)",format);
        sheet.addCell(label);
        //-----
        String fstr = "";
        String tstr = ResourceApp.getString(request.getLocale(),"packet")+"(K "+
        ResourceApp.getString(request.getLocale(),"unit")+")";

        label = new Label(9,rownum,fstr+ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"min")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(10,rownum,fstr+ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"avg")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(11,rownum,fstr+ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"max")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(12,rownum,fstr+ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"min")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(13,rownum,fstr+ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"avg")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(14,rownum,fstr+ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"max")+
                tstr,format);
        sheet.addCell(label);

        //-------------------------------------------------------
        temp = ResourceApp.getString(request.getLocale(),"drop.package");
        tstr = ResourceApp.getString(request.getLocale(),"drop.package")+"("+
        ResourceApp.getString(request.getLocale(),"unit")+")";
        label = new Label(15,rownum,fstr+ResourceApp.getString(locale,"in")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(16,rownum,fstr+ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"min")+
                tstr,format);
        sheet.addCell(label);
        temp = ResourceApp.getString(request.getLocale(),"abandon.package");
        tstr = ResourceApp.getString(request.getLocale(),"abandon.package")+"("+
        ResourceApp.getString(request.getLocale(),"unit")+")";
        label = new Label(17,rownum,fstr+ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"avg")+
                tstr,format);
        sheet.addCell(label);
        label = new Label(18,rownum,fstr+ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"max")+
                tstr,format);
        sheet.addCell(label);

        /*label = new Label(8,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"usable")+"(%)",format);
        sheet.addCell(label);*/
        //label = new Label(9,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        //sheet.addCell(label);
        //label = new Label(9,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        //sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            PortLinkDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (PortLinkDataModel) l.get(i);
                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(1,rownum,data.getTminin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getTavgin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getTmaxin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getTavginutil(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(5,rownum,data.getTminout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(6,rownum,data.getTavgout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(7,rownum,data.getTmaxout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(8,rownum,data.getTavgoututil(),numf);
                sheet.addCell(nc);
                //--------------------------------------------------------
                nc = new jxl.write.Number(9,rownum,data.getPminin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(10,rownum,data.getPavgin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(11,rownum,data.getPmaxin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(12,rownum,data.getTminout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(13,rownum,data.getTavgout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(14,rownum,data.getTmaxout(),numf);
                sheet.addCell(nc);
                //------------------------------------------------------------------
                nc = new jxl.write.Number(15,rownum,data.getDsumin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(16,rownum,data.getDsumout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(17,rownum,data.getEsumin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(18,rownum,data.getEsumout(),numf);
                sheet.addCell(nc);

            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);

        return wwb;
    }
    //光功导出
    private WritableWorkbook makePortLaserExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,20);
        sheet.setColumnView(1,20);
        sheet.setColumnView(2,20);
        sheet.setColumnView(3,20);
        sheet.setColumnView(4,20);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        sheet.setColumnView(7,15);
        sheet.setColumnView(8,10);
        sheet.setColumnView(9,10);
        //sheet.setColumnView(10,10);

        int rownum = sheet.getRows();

        String mt = StringUtil.fill_null(form.getMenutype());
        String temp ="";
        if(mt.equals("5")){
            temp = ResourceApp.getString(request.getLocale(),"port")+"光功率";
        }else if(mt.equals("6")){
            temp = ResourceApp.getString(request.getLocale(),"link");
        }

        //标题
        String title = form.getCardname()+" "+temp+ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,6,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,"接受光功率(dBM)",format);
        sheet.addCell(label);
        label = new Label(2,rownum,"发送光功率(dBM)",format);
        sheet.addCell(label);
//        label = new Label(3,rownum,"综合光功率(dBM)",format);
//        sheet.addCell(label);
//        label = new Label(3,rownum,"温度(℃)",format);
//        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            PortLinkDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (PortLinkDataModel) l.get(i);
                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(1,rownum,data.getRxpower(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getTxpower(),numf);
                sheet.addCell(nc);
//                nc = new jxl.write.Number(3,rownum,data.getCurrent(),numf);
//                sheet.addCell(nc);
//                nc = new jxl.write.Number(4,rownum,data.getTemperature(),numf);
//                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,9,rownum);

        return wwb;
    }

    private WritableWorkbook makePortLinkGroupExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,20);
        sheet.setColumnView(2,20);
        sheet.setColumnView(3,20);
        sheet.setColumnView(4,20);

        int rownum = sheet.getRows();

        String mt = StringUtil.fill_null(form.getMenutype());
        String temp ="";
        if(mt.equals("1")){
            temp = ResourceOther.getString(request.getLocale(),"ifgroup.title");
        }else if(mt.equals("2")){
            temp = ResourceOther.getString(request.getLocale(),"linkgroup.title");
        }

        //标题
        String title = form.getCardname()+" "+temp+ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,
                ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"in.flow")+"(Mbit)",format);
        sheet.addCell(label);
        label = new Label(2,rownum,
                ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"out.flow")+"(Mbit)",format);
        sheet.addCell(label);
        label = new Label(3,rownum,
                ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"in.flow")+"(Mbit)",format);
        sheet.addCell(label);
        label = new Label(4,rownum,
                ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"out.flow")+"(Mbit)",format);
        sheet.addCell(label);


        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            PortLinkDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (PortLinkDataModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(1,rownum,data.getTavgin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getTavgout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getTmaxin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getTmaxout(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        return wwb;
    }

    private WritableWorkbook makeCUPMEMExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        ObjCapabilityForm form = (ObjCapabilityForm) request.getAttribute("objCapabilityForm");
        Locale locale = request.getLocale();

        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);

        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,10);
        sheet.setColumnView(2,10);
        sheet.setColumnView(3,10);
        sheet.setColumnView(4,10);
        //sheet.setColumnView(5,15);

        int rownum = sheet.getRows();

        //标题
        String temp ="";
        String mt = StringUtil.fill_null(form.getMenutype());
        if(mt.equals("1")){
            temp = form.getCardname()+" "+ResourceApp.getString(request.getLocale(),"cpu");
        }else if(mt.equals("2")){
            temp = form.getCardname()+" "+ResourceApp.getString(request.getLocale(),"mem");
        }else if(mt.equals("7")){
            temp = form.getAlias()+" "+ResourceApp.getString(request.getLocale(),"access")+ResourceApp.getString(request.getLocale(),"rate");
        }
        String title = temp+ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);

        //生成时间
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);

        if(mt.equals("7")){
            temp = ResourceApp.getString(locale,"access")+
                    ResourceApp.getString(locale,"success")+
                    ResourceApp.getString(locale,"rate");
        }else{
            temp = ResourceApp.getString(locale,"usable");
        }

        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"min")+
                temp+"(%)",format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"avg")+
                temp+"(%)",format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"max")+
                temp+"(%)",format);
        sheet.addCell(label);
        //label = new Label(4,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        //sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);

        //数据
        List l = form.getDatas();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);

            Number nc = null;
            CPUMEMDataModel data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (CPUMEMDataModel) l.get(i);

                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(1,rownum,data.getMinutil(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getAvgutil(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getMaxutil(),numf);
                sheet.addCell(nc);
                //nc = new jxl.write.Number(4,rownum,data.getAvail(),numf);
                //sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);
        //条件
        String condate = form.getDaterang();
        rownum = sheet.getRows();
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,4,rownum);

        return wwb;
    }
    private WritableWorkbook makeCUPExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        WatchNodeQueryForm form = (WatchNodeQueryForm) request.getAttribute("watchNodeQueryForm");
        Locale locale = request.getLocale();
        
        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);    
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);
                
        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        
        int rownum = sheet.getRows();    
        
        //标题
        String temp ="";
        if(form.getUtiltype().equals("1")){
            temp = ResourceApp.getString(request.getLocale(),"cpu");
        }else if(form.getUtiltype().equals("2")){
            temp = ResourceApp.getString(request.getLocale(),"mem");
        }
        String title = form.getDname()+" "+temp+ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,3,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);
        
        //生成时间  
        rownum = sheet.getRows();    
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,3,rownum);
        
        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);
        
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"usable")+"(%)",format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"usable")+"(%)",format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"usable")+"(%)",format);
        sheet.addCell(label);
        
        
        //数据        
        List l = form.getShowData();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);
            
            Number nc = null;
            WatchDataCPUMEM data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (WatchDataCPUMEM) l.get(i);
                
                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(1,rownum,data.getMinutil(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getAvgutil(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getMaxutil(),numf);
                sheet.addCell(nc);                
            }
        }
        //空行
        rownum = sheet.getRows();        
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,3,rownum);
        //条件    
        String condate = form.getDaterang();
        rownum = sheet.getRows();            
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);    
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,3,rownum);    
        
        // 写入Exel工作表
        wwb.write();
        // 关闭Excel工作薄对象
        wwb.close();
        return wwb;
    }

    private WritableWorkbook makeLinkExcel(WritableWorkbook wwb)throws Exception {
        // TODO Auto-generated method stub
        WatchLinkQueryForm form = (WatchLinkQueryForm) request.getAttribute("watchLinkQueryForm");
        Locale locale = request.getLocale();
        
        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);    
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);
                
        //设置列宽
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,10);
        sheet.setColumnView(5,15);
        sheet.setColumnView(6,15);
        sheet.setColumnView(7,15);
        sheet.setColumnView(8,10);
        sheet.setColumnView(9,10);
        sheet.setColumnView(10,10);
        
        int rownum = sheet.getRows();    
        
        //标题
        String title = form.getLinkname()+ResourceApp.getString(request.getLocale(),"capability")+
                ResourceApp.getString(request.getLocale(),"history")+
                ResourceApp.getString(request.getLocale(),"analyze");
        Label label=new Label(0,rownum,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,10,rownum);
        //设置第一行行高
        sheet.setRowView(rownum,400);
        
        //生成时间  
        rownum = sheet.getRows();    
        label = new Label(0,rownum,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,10,rownum);
        
        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        format = new WritableCellFormat(font);
        format.setBackground(Colour.DARK_BLUE);
        format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        format.setAlignment(Alignment.CENTRE);
        format.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        format.setWrap(true);
        
        rownum = sheet.getRows();
        label = new Label(0,rownum,ResourceApp.getString(locale,"date"),format);
        sheet.addCell(label);
        label = new Label(1,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(2,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(3,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(4,rownum,ResourceApp.getString(locale,"in")+
                ResourceApp.getString(locale,"usable")+"(%)",format);
        sheet.addCell(label);
        label = new Label(5,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"min")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(6,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"avg")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(7,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"max")+
                ResourceApp.getString(locale,"speedrate")+"(Mbit/s)",format);
        sheet.addCell(label);
        label = new Label(8,rownum,ResourceApp.getString(locale,"out")+
                ResourceApp.getString(locale,"usable")+"(%)",format);
        sheet.addCell(label);
        label = new Label(9,rownum,ResourceApp.getString(locale,"avail")+"(%)",format);
        sheet.addCell(label);
        label = new Label(10,rownum,ResourceApp.getString(locale,"eligible")+"(%)",format);
        sheet.addCell(label);
        
        //数据        
        List l = form.getShowData();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            format = new WritableCellFormat(font);
            format.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            format.setAlignment(Alignment.CENTRE);
            WritableCellFormat numf = new WritableCellFormat(font);
            numf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            numf.setAlignment(Alignment.RIGHT);
            
            Number nc = null;
            WatchDataLink data = null;
            for(int i=0;i<l.size();i++){
                rownum = sheet.getRows();
                data = (WatchDataLink) l.get(i);
                
                label = new Label(0,rownum,data.getDatestr(),format);
                sheet.addCell(label);
                nc = new jxl.write.Number(1,rownum,data.getMinin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(2,rownum,data.getAvgin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,rownum,data.getMaxin(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(4,rownum,data.getAvginutil(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(5,rownum,data.getMinout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(6,rownum,data.getAvgout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(7,rownum,data.getMaxout(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(8,rownum,data.getAvgoututil(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(9,rownum,data.getAvail(),numf);
                sheet.addCell(nc);
                nc = new jxl.write.Number(10,rownum,data.getEligible(),numf);
                sheet.addCell(nc);
            }
        }
        //空行
        rownum = sheet.getRows();        
        label = new Label(0,rownum,"");
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,10,rownum);
        //条件    
        String condate = form.getDaterang();
        rownum = sheet.getRows();            
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label = new Label(0,rownum,ResourceApp.getString(locale,"query.range")+":"+condate,format);    
        sheet.addCell(label);
        sheet.mergeCells(0,rownum,10,rownum);    
        
        // 写入Exel工作表
        wwb.write();
        // 关闭Excel工作薄对象
        wwb.close();
        return wwb;
    }

    private WritableWorkbook makeUsefulRateExcel(WritableWorkbook wwb)throws Exception{
        WatchQualityForm form = (WatchQualityForm) request.getAttribute("watchQualityForm");    
        Locale locale = request.getLocale();
        
        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);    
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);
        
        String title = form.getName()+ResourceApp.getString(request.getLocale(),"usefulrate")+
            ResourceApp.getString(request.getLocale(),"dalay")+
            ResourceApp.getString(request.getLocale(),"history")+
            ResourceApp.getString(request.getLocale(),"analyze");
        //标题
        Label label=new Label(0,0,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,0,4,0);
        //设置第一行行高
        sheet.setRowView(0,400);
        //将第一列的宽度设为30
        //sheet.setColumnView(0,30);
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        sheet.setColumnView(3,15);
        sheet.setColumnView(4,15);
        
        //生成时间  
        label = new Label(0,1,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,1,4,1);
        
        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        WritableCellFormat colhead = new WritableCellFormat(font);
        colhead.setBackground(Colour.DARK_BLUE);
        colhead.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        colhead.setAlignment(Alignment.CENTRE);
        colhead.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
                
        label = new Label(0,2,ResourceApp.getString(locale,"watchnode.s"),colhead);
        sheet.addCell(label);
        label = new Label(1,2,ResourceApp.getString(locale,"watchnode.d"),colhead);
        sheet.addCell(label);
        label = new Label(2,2,ResourceApp.getString(locale,"use.ok")+"(%)",colhead);
        sheet.addCell(label);
        label = new Label(3,2,ResourceApp.getString(locale,"use.so")+"(%)",colhead);
        sheet.addCell(label);
        label = new Label(4,2,ResourceApp.getString(locale,"use.fail")+"(%)",colhead);
        sheet.addCell(label);
        
        //数据        
        List l = form.getShowData();
        if(l!=null&& l.size()>0){
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
            WritableCellFormat dataf = new WritableCellFormat(font);
            dataf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            dataf.setAlignment(Alignment.LEFT);
            WritableCellFormat datax = new WritableCellFormat(font);
            datax.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
            datax.setAlignment(Alignment.RIGHT);
            
            UsefulrateBean bean = null;
            Number nc = null;
            for(int i=0;i<l.size();i++){
                bean = (UsefulrateBean) l.get(i);
                label = new Label(0,3+i,bean.getSname(),dataf);
                sheet.addCell(label);
                label = new Label(1,3+i,bean.getDname(),dataf);
                sheet.addCell(label);
                nc = new jxl.write.Number(2,3+i,bean.getMini());
                nc.setCellFormat(datax);    
                sheet.addCell(nc);
                nc = new jxl.write.Number(3,3+i,bean.getAvgi());
                nc.setCellFormat(datax);    
                sheet.addCell(nc);
                nc = new jxl.write.Number(4,3+i,bean.getMaxi());
                nc.setCellFormat(datax);    
                sheet.addCell(nc);
            }
        }
            
        //空行
        int ccl = sheet.getRows();        
        label = new Label(0,ccl,"");
        sheet.addCell(label);
        sheet.mergeCells(0,ccl,4,ccl);
        //条件        
        String condate = JexcelAPIUtils.getDateRange(form.getDatestart(),form.getHourstart(),form.getMinutestart(),form.getDateend(),form.getHourend(),form.getMinuteend());
        if(StringUtil.isNull(condate)){
            condate = form.getQuerytime();
        }
        ccl = sheet.getRows();
        label = new Label(0,ccl,ResourceApp.getString(locale,"query.range")+":"+condate);        
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,ccl,4,ccl);    
        
        // 写入Exel工作表
        wwb.write();
        // 关闭Excel工作薄对象
        wwb.close();
        return wwb;
    }

    private WritableWorkbook makePathExcel(WritableWorkbook wwb) throws Exception{
        // TODO Auto-generated method stub
        WatchPathDataForm form = (WatchPathDataForm) request.getAttribute("watchPathDataForm");    
        Locale locale = request.getLocale();
        
        String lens = form.getMax();
        int len = Integer.parseInt(lens);
        int totalcol = 2;
        if(len>0){
            totalcol = 2+(len-1)*2;
        }
        String title = form.getName()+ResourceApp.getString(request.getLocale(),"report.path.delay");        
        
        WritableFont font=    new WritableFont(WritableFont.ARIAL,17,WritableFont.BOLD);
        WritableCellFormat format = new WritableCellFormat(font);
        format.setAlignment(Alignment.CENTRE);
        
        //format1.setAlignment(jxl.format.Alignment.CENTRE);
        //format1.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
        
        jxl.write.WritableSheet sheet = wwb.createSheet("Sheet1", 0);    
        
        //标题
        Label label=new Label(0,0,title,format);
        sheet.addCell(label);
        sheet.mergeCells(0,0,totalcol,0);
        //设置第一行行高
        sheet.setRowView(0,400);
        //将第一列的宽度设为30
        //sheet.setColumnView(0,30);
        sheet.setColumnView(0,15);
        sheet.setColumnView(1,15);
        sheet.setColumnView(2,15);
        
        //生成时间  
        label = new Label(0,1,ResourceApp.getString(locale,"make.date")+":" + form.getQuerytime());
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.RIGHT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,1,totalcol,1);
        
        //生成列头
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        font.setColour(Colour.WHITE);
        WritableCellFormat colhead = new WritableCellFormat(font);
        colhead.setBackground(Colour.DARK_BLUE);
        colhead.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        colhead.setAlignment(Alignment.CENTRE);
        colhead.setVerticalAlignment(jxl.format.VerticalAlignment.CENTRE);
                
        label = new Label(0,2,ResourceApp.getString(locale,"watch.time"),colhead);
        sheet.addCell(label);
        label = new Label(1,2,ResourceApp.getString(locale,"watchnode.s"),colhead);
        sheet.addCell(label);
        label = new Label(2,2,ResourceApp.getString(locale,"watchnode.d"),colhead);
        sheet.addCell(label);
        
        int col = 2;
        for(int i=1;i<len;i++){
            col++;
            label = new Label(col,2,i+ResourceApp.getString(locale,"hop"),colhead);
            sheet.addCell(label);
            sheet.setColumnView(col,15);
            col++;
            label = new Label(col,2,ResourceApp.getString(locale,"dalay"),colhead);
            sheet.addCell(label);
            sheet.setColumnView(col,5);
        }        
        sheet.setRowView(2,350);
        
        
        //数据
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.NO_BOLD);
        WritableCellFormat dataf = new WritableCellFormat(font);
        dataf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        
        WritableCellFormat datax = new WritableCellFormat(font);
        datax.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        datax.setAlignment(Alignment.RIGHT);
        
        SaaConfDelay color = form.getColors();
        int max =0 ,min =0,middle=0;
        if(color!=null){
            max = (int) color.getMaxdelay();
            min = (int) color.getMindelay();
            middle = (int) color.getDelay();
        }
        
        WritableCellFormat maxf = new WritableCellFormat();
        maxf.setBackground(Colour.RED);
        maxf.setAlignment(Alignment.RIGHT);
        maxf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        WritableCellFormat middlef = new WritableCellFormat();
        middlef.setBackground(Colour.YELLOW);
        middlef.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        middlef.setAlignment(Alignment.RIGHT);
        WritableCellFormat minf = new WritableCellFormat();
        minf.setBackground(Colour.BRIGHT_GREEN);
        minf.setBorder(Border.ALL,BorderLineStyle.THIN,Colour.BLACK);
        minf.setAlignment(Alignment.RIGHT);
        
        List l = form.getShowData();//
        if(l!=null && l.size()>0){
            int rowlen = l.size();
            int nowrow = 2;
            
            Number nc = null;    
            
            SaaDataPathecho temp =null;
            String temps = "";
            int tempi = 0;
            for(int i=0;i<rowlen;i++){
                nowrow++;            
                col = 2;
                temp = (SaaDataPathecho) l.get(i);
                label = new Label(0,nowrow,temp.getTime(),dataf);
                sheet.addCell(label);
                label = new Label(1,nowrow,StringUtil.fill_null(((SaaConfDev)temp.getConfdev()).getFrominterface().getDevice().getAlias()),dataf);
                sheet.addCell(label);
                label = new Label(2,nowrow,StringUtil.fill_null(((SaaConfDev)temp.getConfdev()).getTointerface().getDevice().getAlias()),dataf);
                sheet.addCell(label);                
                
                for(int j=1;j<len;j++){                                
                    
                    label = new Label(++col,nowrow,StringUtil.fill_null(BeanUtils.getProperty(temp,"p"+j)),dataf);
                    sheet.addCell(label);
                    
                    
                    //jxl.write.Number labelN = new jxl.write.Number(0, 1, 3.1415926);
                    //sheet.addCell(labelN);    
                    
                    temps = StringUtil.fill_null(BeanUtils.getProperty(temp,"d"+j));
                    
                    
                    temps = temps.equals("0")?"*":temps;
                    //label = new Label(++col,nowrow,temps,dataf);
                                        
                    if(color!=null && !StringUtil.isNull(temps)){                            

                        if(!temps.equals("*")){
                            nc = new jxl.write.Number(++col,nowrow,Double.parseDouble(temps));
                            tempi = Integer.parseInt(temps);
                            
                            if(tempi<middle){
                                //label.setCellFormat(minf);
                                nc.setCellFormat(minf);                                
                            }else if(tempi>=middle && tempi<max){
                                //label.setCellFormat(middlef);
                                nc.setCellFormat(middlef);                                
                            }else if(tempi>=max){
                                //label.setCellFormat(maxf);
                                nc.setCellFormat(maxf);
                            }
                            sheet.addCell(nc);
                            //sheet.addCell(label);    
                        }else{
                            label = new Label(++col,nowrow,temps);
                            label.setCellFormat(maxf);
                            sheet.addCell(label);
                        }
                    }else{
                        label = new Label(++col,nowrow,temps,datax);
                        sheet.addCell(label);    
                    }
                    //sheet.addCell(label);                    
                }                                
            }                
        }    
        int ccl = sheet.getRows();
        
        label = new Label(0,ccl,"");
        sheet.addCell(label);
        sheet.mergeCells(0,ccl,totalcol,ccl);
        
        //指标颜色
        if(color!=null){
            ccl = sheet.getRows();
            font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
            //font.setColour(Colour.RED);
            WritableCellFormat lin = new WritableCellFormat(font);        
                    
            String temp = ResourceApp.getString(request.getLocale(),"dalay")+
                    ResourceApp.getString(request.getLocale(),"line")+"("+
                    ResourceApp.getString(request.getLocale(),"unit.millisecond")+"):";
            String delay = ResourceApp.getString(request.getLocale(),"dalay");        
            
            
            label = new Label(0,ccl,temp,lin);
            sheet.addCell(label);
            
            label = new Label(1,ccl,"0<"+delay+"<="+middle,minf);
            sheet.addCell(label);
            label = new Label(2,ccl,middle+"<"+delay+"<="+max,middlef);
            sheet.addCell(label);
            label = new Label(3,ccl,max+"<"+delay,maxf);
            sheet.addCell(label);        
            label = new Label(4,ccl,"*="+ResourceApp.getString(request.getLocale(),"timeo"),dataf);
            sheet.addCell(label);
            //sheet.mergeCells(0,ccl,1,ccl);
            //label = new Label(1,ccl,"0=■   0<■<=50   50<■<=80   80<■ ");
        }
                
        //条件        
        String condate = JexcelAPIUtils.getDateRange(form.getDatestart(),form.getHourstart(),form.getMinutestart(),form.getDateend(),form.getHourend(),form.getMinuteend());
        if(StringUtil.isNull(condate)){
            condate = form.getQuerytime();
        }
        ccl = sheet.getRows();
        label = new Label(0,ccl,ResourceApp.getString(locale,"query.range")+":"+condate);        
        font = new WritableFont(WritableFont.ARIAL,9,WritableFont.BOLD);
        format = new WritableCellFormat(font);
        format.setFont(font);
        format.setAlignment(Alignment.LEFT);
        label.setCellFormat(format);
        sheet.addCell(label);
        sheet.mergeCells(0,ccl,totalcol,ccl);        

        
        // 写入Exel工作表
        wwb.write();
        // 关闭Excel工作薄对象
        wwb.close();
        return wwb;
    }
    public static String getDateRange(String dates,String hours,String minutes,String datee,String houre,String minutee)throws Exception{
        if(StringUtil.isNull(dates)||StringUtil.isNull(hours)||StringUtil.isNull(minutes)||StringUtil.isNull(datee)||StringUtil.isNull(houre)||StringUtil.isNull(minutee)){
            return "";
        }
        String ss = "", se = "";
        Date ds = null, de = null,tempd = null;
        Calendar cals = null,cale = null;        
        
        SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm");
        ss = dates+" "+hours+":"+minutes;
        se = datee+" "+houre+":"+minutee;
        ds = formatter.parse(ss);
        de = formatter.parse(se);
        if(ds.after(de)){
            tempd = de;
            de = ds;
            ds = tempd;
        }
        
        if(ds.equals(de)){
            return formatter.format(de);
        }
        
        return formatter.format(ds)+"-"+formatter.format(de);
    }


}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
众所周知,人工智能是当前最热门的话题之一, 计算机技术与互联网技术的快速发展更是将对人工智能的研究推向一个新的高潮。 人工智能是研究模拟和扩展人类智能的理论与方法及其应用的一门新兴技术科学。 作为人工智能核心研究领域之一的机器学习, 其研究动机是为了使计算机系统具有人的学习能力以实现人工智能。 那么, 什么是机器学习呢? 机器学习 (Machine Learning) 是对研究问题进行模型假设,利用计算机从训练数据中学习得到模型参数,并最终对数据进行预测和分析的一门学科。 机器学习的用途 机器学习是一种通用的数据处理技术,其包含了大量的学习算法。不同的学习算法在不同的行业及应用中能够表现出不同的性能和优势。目前,机器学习已成功地应用于下列领域: 互联网领域----语音识别、搜索引擎、语言翻译、垃圾邮件过滤、自然语言处理等 生物领域----基因序列分析、DNA 序列预测、蛋白质结构预测等 自动化领域----人脸识别、无人驾驶技术、图像处理、信号处理等 金融领域----证券市场分析、信用卡欺诈检测等 医学领域----疾病鉴别/诊断、流行病爆发预测等 刑侦领域----潜在犯罪识别与预测、模拟人工智能侦探等 新闻领域----新闻推荐系统等 游戏领域----游戏战略规划等 从上述所列举的应用可知,机器学习正在成为各行各业都会经常使用到的分析工具,尤其是在各领域数据量爆炸的今天,各行业都希望通过数据处理与分析手段,得到数据中有价值的信息,以便明确客户的需求和指引企业的发展。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值