📄 sheet.java
字号:
* @see org.apache.poi.hssf.record.Record * @return record containing a IterationRecord */ protected Record createIteration() { IterationRecord retval = new IterationRecord(); retval.setIteration(false); return retval; } /** * creates the Delta record and sets it to 0.0010 (default accuracy) * @see org.apache.poi.hssf.record.DeltaRecord * @see org.apache.poi.hssf.record.Record * @return record containing a DeltaRecord */ protected Record createDelta() { DeltaRecord retval = new DeltaRecord(); retval.setMaxChange(0.0010); return retval; } /** * creates the SaveRecalc record and sets it to true (recalculate before saving) * @see org.apache.poi.hssf.record.SaveRecalcRecord * @see org.apache.poi.hssf.record.Record * @return record containing a SaveRecalcRecord */ protected Record createSaveRecalc() { SaveRecalcRecord retval = new SaveRecalcRecord(); retval.setRecalc(true); return retval; } /** * creates the PrintHeaders record and sets it to false (we don't create headers yet so why print them) * @see org.apache.poi.hssf.record.PrintHeadersRecord * @see org.apache.poi.hssf.record.Record * @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() { ColumnInfoRecord retval = new ColumnInfoRecord(); retval.setColumnWidth(( short ) 0x8); retval.setOptions(( short ) 6); retval.setXFIndex(( short ) 0x0f); return retval; } /** * 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() { 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; int k = 0; if (columnSizes != null) { for (k = 0; k < columnSizes.size(); k++) { ci = ( ColumnInfoRecord ) columnSizes.get(k); if ((ci.getFirstColumn() <= column) && (column <= ci.getLastColumn())) { break; } ci = null; } } if (ci != null) { retval = ci.getColumnWidth(); } else { retval = defaultcolwidth.getColWidth(); } 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) { ColumnInfoRecord ci = null; int k = 0; if (columnSizes == null) { columnSizes = new ArrayList(); } //int cioffset = getDimsLoc() - columnSizes.size(); for (k = 0; k < columnSizes.size(); k++) { ci = ( ColumnInfoRecord ) columnSizes.get(k); if ((ci.getFirstColumn() <= column) && (column <= ci.getLastColumn())) { break; } ci = null; } if (ci != null) {
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -