Example usage for com.lowagie.text Font NORMAL

List of usage examples for com.lowagie.text Font NORMAL

Introduction

In this page you can find the example usage for com.lowagie.text Font NORMAL.

Prototype

int NORMAL

To view the source code for com.lowagie.text Font NORMAL.

Click Source Link

Document

this is a possible style.

Usage

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_serviceworkchoce(String starttime, String totime, String file, String username,
        String positionname) throws DocumentException, IOException {
    Hashtable allreporthash = new Hashtable();
    allreporthash = reportHash;/*from  w  w  w  .  ja  va2 s  . c  om*/
    /*
     * String starttime = (String) reportHash.get("starttime"); String
     * totime = (String) reportHash.get("totime");
     */

    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    RtfWriter2.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont1 = new Font(bfChinese, 14, Font.BOLD);
    Font titleFont = new Font(bfChinese, 14, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 14, Font.NORMAL);
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    try {
        fileName = ResourceCenter.getInstance().getSysPath() + file;
        Table aTable = new Table(13);
        float[] widths = { 40f, 100f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f, 40f };
        aTable.setWidths(widths);
        aTable.setWidth(100); //  90%
        aTable.setAlignment(Element.ALIGN_CENTER);// 
        aTable.setAutoFillEmptyCells(true); // 
        aTable.setBorderWidth(1); // 
        aTable.setBorderColor(new Color(0, 125, 255)); // 
        aTable.setPadding(2);// 
        aTable.setSpacing(0);// 
        aTable.setBorder(2);// 

        aTable.endHeaders();
        Cell cell = null;
        cell = new Cell(new Phrase("", titleFont1));
        cell.setColspan(13);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        // cell = new Cell("");
        cell = new Cell(new Phrase("" + starttime + "" + totime, contextFont));
        cell.setColspan(12);
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase(username, contextFont));

        cell.setColspan(4);

        aTable.addCell(cell);
        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase(positionname, contextFont));
        cell.setColspan(5);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setColspan(11);
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setColspan(11);
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(13);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        int netsize = 0;
        Hashtable netreporthash = (Hashtable) allreporthash.get("netreporthash");
        if (netreporthash != null) {
            netsize = netreporthash.size();
        }
        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(3 + netsize);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("IP", titleFont));
        cell.setRowspan(3);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("CPU(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("KB/S", titleFont));
        cell.setColspan(4);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setRowspan(3);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        java.text.NumberFormat formatenet = java.text.NumberFormat.getNumberInstance();
        formatenet.setMaximumFractionDigits(0);//
        if (netreporthash != null && netreporthash.size() > 0) {
            Iterator keys = netreporthash.keySet().iterator();
            HostNode node = null;
            while (keys.hasNext()) {
                node = (HostNode) keys.next();
                Hashtable report_has = (Hashtable) netreporthash.get(node);
                String hostname = (String) report_has.get("equipname");
                // WritableSheet sheet = wb.createSheet(hostname+"",
                // sheetNum);

                Hashtable CPU = (Hashtable) report_has.get("CPU");
                String Ping = (String) report_has.get("Ping");
                String ip = (String) report_has.get("ip");
                Calendar colTime = Calendar.getInstance();
                Date cc = colTime.getTime();
                Vector netifVector = (Vector) report_has.get("netifVector");
                Hashtable portconfigHash = (Hashtable) report_has.get("portconfigHash");
                List reportports = (List) report_has.get("reportports");
                Vector iprouterVector = (Vector) report_has.get("iprouterVector");

                Hashtable memMaxHash = (Hashtable) report_has.get("memmaxhash");
                Hashtable maxping = (Hashtable) report_has.get("ping");

                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

                String[] netIfItemch = { "", "", "", "(M)", "", "",
                        "" };
                String[] ipRouterItemch = { "", "", "", "", "",
                        "" };
                String[] memoryItem = { "Capability", "Utilization" };
                String[] diskItem = { "AllSize", "UsedSize", "Utilization", "INodeUsedSize",
                        "INodeUtilization" };
                String[] diskItemch = { "", "", "", "i-node", "i-node" };
                String[] iproutertype = { "", "", "", "direct(3)", "indirect(4)" };
                String[] iprouterproto = { "", "other(1)", "local(2)", "netmgmt(3)", "icmp(4)", "egp(5)",
                        "ggp(6)", "hello(7)", "rip(8)", "is-is(9)", "es-is(10)", "ciscoIgrp(11)",
                        "bbnSpfIgp(12)", "ospf(13)", "bgp(14)" };
                String avginput = (String) report_has.get("avginput");
                String avgoutput = (String) report_has.get("avgoutput");
                String maxinput = (String) report_has.get("maxinput");
                String maxoutput = (String) report_has.get("maxoutput");

                String level4 = (String) report_has.get("level4");

                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                String string1 = ((String) maxping.get("pingmax")).replace("%", "");
                String string2 = ((String) maxping.get("avgpingcon")).replace("%", "");

                cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string2)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string1)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                String cpu = "";
                if (CPU.get("cpu") != null)
                    cpu = (String) CPU.get("cpu");
                String cpumax = "";
                if (CPU.get("cpumax") != null)
                    cpumax = (String) CPU.get("cpumax");
                String avgcpu = "";
                if (CPU.get("avgcpu") != null)
                    avgcpu = (String) CPU.get("avgcpu");
                String string3 = avgcpu.replace("%", "");
                String string4 = cpumax.replace("%", "");
                cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string3)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formatenet.format(Double.valueOf(string4)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                cell = new Cell("");
                aTable.addCell(cell);
                cell = new Cell("");
                aTable.addCell(cell);

                cell = new Cell(new Phrase(avgoutput.replace(".0", ""), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(maxoutput.replace(".0", ""), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(avginput.replace(".0", ""), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(maxinput.replace(".0", ""), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                cell = new Cell(new Phrase(level4, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
            }
        }

        // =====================================================================
        Hashtable hostreporthash = (Hashtable) allreporthash.get("hostreporthash");
        int hostsize = 0;
        if (hostreporthash != null) {
            hostsize = hostreporthash.size();
        }
        cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "", titleFont));
        cell.setRowspan(2 + hostsize);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("IP", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("CPU(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("KB/S", titleFont));
        cell.setColspan(4);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        java.text.NumberFormat formatehost = java.text.NumberFormat.getNumberInstance();
        formatehost.setMaximumFractionDigits(0);//
        if (hostreporthash != null && hostreporthash.size() > 0) {
            Iterator keys = hostreporthash.keySet().iterator();
            HostNode node = null;
            while (keys.hasNext()) {

                node = (HostNode) keys.next();
                // String newip = doip(ip);
                Hashtable report_has = (Hashtable) hostreporthash.get(node);
                String hostname = (String) report_has.get("equipname");
                Hashtable CPU = (Hashtable) report_has.get("CPU");
                String Ping = (String) report_has.get("Ping");
                Calendar colTime = (Calendar) report_has.get("time");
                Date cc = colTime.getTime();
                Hashtable Memory = (Hashtable) report_has.get("Memory");
                Hashtable Disk = (Hashtable) report_has.get("Disk");

                Hashtable memMaxHash = (Hashtable) report_has.get("memmaxhash");
                Hashtable memAvgHash = (Hashtable) report_has.get("memavghash");
                Hashtable maxping = (Hashtable) report_has.get("ping");
                String ip = (String) report_has.get("ip");
                SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

                String[] memoryItemch = { "", "", "", "" };
                String[] memoryItem = { "Capability", "c" };
                String[] diskItem = { "AllSize", "UsedSize", "Utilization", "Utilizationvalue" };
                String[] diskItemch = { "", "", "" };

                String level4 = (String) report_has.get("level4");
                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                // =======
                String string7 = ((String) maxping.get("pingmax")).replace("%", "");
                String string8 = ((String) maxping.get("avgpingcon")).replace("%", "");

                // formate.format(Double.valueOf(string1));
                // System.out.println(formate.format(Double.valueOf(string))+"@@@@@@@0000000000");
                cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string8)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string7)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                String cpu = "";
                if (CPU.get("cpu") != null)
                    cpu = (String) CPU.get("cpu");
                String cpumax = "";
                if (CPU.get("cpumax") != null)
                    cpumax = (String) CPU.get("cpumax");
                String avgcpu = "";
                if (CPU.get("avgcpu") != null)
                    avgcpu = (String) CPU.get("avgcpu");
                String string3 = avgcpu.replace("%", "");
                String string4 = cpumax.replace("%", "");

                cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string3)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string4)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                String avgvalue = "0.0%";
                if (memAvgHash.get("PhysicalMemory") != null) {

                    avgvalue = (String) memAvgHash.get("PhysicalMemory");
                    String string5 = avgvalue.replace("%", "");
                    cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string5)), contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                } else {
                    String string5 = avgvalue.replace("%", "");
                    cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string5)), contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }
                String value = "0.0%";
                if (memMaxHash.get("PhysicalMemory") != null) {

                    value = (String) memMaxHash.get("PhysicalMemory");
                    String string6 = value.replace("%", "");
                    cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string6)), contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                } else {
                    String string6 = value.replace("%", "");
                    cell = new Cell(new Phrase(formatehost.format(Double.valueOf(string6)), contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }
                String value1 = "0";
                String value2 = "100";
                String name = "";
                String name1 = "";
                String Utilization = "";
                String Utilization1 = "";
                if (Disk != null && Disk.size() > 0) {
                    for (int i = 0; i < Disk.size(); i++) {
                        Hashtable diskhash = (Hashtable) (Disk.get(new Integer(i)));
                        if (diskhash.get(diskItem[3]) != null) {
                            if (value1.compareTo((String) diskhash.get(diskItem[3])) < 0) {
                                value1 = (String) diskhash.get(diskItem[3]);
                                name = (String) diskhash.get("name");
                                Utilization = (String) diskhash.get(diskItem[2]);
                            }
                        }

                        if (diskhash.get(diskItem[3]) != null) {
                            if (value2.compareTo((String) diskhash.get(diskItem[3])) >= 0) {
                                value2 = (String) diskhash.get(diskItem[3]);
                                name1 = (String) diskhash.get("name");
                                Utilization1 = (String) diskhash.get(diskItem[2]);
                            }
                        }
                    }
                    cell = new Cell(name + "  " + Utilization);
                    cell.setColspan(2);
                    aTable.addCell(cell);

                    cell = new Cell(name1 + "  " + Utilization1);
                    cell.setColspan(2);
                    aTable.addCell(cell);
                } else {
                    cell = new Cell("---");
                    cell.setColspan(2);
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);

                    cell = new Cell("---");
                    cell.setColspan(2);
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }

                cell = new Cell(new Phrase(level4, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
            }
        }

        // ===========================================================================
        Hashtable dbreporthash = (Hashtable) allreporthash.get("dbreporthash");
        int dbsize = 0;
        if (dbreporthash != null) {
            dbsize = dbreporthash.size();
        }
        cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "", titleFont));
        cell.setRowspan(2 + dbsize);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("IP", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }
        java.text.NumberFormat formatedb = java.text.NumberFormat.getNumberInstance();
        formatedb.setMaximumFractionDigits(0);//
        if (dbreporthash != null && dbreporthash.size() > 0) {
            Iterator keys = dbreporthash.keySet().iterator();
            DBVo node = null;
            while (keys.hasNext()) {
                // String newip = doip(ip);
                node = (DBVo) keys.next();
                Hashtable report_has = (Hashtable) dbreporthash.get(node);
                Hashtable maxping = (Hashtable) report_has.get("maxping");
                String string1 = ((String) maxping.get("pingmax")).replace("%", "");
                String string2 = ((String) maxping.get("avgpingcon")).replace("%", "");
                String ip = (String) report_has.get("ip");
                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                String dbtype = (String) report_has.get("dbtype");
                cell = new Cell(new Phrase(dbtype, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                // =======
                cell = new Cell(new Phrase(formatedb.format(Double.valueOf(string2)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formatedb.format(Double.valueOf(string1)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                String maxspace = "";
                String minspace = "";
                if ((Integer) report_has.get("maxspace") != 0) {
                    maxspace = (Integer) report_has.get("maxspace") + "";

                }
                if ((Integer) report_has.get("mixspace") != 0) {
                    minspace = (Integer) report_has.get("mixspace") + "";

                }
                if (dbtype.equals("SQLServer") || dbtype.equals("Sybase") || dbtype.equals("Informix")) {
                    maxspace = "---";
                    minspace = "---";
                }
                cell = new Cell(new Phrase(maxspace, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                cell = new Cell(new Phrase(minspace, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                for (int i = 0; i < 6; i++) {
                    cell = new Cell(new Phrase("", contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }
            }

        }
        // ===================================================================

        Hashtable tomcatreporthash = (Hashtable) allreporthash.get("tomcatreporthash");
        Hashtable iisreporthash = (Hashtable) allreporthash.get("iisreporthash");
        Hashtable weblogicreporthash = (Hashtable) allreporthash.get("weblogicreporthash");
        int tomcatsize = 0;
        if (tomcatreporthash != null) {
            tomcatsize = tomcatreporthash.size();
        }
        int iissize = 0;
        if (iisreporthash != null) {
            iissize = iisreporthash.size();
        }
        int weblogicsize = 0;
        if (weblogicreporthash != null) {
            weblogicsize = weblogicreporthash.size();
        }
        cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "", titleFont));
        cell.setRowspan(2 + tomcatsize + iissize + weblogicsize);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("IP", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 8; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 8; i++) {
            cell = new Cell(new Phrase("", titleFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }

        // tomcat============================================================
        java.text.NumberFormat formatetomcat = java.text.NumberFormat.getNumberInstance();
        formatetomcat.setMaximumFractionDigits(0);//
        if (tomcatreporthash != null && tomcatreporthash.size() > 0) {
            Iterator keys = tomcatreporthash.keySet().iterator();
            Node node = null;
            while (keys.hasNext()) {

                node = (Node) keys.next();

                Hashtable report_has = (Hashtable) tomcatreporthash.get(node);
                Hashtable maxping = (Hashtable) report_has.get("maxping");
                String string1 = ((String) maxping.get("pingmax")).replace("%", "");
                String string2 = ((String) maxping.get("avgpingcon")).replace("%", "");
                String ip = (String) report_has.get("ip");
                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                String tomcattype = (String) report_has.get("TOMCAT");
                cell = new Cell(new Phrase(tomcattype, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                // =======

                cell = new Cell(new Phrase(formatetomcat.format(Double.valueOf(string2)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formatetomcat.format(Double.valueOf(string1)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                for (int i = 0; i < 8; i++) {
                    cell = new Cell(new Phrase("", contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }

            }
        }
        // IIS============================================================================
        java.text.NumberFormat formateiis = java.text.NumberFormat.getNumberInstance();
        formateiis.setMaximumFractionDigits(0);//
        if (iisreporthash != null && iisreporthash.size() > 0) {
            Iterator keys = iisreporthash.keySet().iterator();
            Node node = null;
            while (keys.hasNext()) {

                node = (Node) keys.next();

                Hashtable report_has = (Hashtable) iisreporthash.get(node);
                Hashtable maxping = (Hashtable) report_has.get("maxping");
                String string1 = ((String) maxping.get("pingmax")).replace("%", "");
                String string2 = ((String) maxping.get("avgpingcon")).replace("%", "");
                String ip = (String) report_has.get("ip");
                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                String tomcattype = (String) report_has.get("IIS");
                cell = new Cell(new Phrase(tomcattype, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                // =======

                cell = new Cell(new Phrase(formateiis.format(Double.valueOf(string2)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formateiis.format(Double.valueOf(string1)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                for (int i = 0; i < 8; i++) {
                    cell = new Cell(new Phrase("", contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);
                }

            }
        }
        // weblogic================================================================
        java.text.NumberFormat formateweblogic = java.text.NumberFormat.getNumberInstance();
        formateweblogic.setMaximumFractionDigits(0);//
        if (weblogicreporthash != null && weblogicreporthash.size() > 0) {
            Iterator keys = weblogicreporthash.keySet().iterator();
            Node node = null;
            while (keys.hasNext()) {

                node = (Node) keys.next();

                Hashtable report_has = (Hashtable) weblogicreporthash.get(node);
                Hashtable maxping = (Hashtable) report_has.get("maxping");
                String string1 = ((String) maxping.get("pingmax")).replace("%", "");
                String string2 = ((String) maxping.get("avgpingcon")).replace("%", "");
                String ip = (String) report_has.get("ip");
                cell = new Cell(new Phrase(ip, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                String tomcattype = (String) report_has.get("WEBLOGIC");
                cell = new Cell(new Phrase(tomcattype, contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                // =======

                cell = new Cell(new Phrase(formateweblogic.format(Double.valueOf(string2)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);
                cell = new Cell(new Phrase(formateweblogic.format(Double.valueOf(string1)), contextFont));
                cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                aTable.addCell(cell);

                for (int i = 0; i < 8; i++) {
                    cell = new Cell(new Phrase("", contextFont));
                    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
                    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
                    aTable.addCell(cell);

                }
            }
        }
        // =============================================================
        cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "" + "\n" + "",
                titleFont));
        cell.setRowspan(6);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        // =======

        cell = new Cell(new Phrase("(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("(%)", titleFont));
        cell.setColspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("()", titleFont));
        cell.setRowspan(2);
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("" + "\n" + "", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }

        cell = new Cell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }
        cell = new Cell(new Phrase("0", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }
        cell = new Cell(new Phrase("0", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }
        cell = new Cell(new Phrase("0", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("SSO", titleFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        cell = new Cell(new Phrase("", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);

        for (int i = 0; i < 6; i++) {
            cell = new Cell(new Phrase("", contextFont));
            cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
            cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
            aTable.addCell(cell);
        }
        cell = new Cell(new Phrase("0", contextFont));
        cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
        cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
        aTable.addCell(cell);
        document.add(aTable);
        document.close();
    } catch (Exception e) {
        // TODO: handle exception
    }
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

/**
 * IISLog IP word//w  ww .j av  a2s  . c om
 * 
 * @param filename
 * @throws DocumentException
 * @throws IOException
 */
public void createReport_iislogipword(String filename) throws DocumentException, IOException

{
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");
    // 
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    RtfWriter2.getInstance(document, new FileOutputStream(filename));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED);
    Font contextFont = new Font(bfChinese, 12, Font.NORMAL);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;

    Paragraph context = new Paragraph(contextString, contextFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    // 
    Image img = Image
            .getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/IISLogIP.png");
    img.setAbsolutePosition(0, 0);
    img.setAlignment(Image.LEFT);// 
    document.add(img);

    document.close();

}

From source file:com.afunms.report.abstraction.ExcelReport1.java

/**
 * IISLog  word//from   ww w  .  j  a  v  a 2s  .  com
 * 
 * @param filename
 * @throws DocumentException
 * @throws IOException
 */
public void createReport_iislogstateword(String filename) throws DocumentException, IOException

{

    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");
    // 
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    RtfWriter2.getInstance(document, new FileOutputStream(filename));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED);

    Font contextFont = new Font(bfChinese, 12, Font.NORMAL);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;

    Paragraph context = new Paragraph(contextString, contextFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    // 
    // 
    Image img = Image.getInstance(
            ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/IISLogState.png");
    img.setAbsolutePosition(0, 0);
    img.setAlignment(Image.LEFT);// 
    document.add(img);

    document.close();

}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_tomcatDoc(String file, String type) throws DocumentException, IOException {
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);/* w ww .jav a2s. com*/
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Hashtable CPU = (Hashtable) reportHash.get("CPU");
    if (CPU == null)
        CPU = new Hashtable();
    String Ping = (String) reportHash.get("Ping");
    Hashtable Memory = (Hashtable) reportHash.get("Memory");
    Hashtable Disk = (Hashtable) reportHash.get("Disk");
    Hashtable memMaxHash = (Hashtable) reportHash.get("memmaxhash");
    Hashtable memAvgHash = (Hashtable) reportHash.get("memavghash");
    Hashtable maxping = (Hashtable) reportHash.get("ping");
    Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm");

    String jvmnow = (String) reportHash.get("jvmnow");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    String[] memoryItemch = { "", "", "", "" };
    String[] memoryItem = { "Capability", "Utilization" };
    String[] diskItem = { "AllSize", "UsedSize", "Utilization" };
    String[] diskItemch = { "", "", "" };
    // 
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    if ("pdf".equals(type)) {
        PdfWriter.getInstance(document, new FileOutputStream(file));
    } else {
        RtfWriter2.getInstance(document, new FileOutputStream(file));
    }
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "", titleFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString, titleFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    Table aTable = new Table(4);
    this.setTableFormat(aTable);
    // float[] widths = { 220f, 300f, 220f, 220f };
    // aTable.setWidths(widths);
    // aTable.setWidth(100); //  90%
    // aTable.setAlignment(Element.ALIGN_CENTER);// 
    // aTable.setAutoFillEmptyCells(true); // 
    // aTable.setBorderWidth(1); // 
    // aTable.setBorderColor(new Color(0, 125, 255)); // 
    // aTable.setPadding(2);// 
    // aTable.setSpacing(0);// 
    // aTable.setBorder(2);// 
    // aTable.endHeaders();

    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), false));
    aTable.addCell(this.setCellFormat(new Phrase(Ping + "%", contextFont), false));
    aTable.addCell(this.setCellFormat(new Phrase((String) maxping.get("pingmax"), contextFont), false));
    aTable.addCell(this.setCellFormat(new Phrase((String) maxping.get("avgpingcon"), contextFont), false));
    Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "TomcatPing" + ".png");
    // img.setAbsolutePosition(0, 0);
    img.setAlignment(Image.LEFT);// 
    document.add(aTable);
    document.add(img);
    Table aTable1 = new Table(4);
    this.setTableFormat(aTable1);
    // float[] widths1 = { 220f, 300f, 220f, 220f };
    // aTable.setWidths(widths1);
    // aTable.setWidth(100); //  90%
    // aTable.setAlignment(Element.ALIGN_CENTER);// 
    // aTable.setAutoFillEmptyCells(true); // 
    // aTable.setBorderWidth(1); // 
    // aTable.setBorderColor(new Color(0, 125, 255)); // 
    // aTable.setPadding(2);// 
    // aTable.setSpacing(0);// 
    // aTable.setBorder(2);// 
    // aTable.endHeaders();

    aTable1.addCell(this.setCellFormat(new Phrase("JVM", contextFont), true));
    aTable1.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable1.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable1.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable1.addCell(this.setCellFormat(new Phrase("", contextFont), false));
    aTable1.addCell(this.setCellFormat(new Phrase(jvmnow + "%", contextFont), false));
    aTable1.addCell(this.setCellFormat(new Phrase((String) maxjvm.get("max_tomcat_jvm"), contextFont), false));
    aTable1.addCell(this.setCellFormat(new Phrase((String) maxjvm.get("avg_tomcat_jvm"), contextFont), false));
    Image img1 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "tomcat_jvm" + ".png");
    // img1.setAbsolutePosition(0, 0);
    img1.setAlignment(Image.LEFT);// 
    document.add(aTable1);
    document.add(img1);
    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_tomcatPDF(String file) throws DocumentException, IOException {
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);//w  ww  .  j  a  v  a  2 s . co  m
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Hashtable CPU = (Hashtable) reportHash.get("CPU");
    if (CPU == null)
        CPU = new Hashtable();
    String Ping = (String) reportHash.get("Ping");
    Calendar colTime = (Calendar) reportHash.get("time");

    Hashtable maxping = (Hashtable) reportHash.get("ping");
    String jvmnow = (String) reportHash.get("jvmnow");
    Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    PdfWriter.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "", contextFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString, contextFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    document.add(new Paragraph("\n"));
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    PdfPTable aTable = new PdfPTable(4);
    float[] widths = { 220f, 300f, 220f, 220f };
    aTable.setWidths(widths);
    aTable.setWidthPercentage(100);

    aTable.addCell(new Phrase("", contextFont));
    aTable.addCell(new Phrase("", contextFont));
    aTable.addCell(new Phrase("", contextFont));
    aTable.addCell(new Phrase("", contextFont));
    // aTable.addCell("3.2",Ping+"%");
    aTable.addCell("");
    aTable.addCell(Ping + "%");
    aTable.addCell((String) maxping.get("pingmax"));
    aTable.addCell((String) maxping.get("avgpingcon"));
    Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "TomcatPing" + ".png");
    img.setAlignment(Image.LEFT);// 
    img.scalePercent(75);
    document.add(aTable);
    document.add(img);
    PdfPTable aTable1 = new PdfPTable(4);
    float[] widths1 = { 220f, 300f, 220f, 220f };
    aTable1.setWidths(widths1);
    aTable1.setWidthPercentage(100);
    aTable1.addCell(new Phrase("JVM", contextFont));
    aTable1.addCell(new Phrase("", contextFont));
    aTable1.addCell(new Phrase("", contextFont));
    aTable1.addCell(new Phrase("", contextFont));
    // aTable.addCell("3.2",Ping+"%");
    aTable1.addCell("");
    aTable1.addCell(jvmnow + "%");
    aTable1.addCell((String) maxjvm.get("max_tomcat_jvm"));
    aTable1.addCell((String) maxjvm.get("avg_tomcat_jvm"));

    Image img1 = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "tomcat_jvm" + ".png");
    img1.setAlignment(Image.LEFT);// 
    img1.scalePercent(75);
    document.add(aTable1);
    document.add(img1);
    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

/**
 * @param file// w w  w.j a  v a 2s . co m
 * @param type
 * @throws DocumentException
 * @throws IOException
 */
public void createReport_tomcatNewDoc(String file, String type) throws DocumentException, IOException {
    Hashtable Memory = (Hashtable) reportHash.get("Memory");
    // EventListDao eventListDao = new EventListDao();

    Hashtable maxping = (Hashtable) reportHash.get("ping");
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");
    String hostname = (String) reportHash.get("equipname");
    String hostnameDoc = (String) reportHash.get("equipnameDoc");
    String ip = (String) reportHash.get("ip");
    String typename = (String) reportHash.get("typename");
    String startdate = (String) reportHash.get("startdate");
    Tomcat tomcat = (Tomcat) reportHash.get("tomcat");
    Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm");
    String downnum = (String) reportHash.get("downnum");
    /* String type = (String)request.getAttribute("type"); */
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    if ("pdf".equals(type)) {
        PdfWriter.getInstance(document, new FileOutputStream(file));
    } else {
        RtfWriter2.getInstance(document, new FileOutputStream(file));
    }
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 12, Font.NORMAL);

    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    Table aTable = new Table(8);
    this.setTableFormat(aTable);
    // float[] widths = { 220f, 220f, 220f, 110f, 110f, 110f, 110f, 220f };
    // aTable.setWidths(widths);
    // aTable.setWidth(100); //  90%
    // aTable.setAlignment(Element.ALIGN_CENTER);// 
    // aTable.setAutoFillEmptyCells(true); // 
    // aTable.setBorderWidth(1); // 
    // aTable.setBorderColor(new Color(0, 125, 255)); // 
    // aTable.setPadding(2);// 
    // aTable.setSpacing(0);// 
    // aTable.setBorder(2);// 
    //
    // aTable.endHeaders();
    Cell cell = null;
    cell = new Cell(new Phrase("\n" + "" + hostname + "" + "\n", titleFont));
    this.setCellFormat(cell, true);
    cell.setColspan(8);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + starttime + "  " + totime + "\n", contextFont));
    cell.setColspan(7);

    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    cell = new Cell(new Phrase(hostnameDoc, contextFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("IP", titleFont));
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    cell = new Cell(new Phrase(ip, contextFont));
    cell.setColspan(2);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);

    cell = new Cell(new Phrase("", titleFont));
    cell.setColspan(2);
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    cell = new Cell(new Phrase(typename, contextFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    String grade = (String) reportHash.get("grade");
    cell = new Cell(new Phrase("\n" + grade + "\n", contextFont));
    cell.setColspan(7);

    aTable.addCell(cell);
    cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont));
    cell.setRowspan(4);
    this.setCellFormat(cell, true);
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase((String) maxping.get("pingmax"), contextFont));
    cell.setColspan(2);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("", titleFont));
    cell.setColspan(2);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);

    cell = new Cell(new Phrase((String) maxping.get("avgpingcon"), contextFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "JVM" + "\n", titleFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase((String) maxjvm.get("max_tomcat_jvm"), contextFont));
    cell.setColspan(2);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("", titleFont));
    cell.setColspan(2);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase((String) maxjvm.get("avg_tomcat_jvm"), contextFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setRowspan(2);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "TOMCAT" + "\n", titleFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase(tomcat.getVersion(), contextFont));
    cell.setColspan(2);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("JVM", titleFont));
    cell.setColspan(2);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase(tomcat.getJvmversion(), contextFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "JVM" + "\n", titleFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase(tomcat.getJvmvender(), contextFont));
    cell.setColspan(2);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("", titleFont));
    cell.setColspan(2);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase(tomcat.getOs(), contextFont));
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont));
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + downnum + "" + "\n", contextFont));
    cell.setColspan(7);
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    this.setCellFormat(cell, true);
    cell.setColspan(8);
    aTable.addCell(cell);
    String strping = "";
    if ("0".equals(downnum)) {
        strping = "    2   " + downnum + "" + "\n"
                + "\n";
    } else {
        strping = "    2   " + "\n" + "\n";
    }
    cell = new Cell(new Phrase("    1   " + " \n" + "\n"
            + strping + "\n" + "\n" + "\n", contextFont)

    );
    cell.setColspan(8);
    aTable.addCell(cell);
    // end 

    // end  }
    document.add(aTable);
    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_tomcatNewPDF(String file) throws DocumentException, IOException {
    Hashtable Memory = (Hashtable) reportHash.get("Memory");
    // EventListDao eventListDao = new EventListDao();

    Hashtable maxping = (Hashtable) reportHash.get("ping");
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");
    String hostname = (String) reportHash.get("equipname");
    String hostnameDoc = (String) reportHash.get("equipnameDoc");
    String ip = (String) reportHash.get("ip");
    String typename = (String) reportHash.get("typename");
    String startdate = (String) reportHash.get("startdate");
    String downnum = (String) reportHash.get("downnum");
    Tomcat tomcat = (Tomcat) reportHash.get("tomcat");
    /* String type = (String)request.getAttribute("type"); */
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    PdfWriter.getInstance(document, new FileOutputStream(file));
    document.open();/*w w  w . j a va2s . c o  m*/
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 12, Font.NORMAL);
    Font contextFont1 = new Font(bfChinese, 10, Font.NORMAL);

    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    Table aTable = new Table(8);
    float[] widths = { 220f, 220f, 220f, 110f, 110f, 110f, 110f, 220f };
    aTable.setWidths(widths);
    aTable.setWidth(100); //  90%
    aTable.setAlignment(Element.ALIGN_CENTER);// 
    aTable.setAutoFillEmptyCells(true); // 
    aTable.setBorderWidth(1); // 
    aTable.setBorderColor(new Color(0, 125, 255)); // 
    aTable.setPadding(2);// 
    aTable.setSpacing(0);// 
    aTable.setBorder(2);// 

    aTable.endHeaders();
    Cell cell = null;
    cell = new Cell(new Phrase("\n" + "" + hostname + "" + "\n", titleFont));
    cell.setColspan(8);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER);
    cell.setVerticalAlignment(Element.ALIGN_CENTER);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    aTable.addCell(cell);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    cell = new Cell(new Phrase("\n" + starttime + "  " + totime + "\n", contextFont1));
    cell.setColspan(7);

    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(hostnameDoc, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("IP"));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(ip));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(typename));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    String grade = (String) reportHash.get("grade");
    cell = new Cell(new Phrase("\n" + grade + "\n", contextFont));
    cell.setColspan(7);

    aTable.addCell(cell);
    cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont));
    cell.setRowspan(4);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase((String) maxping.get("pingmax")));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase((String) maxping.get("avgpingcon")));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "JVM" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase((String) maxping.get("pingmax")));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase((String) maxping.get("avgpingcon")));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setRowspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "TOMCAT" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(tomcat.getVersion()));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("JVM", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(tomcat.getJvmversion()));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "JVM" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(tomcat.getJvmvender()));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(tomcat.getOs()));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + downnum + "" + "\n", contextFont));
    cell.setColspan(7);
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    cell.setColspan(8);
    aTable.addCell(cell);
    String strping = "";
    if ("0".equals(downnum)) {
        strping = "    2   " + downnum + "" + "\n"
                + "\n";
    } else {
        strping = "    2   " + "\n" + "\n";
    }
    cell = new Cell(new Phrase("    1   " + " \n" + "\n"
            + strping + "\n" + "\n" + "\n", contextFont)

    );
    cell.setColspan(8);
    aTable.addCell(cell);

    // end 

    // end  }
    document.add(aTable);
    document.close();

}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_iisDoc(String file) throws DocumentException, IOException {
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);/*from   www .  j a v  a  2 s . c o m*/
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Calendar colTime = (Calendar) reportHash.get("time");
    Hashtable maxping = (Hashtable) reportHash.get("ping");
    String iisnow = (String) reportHash.get("iisnow");

    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    String[] memoryItemch = { "", "", "", "" };
    String[] memoryItem = { "Capability", "Utilization" };
    String[] diskItem = { "AllSize", "UsedSize", "Utilization" };
    String[] diskItemch = { "", "", "" };
    // 
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    RtfWriter2.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("Times-Roman", "", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "", titleFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString, contextFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    Table aTable = new Table(4);
    this.setTableFormat(aTable);
    // float[] widths = { 220f, 300f, 220f, 220f };
    // aTable.setWidths(widths);
    // aTable.setWidth(100); //  90%
    // aTable.setAlignment(Element.ALIGN_CENTER);// 
    // aTable.setAutoFillEmptyCells(true); // 
    // aTable.setBorderWidth(1); // 
    // aTable.setBorderColor(new Color(0, 125, 255)); // 
    // aTable.setPadding(2);// 
    // aTable.setSpacing(0);// 
    // aTable.setBorder(2);// 
    // aTable.endHeaders();

    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    // aTable.addCell("3.2",Ping+"%");
    aTable.addCell("");
    aTable.addCell(iisnow + "%");
    aTable.addCell((String) maxping.get("pingmax"));
    aTable.addCell((String) maxping.get("avgpingcon"));
    Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "iisPing" + ".png");
    img.setAbsolutePosition(0, 0);
    img.setAlignment(Image.LEFT);// 
    document.add(aTable);
    document.add(img);

    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

public void createReport_iisPDF(String file) throws DocumentException, IOException {
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");

    String hostname = (String) reportHash.get("equipname");
    String ip = (String) reportHash.get("ip");
    String newip = doip(ip);/*from  www .j  a v  a  2s  .  c om*/
    // WritableSheet sheet = wb.createSheet(hostname + "", 0);
    Calendar colTime = (Calendar) reportHash.get("time");

    Hashtable maxping = (Hashtable) reportHash.get("ping");
    String iisnow = (String) reportHash.get("iisnow");
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");

    // 
    Document document = new Document(PageSize.A4);
    // (Writer)document(Writer)
    PdfWriter.getInstance(document, new FileOutputStream(file));
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 10, Font.NORMAL);
    Paragraph title = new Paragraph(hostname + "", titleFont);
    // 
    title.setAlignment(Element.ALIGN_CENTER);
    // title.setFont(titleFont);
    document.add(title);
    String contextString = ":" + impReport.getTimeStamp() + " \n"// 
            + ":" + starttime + "  " + totime;
    Paragraph context = new Paragraph(contextString, contextFont);
    // 
    context.setAlignment(Element.ALIGN_LEFT);
    // context.setFont(contextFont);
    // 
    context.setSpacingBefore(5);
    // 
    context.setFirstLineIndent(5);
    document.add(context);
    document.add(new Paragraph("\n"));
    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    Table aTable = new Table(4);
    this.setTableFormat(aTable);
    // float[] widths = { 220f, 300f, 220f, 220f };
    // aTable.setWidths(widths);
    // aTable.setWidthPercentage(100);

    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    aTable.addCell(this.setCellFormat(new Phrase("", contextFont), true));
    // aTable.addCell("3.2",Ping+"%");
    aTable.addCell("");
    aTable.addCell(iisnow + "%");
    aTable.addCell((String) maxping.get("pingmax"));
    aTable.addCell((String) maxping.get("avgpingcon"));
    Image img = Image.getInstance(ResourceCenter.getInstance().getSysPath() + "/resource/image/jfreechart/"
            + newip + "iisPing" + ".png");
    img.setAlignment(Image.LEFT);// 
    img.scalePercent(75);
    document.add(aTable);
    document.add(img);
    PdfPTable aTable1 = new PdfPTable(4);
    float[] widths1 = { 220f, 300f, 220f, 220f };
    aTable1.setWidths(widths1);
    aTable1.setWidthPercentage(100);

    document.close();
}

From source file:com.afunms.report.abstraction.ExcelReport1.java

/**
 * @param file/* w  ww  . j  av  a 2 s . co m*/
 * @param type
 * @throws DocumentException
 * @throws IOException
 */
public void createReport_iisNewDoc(String file, String type) throws DocumentException, IOException {
    Hashtable Memory = (Hashtable) reportHash.get("Memory");
    // EventListDao eventListDao = new EventListDao();

    Hashtable maxping = (Hashtable) reportHash.get("ping");
    String starttime = (String) reportHash.get("starttime");
    String totime = (String) reportHash.get("totime");
    String hostname = (String) reportHash.get("equipname");
    String hostnameDoc = (String) reportHash.get("equipnameDoc");
    String ip = (String) reportHash.get("ip");
    String typename = (String) reportHash.get("typename");
    String startdate = (String) reportHash.get("startdate");
    Tomcat tomcat = (Tomcat) reportHash.get("tomcat");
    Hashtable maxjvm = (Hashtable) reportHash.get("maxjvm");
    String downnum = (String) reportHash.get("downnum");
    IIS iis = (IIS) reportHash.get("iis");
    // time
    Hashtable pollingtime_ht = new Hashtable();
    IISManager tm = new IISManager();
    String lasttime;
    String nexttime;
    try {
        pollingtime_ht = tm.getCollecttime(iis.getIpAddress());
    } catch (Exception e) {

        SysLogger.error("", e);
    }
    if (pollingtime_ht != null) {
        lasttime = (String) pollingtime_ht.get("lasttime");
        nexttime = (String) pollingtime_ht.get("nexttime");
    } else {
        lasttime = null;
        nexttime = null;
    }
    // 
    List data_list = new ArrayList();
    Hashtable iisvalues = ShareData.getIisdata();
    if (iisvalues != null && iisvalues.size() > 0) {
        data_list = (List) iisvalues.get(ip);
    }
    System.out.println(data_list + "----------------------------====================");
    String totalBytesSentHighWord = "";
    String totalBytesSentLowWord = "";
    String totalBytesReceivedHighWord = "";
    String totalBytesReceivedLowWord = "";

    String totalFilesSent = "";
    String totalFilesReceived = "";
    String currentAnonymousUsers = "";
    String totalAnonymousUsers = "";

    String maxAnonymousUsers = "";
    String currentConnections = "";
    String maxConnections = "";
    String connectionAttempts = "";

    String logonAttempts = "";
    String totalGets = "";
    String totalPosts = "";
    String totalNotFoundErrors = "";
    if (data_list != null && data_list.size() > 0) {

        IISVo iisvo = (IISVo) data_list.get(0);
        totalBytesSentHighWord = iisvo.getTotalBytesSentHighWord();
        totalBytesSentLowWord = iisvo.getTotalBytesSentLowWord();
        totalBytesReceivedHighWord = iisvo.getTotalBytesReceivedHighWord();
        totalBytesReceivedLowWord = iisvo.getTotalBytesReceivedLowWord();

        totalFilesSent = iisvo.getTotalFilesSent();
        totalFilesReceived = iisvo.getTotalFilesReceived();
        currentAnonymousUsers = iisvo.getCurrentAnonymousUsers();
        totalAnonymousUsers = iisvo.getTotalAnonymousUsers();

        maxAnonymousUsers = iisvo.getMaxAnonymousUsers();
        currentConnections = iisvo.getCurrentConnections();
        maxConnections = iisvo.getMaxConnections();
        connectionAttempts = iisvo.getConnectionAttempts();

        logonAttempts = iisvo.getLogonAttempts();
        totalGets = iisvo.getTotalGets();
        totalPosts = iisvo.getTotalPosts();
        totalNotFoundErrors = iisvo.getTotalNotFoundErrors();

    }
    // end 
    /* String type = (String)request.getAttribute("type"); */
    Document document = null;
    // (Writer)document(Writer)
    if ("pdf".equals(type)) {
        document = new Document(PageSize.B4);
        PdfWriter.getInstance(document, new FileOutputStream(file));
    } else {
        document = new Document(PageSize.A4);
        RtfWriter2.getInstance(document, new FileOutputStream(file));
    }
    document.open();
    // 
    BaseFont bfChinese = BaseFont.createFont("STSong-Light", "UniGB-UCS2-H", BaseFont.NOT_EMBEDDED);
    // 
    Font titleFont = new Font(bfChinese, 12, Font.BOLD);
    // 
    Font contextFont = new Font(bfChinese, 12, Font.NORMAL);

    Font fontChinese = new Font(bfChinese, 12, Font.NORMAL, Color.black);
    Table aTable = new Table(8);
    this.setTableFormat(aTable);
    // float[] widths = { 220f, 220f, 220f, 110f, 110f, 110f, 110f, 220f };
    // aTable.setWidths(widths);
    // aTable.setWidth(100); //  90%
    // aTable.setAlignment(Element.ALIGN_CENTER);// 
    // aTable.setAutoFillEmptyCells(true); // 
    // aTable.setBorderWidth(1); // 
    // aTable.setBorderColor(new Color(0, 125, 255)); // 
    // aTable.setPadding(2);// 
    // aTable.setSpacing(0);// 
    // aTable.setBorder(2);// 

    // aTable.endHeaders();
    Cell cell = null;
    cell = new Cell(new Phrase("\n" + "" + hostname + "" + "\n", titleFont));
    cell.setColspan(8);
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    aTable.addCell(cell);
    this.setCellFormat(cell, true);
    cell = new Cell(new Phrase("\n" + starttime + "  " + totime + "\n", contextFont));
    cell.setColspan(7);
    this.setCellFormat(cell, false);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    cell = new Cell(new Phrase(hostnameDoc, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("IP", titleFont));
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    cell = new Cell(new Phrase(ip, contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("", titleFont));
    cell.setColspan(2);
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    cell = new Cell(new Phrase(typename, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    String grade = (String) reportHash.get("grade");
    cell = new Cell(new Phrase("\n" + grade + "\n", contextFont));
    cell.setColspan(7);

    aTable.addCell(cell);
    cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont));
    cell.setRowspan(10);
    this.setCellFormat(cell, true);
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase((String) maxping.get("pingmax"), contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase((String) maxping.get("avgpingcon"), contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));

    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + ":" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(lasttime, contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(":", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(nexttime, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    cell.setRowspan(8);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "32 :" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(totalBytesSentHighWord, contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("32 :", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(totalBytesSentLowWord, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "32 :" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(totalBytesReceivedHighWord, contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("32 :", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(totalBytesReceivedLowWord, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + ":" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(totalFilesSent, contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(":", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(totalFilesReceived, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + ":" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(currentAnonymousUsers, contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(":", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(totalAnonymousUsers, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + ":" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(maxAnonymousUsers, contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(":", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(currentConnections, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + ":" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(maxConnections, contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("::", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(connectionAttempts, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + ":" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(logonAttempts, contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase("GET:", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(totalGets, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "POST:" + "\n", titleFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(totalPosts, contextFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(":", titleFont));
    cell.setColspan(2);
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);
    cell = new Cell(new Phrase(totalNotFoundErrors, contextFont));
    cell.setHorizontalAlignment(Element.ALIGN_CENTER); // 
    cell.setVerticalAlignment(Element.ALIGN_MIDDLE); // 
    aTable.addCell(cell);

    cell = new Cell(new Phrase("" + "\n" + "" + "\n" + "" + "\n" + "", titleFont));
    this.setCellFormat(cell, true);
    aTable.addCell(cell);
    cell = new Cell(new Phrase("\n" + "" + downnum + "" + "\n", contextFont));
    cell.setColspan(7);
    aTable.addCell(cell);

    cell = new Cell(new Phrase("\n" + "" + "\n", titleFont));
    this.setCellFormat(cell, true);
    cell.setColspan(8);
    aTable.addCell(cell);
    String strping = "";
    if ("0".equals(downnum)) {
        strping = "    2   " + downnum + "" + "\n"
                + "\n";
    } else {
        strping = "    2   " + "\n" + "\n";
    }
    cell = new Cell(new Phrase("    1   " + " \n" + "\n"
            + strping + "\n" + "\n" + "\n", contextFont));
    cell.setColspan(8);
    aTable.addCell(cell);
    // end 

    // end  }
    document.add(aTable);
    document.close();
}