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

📄 sheet.java

📁 java 读写word excel ppt
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
     * @return record containing a PrintHeadersRecord     */    protected Record createPrintHeaders()    {        PrintHeadersRecord retval = new PrintHeadersRecord();        retval.setPrintHeaders(false);        return retval;    }    /**     * creates the PrintGridlines record and sets it to false (that makes for ugly sheets).  As far as I can     * tell this does the same thing as the GridsetRecord     *     * @see org.apache.poi.hssf.record.PrintGridlinesRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a PrintGridlinesRecord     */    protected Record createPrintGridlines()    {        PrintGridlinesRecord retval = new PrintGridlinesRecord();        retval.setPrintGridlines(false);        return retval;    }    /**     * creates the Gridset record and sets it to true (user has mucked with the gridlines)     * @see org.apache.poi.hssf.record.GridsetRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a GridsetRecord     */    protected Record createGridset()    {        GridsetRecord retval = new GridsetRecord();        retval.setGridset(true);        return retval;    }    /**     * creates the Guts record and sets leftrow/topcol guttter and rowlevelmax/collevelmax to 0     * @see org.apache.poi.hssf.record.GutsRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a GutsRecordRecord     */    protected Record createGuts()    {        GutsRecord retval = new GutsRecord();        retval.setLeftRowGutter(( short ) 0);        retval.setTopColGutter(( short ) 0);        retval.setRowLevelMax(( short ) 0);        retval.setColLevelMax(( short ) 0);        return retval;    }    /**     * creates the DefaultRowHeight Record and sets its options to 0 and rowheight to 0xff     * @see org.apache.poi.hssf.record.DefaultRowHeightRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a DefaultRowHeightRecord     */    protected Record createDefaultRowHeight()    {        DefaultRowHeightRecord retval = new DefaultRowHeightRecord();        retval.setOptionFlags(( short ) 0);        retval.setRowHeight(( short ) 0xff);        return retval;    }    /**     * creates the WSBoolRecord and sets its values to defaults     * @see org.apache.poi.hssf.record.WSBoolRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a WSBoolRecord     */    protected Record createWSBool()    {        WSBoolRecord retval = new WSBoolRecord();        retval.setWSBool1(( byte ) 0x4);        retval.setWSBool2(( byte ) 0xffffffc1);        return retval;    }    /**     * creates the Header Record and sets it to nothing/0 length     * @see org.apache.poi.hssf.record.HeaderRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a HeaderRecord     */    protected Record createHeader()    {        HeaderRecord retval = new HeaderRecord();        retval.setHeaderLength(( byte ) 0);        retval.setHeader(null);        return retval;    }    /**     * creates the Footer Record and sets it to nothing/0 length     * @see org.apache.poi.hssf.record.FooterRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a FooterRecord     */    protected Record createFooter()    {        FooterRecord retval = new FooterRecord();        retval.setFooterLength(( byte ) 0);        retval.setFooter(null);        return retval;    }    /**     * creates the HCenter Record and sets it to false (don't horizontally center)     * @see org.apache.poi.hssf.record.HCenterRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a HCenterRecord     */    protected Record createHCenter()    {        HCenterRecord retval = new HCenterRecord();        retval.setHCenter(false);        return retval;    }    /**     * creates the VCenter Record and sets it to false (don't horizontally center)     * @see org.apache.poi.hssf.record.VCenterRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a VCenterRecord     */    protected Record createVCenter()    {        VCenterRecord retval = new VCenterRecord();        retval.setVCenter(false);        return retval;    }    /**     * creates the PrintSetup Record and sets it to defaults and marks it invalid     * @see org.apache.poi.hssf.record.PrintSetupRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a PrintSetupRecord     */    protected Record createPrintSetup()    {        PrintSetupRecord retval = new PrintSetupRecord();        retval.setPaperSize(( short ) 1);        retval.setScale(( short ) 100);        retval.setPageStart(( short ) 1);        retval.setFitWidth(( short ) 1);        retval.setFitHeight(( short ) 1);        retval.setOptions(( short ) 2);        retval.setHResolution(( short ) 300);        retval.setVResolution(( short ) 300);        retval.setHeaderMargin( 0.5);        retval.setFooterMargin( 0.5);        retval.setCopies(( short ) 0);        return retval;    }    /**     * creates the DefaultColWidth Record and sets it to 8     * @see org.apache.poi.hssf.record.DefaultColWidthRecord     * @see org.apache.poi.hssf.record.Record     * @return record containing a DefaultColWidthRecord     */    protected Record createDefaultColWidth()    {        DefaultColWidthRecord retval = new DefaultColWidthRecord();        retval.setColWidth(( short ) 8);        return retval;    }    /**     * creates the ColumnInfo Record and sets it to a default column/width     * @see org.apache.poi.hssf.record.ColumnInfoRecord     * @return record containing a ColumnInfoRecord     */    protected Record createColInfo()    {        return ColumnInfoRecordsAggregate.createColInfo();    }    /**     * get the default column width for the sheet (if the columns do not define their own width)     * @return default column width     */    public short getDefaultColumnWidth()    {        return defaultcolwidth.getColWidth();    }    /**     * get whether gridlines are printed.     * @return true if printed     */    public boolean isGridsPrinted()    {    	if (gridset == null) {    		gridset = (GridsetRecord)createGridset();    		//Insert the newlycreated Gridset record at the end of the record (just before the EOF)    		int loc = findFirstRecordLocBySid(EOFRecord.sid);    		records.add(loc, gridset);     		    	}        return !gridset.getGridset();    }    /**     * set whether gridlines printed or not.     * @param value     True if gridlines printed.     */    public void setGridsPrinted(boolean value)    {        gridset.setGridset(!value);    }    /**     * set the default column width for the sheet (if the columns do not define their own width)     * @param dcw  default column width     */    public void setDefaultColumnWidth(short dcw)    {        defaultcolwidth.setColWidth(dcw);    }    /**     * set the default row height for the sheet (if the rows do not define their own height)     */    public void setDefaultRowHeight(short dch)    {        defaultrowheight.setRowHeight(dch);    }    /**     * get the default row height for the sheet (if the rows do not define their own height)     * @return  default row height     */    public short getDefaultRowHeight()    {        return defaultrowheight.getRowHeight();    }    /**     * get the width of a given column in units of 1/20th of a point width (twips?)     * @param column index     * @see org.apache.poi.hssf.record.DefaultColWidthRecord     * @see org.apache.poi.hssf.record.ColumnInfoRecord     * @see #setColumnWidth(short,short)     * @return column width in units of 1/20th of a point (twips?)     */    public short getColumnWidth(short column)    {        short            retval = 0;        ColumnInfoRecord ci     = null;        if (columns != null)        {            int count=columns.getNumColumns();            for ( int k=0;k<count;k++ )            {                ci = columns.getColInfo(k);                if ((ci.getFirstColumn() <= column)                        && (column <= ci.getLastColumn()))                {                    break;                }                ci = null;            }        }        if (ci != null)        {            retval = ci.getColumnWidth();        }        else        {            retval = defaultcolwidth.getColWidth();        }        return retval;    }        /**     * get the index to the ExtendedFormatRecord "associated" with      * the column at specified 0-based index. (In this case, an      * ExtendedFormatRecord index is actually associated with a      * ColumnInfoRecord which spans 1 or more columns)     * <br/>     * Returns the index to the default ExtendedFormatRecord (0xF)     * if no ColumnInfoRecord exists that includes the column     * index specified.      * @param column     * @return index of ExtendedFormatRecord associated with     * ColumnInfoRecord that includes the column index or the     * index of the default ExtendedFormatRecord (0xF)     */    public short getXFIndexForColAt(short column) {        short retval = 0;        ColumnInfoRecord ci = null;        if (columns != null) {          int count=columns.getNumColumns();          for ( int k=0;k<count;k++ )          {                ci = columns.getColInfo(k);                if ((ci.getFirstColumn() <= column)                        && (column <= ci.getLastColumn())) {                    break;                }                ci = null;            }        }        retval = (ci != null) ? ci.getXFIndex() : 0xF;        return retval;    }    /**     * set the width for a given column in 1/20th of a character width units     * @param column - the column number     * @param width (in units of 1/20th of a character width)     */    public void setColumnWidth(short column, short width)    {        setColumn( column, new Short(width), null, null, null);    }    /**     * Get the hidden property for a given column.     * @param column index     * @see org.apache.poi.hssf.record.DefaultColWidthRecord     * @see org.apache.poi.hssf.record.ColumnInfoRecord     * @see #setColumnHidden(short,boolean)     * @return whether the column is hidden or not.     */    public boolean isColumnHidden(short column)    {        boolean          retval = false;        ColumnInfoRecord ci     = null;        if (columns != null)        {            for ( Iterator iterator = columns.getIterator(); iterator.hasNext(); )            {                ci = ( ColumnInfoRecord ) iterator.next();                if ((ci.getFirstColumn() <= column)                        && (column <= ci.g

⌨️ 快捷键说明

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