⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sheetwriter.java

📁 主要介绍snmp编程的一些例子对于snmp编程的人非常重要
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
    }

    final HeaderRecord getHeader()
    {
        return header;
    }

    final FooterRecord getFooter()
    {
        return footer;
    }

    void setWriteData(RowRecord rws[], ArrayList rb, ArrayList cb, ArrayList hl, MergedCells mc, TreeSet cf)
    {
        rows = rws;
        rowBreaks = rb;
        columnBreaks = cb;
        hyperlinks = hl;
        mergedCells = mc;
        columnFormats = cf;
    }

    void setDimensions(int rws, int cls)
    {
        numRows = rws;
        numCols = cls;
    }

    void setSettings(SheetSettings sr)
    {
        settings = sr;
    }

    WorkspaceInformationRecord getWorkspaceOptions()
    {
        return workspaceOptions;
    }

    void setWorkspaceOptions(WorkspaceInformationRecord wo)
    {
        if(wo != null)
            workspaceOptions = wo;
    }

    void setCharts(Chart ch[])
    {
        drawingWriter.setCharts(ch);
    }

    void setDrawings(ArrayList dr, boolean mod)
    {
        drawingWriter.setDrawings(dr, mod);
    }

    Chart[] getCharts()
    {
        return drawingWriter.getCharts();
    }

    void checkMergedBorders()
    {
        Range mcells[] = mergedCells.getMergedCells();
        ArrayList borderFormats = new ArrayList();
label0:
        for(int mci = 0; mci < mcells.length; mci++)
        {
            Range range = mcells[mci];
            Cell topLeft = range.getTopLeft();
            XFRecord tlformat = (XFRecord)topLeft.getCellFormat();
            if(tlformat == null || !tlformat.hasBorders() || tlformat.isRead())
                continue;
            try
            {
                CellXFRecord cf1 = new CellXFRecord(tlformat);
                Cell bottomRight = range.getBottomRight();
                cf1.setBorder(Border.ALL, BorderLineStyle.NONE, Colour.BLACK);
                cf1.setBorder(Border.LEFT, tlformat.getBorderLine(Border.LEFT), tlformat.getBorderColour(Border.LEFT));
                cf1.setBorder(Border.TOP, tlformat.getBorderLine(Border.TOP), tlformat.getBorderColour(Border.TOP));
                if(topLeft.getRow() == bottomRight.getRow())
                    cf1.setBorder(Border.BOTTOM, tlformat.getBorderLine(Border.BOTTOM), tlformat.getBorderColour(Border.BOTTOM));
                if(topLeft.getColumn() == bottomRight.getColumn())
                    cf1.setBorder(Border.RIGHT, tlformat.getBorderLine(Border.RIGHT), tlformat.getBorderColour(Border.RIGHT));
                int index = borderFormats.indexOf(cf1);
                if(index != -1)
                    cf1 = (CellXFRecord)borderFormats.get(index);
                else
                    borderFormats.add(cf1);
                ((WritableCell)topLeft).setCellFormat(cf1);
                if(bottomRight.getRow() > topLeft.getRow())
                {
                    if(bottomRight.getColumn() != topLeft.getColumn())
                    {
                        CellXFRecord cf2 = new CellXFRecord(tlformat);
                        cf2.setBorder(Border.ALL, BorderLineStyle.NONE, Colour.BLACK);
                        cf2.setBorder(Border.LEFT, tlformat.getBorderLine(Border.LEFT), tlformat.getBorderColour(Border.LEFT));
                        cf2.setBorder(Border.BOTTOM, tlformat.getBorderLine(Border.BOTTOM), tlformat.getBorderColour(Border.BOTTOM));
                        index = borderFormats.indexOf(cf2);
                        if(index != -1)
                            cf2 = (CellXFRecord)borderFormats.get(index);
                        else
                            borderFormats.add(cf2);
                        sheet.addCell(new Blank(topLeft.getColumn(), bottomRight.getRow(), cf2));
                    }
                    for(int i = topLeft.getRow() + 1; i < bottomRight.getRow(); i++)
                    {
                        CellXFRecord cf3 = new CellXFRecord(tlformat);
                        cf3.setBorder(Border.ALL, BorderLineStyle.NONE, Colour.BLACK);
                        cf3.setBorder(Border.LEFT, tlformat.getBorderLine(Border.LEFT), tlformat.getBorderColour(Border.LEFT));
                        if(topLeft.getColumn() == bottomRight.getColumn())
                            cf3.setBorder(Border.RIGHT, tlformat.getBorderLine(Border.RIGHT), tlformat.getBorderColour(Border.RIGHT));
                        index = borderFormats.indexOf(cf3);
                        if(index != -1)
                            cf3 = (CellXFRecord)borderFormats.get(index);
                        else
                            borderFormats.add(cf3);
                        sheet.addCell(new Blank(topLeft.getColumn(), i, cf3));
                    }

                }
                if(bottomRight.getColumn() > topLeft.getColumn())
                {
                    if(bottomRight.getRow() != topLeft.getRow())
                    {
                        CellXFRecord cf6 = new CellXFRecord(tlformat);
                        cf6.setBorder(Border.ALL, BorderLineStyle.NONE, Colour.BLACK);
                        cf6.setBorder(Border.RIGHT, tlformat.getBorderLine(Border.RIGHT), tlformat.getBorderColour(Border.RIGHT));
                        cf6.setBorder(Border.TOP, tlformat.getBorderLine(Border.TOP), tlformat.getBorderColour(Border.TOP));
                        index = borderFormats.indexOf(cf6);
                        if(index != -1)
                            cf6 = (CellXFRecord)borderFormats.get(index);
                        else
                            borderFormats.add(cf6);
                        sheet.addCell(new Blank(bottomRight.getColumn(), topLeft.getRow(), cf6));
                    }
                    for(int i = topLeft.getRow() + 1; i < bottomRight.getRow(); i++)
                    {
                        CellXFRecord cf7 = new CellXFRecord(tlformat);
                        cf7.setBorder(Border.ALL, BorderLineStyle.NONE, Colour.BLACK);
                        cf7.setBorder(Border.RIGHT, tlformat.getBorderLine(Border.RIGHT), tlformat.getBorderColour(Border.RIGHT));
                        index = borderFormats.indexOf(cf7);
                        if(index != -1)
                            cf7 = (CellXFRecord)borderFormats.get(index);
                        else
                            borderFormats.add(cf7);
                        sheet.addCell(new Blank(bottomRight.getColumn(), i, cf7));
                    }

                    for(int i = topLeft.getColumn() + 1; i < bottomRight.getColumn(); i++)
                    {
                        CellXFRecord cf8 = new CellXFRecord(tlformat);
                        cf8.setBorder(Border.ALL, BorderLineStyle.NONE, Colour.BLACK);
                        cf8.setBorder(Border.TOP, tlformat.getBorderLine(Border.TOP), tlformat.getBorderColour(Border.TOP));
                        if(topLeft.getRow() == bottomRight.getRow())
                            cf8.setBorder(Border.BOTTOM, tlformat.getBorderLine(Border.BOTTOM), tlformat.getBorderColour(Border.BOTTOM));
                        index = borderFormats.indexOf(cf8);
                        if(index != -1)
                            cf8 = (CellXFRecord)borderFormats.get(index);
                        else
                            borderFormats.add(cf8);
                        sheet.addCell(new Blank(i, topLeft.getRow(), cf8));
                    }

                }
                if(bottomRight.getColumn() <= topLeft.getColumn() && bottomRight.getRow() <= topLeft.getRow())
                    continue;
                CellXFRecord cf4 = new CellXFRecord(tlformat);
                cf4.setBorder(Border.ALL, BorderLineStyle.NONE, Colour.BLACK);
                cf4.setBorder(Border.RIGHT, tlformat.getBorderLine(Border.RIGHT), tlformat.getBorderColour(Border.RIGHT));
                cf4.setBorder(Border.BOTTOM, tlformat.getBorderLine(Border.BOTTOM), tlformat.getBorderColour(Border.BOTTOM));
                if(bottomRight.getRow() == topLeft.getRow())
                    cf4.setBorder(Border.TOP, tlformat.getBorderLine(Border.TOP), tlformat.getBorderColour(Border.TOP));
                if(bottomRight.getColumn() == topLeft.getColumn())
                    cf4.setBorder(Border.LEFT, tlformat.getBorderLine(Border.LEFT), tlformat.getBorderColour(Border.LEFT));
                index = borderFormats.indexOf(cf4);
                if(index != -1)
                    cf4 = (CellXFRecord)borderFormats.get(index);
                else
                    borderFormats.add(cf4);
                sheet.addCell(new Blank(bottomRight.getColumn(), bottomRight.getRow(), cf4));
                int i = topLeft.getColumn() + 1;
                do
                {
                    if(i >= bottomRight.getColumn())
                        continue label0;
                    CellXFRecord cf5 = new CellXFRecord(tlformat);
                    cf5.setBorder(Border.ALL, BorderLineStyle.NONE, Colour.BLACK);
                    cf5.setBorder(Border.BOTTOM, tlformat.getBorderLine(Border.BOTTOM), tlformat.getBorderColour(Border.BOTTOM));
                    if(topLeft.getRow() == bottomRight.getRow())
                        cf5.setBorder(Border.TOP, tlformat.getBorderLine(Border.TOP), tlformat.getBorderColour(Border.TOP));
                    index = borderFormats.indexOf(cf5);
                    if(index != -1)
                        cf5 = (CellXFRecord)borderFormats.get(index);
                    else
                        borderFormats.add(cf5);
                    sheet.addCell(new Blank(i, bottomRight.getRow(), cf5));
                    i++;
                } while(true);
            }
            catch(WriteException e)
            {
                logger.warn(e.toString());
            }
        }

    }

    private Cell[] getColumn(int col)
    {
        boolean found = false;
        int row;
        for(row = numRows - 1; row >= 0 && !found;)
            if(rows[row] != null && rows[row].getCell(col) != null)
                found = true;
            else
                row--;

        Cell cells[] = new Cell[row + 1];
        for(int i = 0; i <= row; i++)
            cells[i] = rows[i] == null ? null : ((Cell) (rows[i].getCell(col)));

        return cells;
    }

    void setChartOnly()
    {
        chartOnly = true;
    }

    void setPLS(PLSRecord pls)
    {
        plsRecord = pls;
    }

    void setButtonPropertySet(ButtonPropertySetRecord bps)
    {
        buttonPropertySet = bps;
    }

    void setDataValidation(DataValidation dv, ArrayList vc)
    {
        dataValidation = dv;
        validatedCells = vc;
    }

    private void writeDataValidation()
        throws IOException
    {
        if(dataValidation != null && validatedCells.size() == 0)
        {
            dataValidation.write(outputFile);
            return;
        }
        if(dataValidation == null && validatedCells.size() > 0)
        {
            int comboBoxId = sheet.getComboBox() == null ? -1 : sheet.getComboBox().getObjectId();
            dataValidation = new DataValidation(comboBoxId, sheet.getWorkbook(), sheet.getWorkbook(), workbookSettings);
            DataValiditySettingsRecord dvsr;
            for(Iterator i = validatedCells.iterator(); i.hasNext(); dataValidation.add(dvsr))
            {
                CellValue cv = (CellValue)i.next();
                CellFeatures cf = cv.getCellFeatures();
                dvsr = new DataValiditySettingsRecord(cf.getDVParser());
            }

            dataValidation.write(outputFile);
            return;
        }
        DataValiditySettingsRecord dvsr;
        for(Iterator i = validatedCells.iterator(); i.hasNext(); dataValidation.add(dvsr))
        {
            CellValue cv = (CellValue)i.next();
            CellFeatures cf = cv.getCellFeatures();
            dvsr = new DataValiditySettingsRecord(cf.getDVParser());
        }

        dataValidation.write(outputFile);
    }

    static Class class$(String x0)
    {
        return Class.forName(x0);
        ClassNotFoundException x1;
        x1;
        throw new NoClassDefFoundError(x1.getMessage());
    }

    static 
    {
        logger = Logger.getLogger(class$jxl$write$biff$SheetWriter != null ? class$jxl$write$biff$SheetWriter : (class$jxl$write$biff$SheetWriter = class$("jxl.write.biff.SheetWriter")));
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -