📄 hssfsheet.java
字号:
sheet.setGridsPrinted(value); } /** * adds a merged region of cells (hence those cells form one) * @param region (rowfrom/colfrom-rowto/colto) to merge * @return index of this region */ public int addMergedRegion(Region region) { //return sheet.addMergedRegion((short) region.getRowFrom(), return sheet.addMergedRegion( region.getRowFrom(), region.getColumnFrom(), //(short) region.getRowTo(), region.getRowTo(), region.getColumnTo()); } /** * determines whether the output is vertically centered on the page. * @param value true to vertically center, false otherwise. */ public void setVerticallyCenter(boolean value) { VCenterRecord record = (VCenterRecord) sheet.findFirstRecordBySid(VCenterRecord.sid); record.setVCenter(value); } /** * Determine whether printed output for this sheet will be vertically centered. */ public boolean getVerticallyCenter(boolean value) { VCenterRecord record = (VCenterRecord) sheet.findFirstRecordBySid(VCenterRecord.sid); return record.getVCenter(); } /** * determines whether the output is horizontally centered on the page. * @param value true to horizontally center, false otherwise. */ public void setHorizontallyCenter(boolean value) { HCenterRecord record = (HCenterRecord) sheet.findFirstRecordBySid(HCenterRecord.sid); record.setHCenter(value); } /** * Determine whether printed output for this sheet will be horizontally centered. */ public boolean getHorizontallyCenter() { HCenterRecord record = (HCenterRecord) sheet.findFirstRecordBySid(HCenterRecord.sid); return record.getHCenter(); } /** * removes a merged region of cells (hence letting them free) * @param index of the region to unmerge */ public void removeMergedRegion(int index) { sheet.removeMergedRegion(index); } /** * returns the number of merged regions * @return number of merged regions */ public int getNumMergedRegions() { return sheet.getNumMergedRegions(); } /** * gets the region at a particular index * @param index of the region to fetch * @return the merged region (simple eh?) */ public Region getMergedRegionAt(int index) { return new Region(sheet.getMergedRegionAt(index)); } /** * @return an iterator of the PHYSICAL rows. Meaning the 3rd element may not * be the third row if say for instance the second row is undefined. */ public Iterator rowIterator() { return rows.values().iterator(); } /** * used internally in the API to get the low level Sheet record represented by this * Object. * @return Sheet - low level representation of this HSSFSheet. */ protected Sheet getSheet() { return sheet; } /** * whether alternate expression evaluation is on * @param b alternative expression evaluation or not */ public void setAlternativeExpression(boolean b) { WSBoolRecord record = (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); record.setAlternateExpression(b); } /** * whether alternative formula entry is on * @param b alternative formulas or not */ public void setAlternativeFormula(boolean b) { WSBoolRecord record = (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); record.setAlternateFormula(b); } /** * show automatic page breaks or not * @param b whether to show auto page breaks */ public void setAutobreaks(boolean b) { WSBoolRecord record = (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); record.setAutobreaks(b); } /** * set whether sheet is a dialog sheet or not * @param b isDialog or not */ public void setDialog(boolean b) { WSBoolRecord record = (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); record.setDialog(b); } /** * set whether to display the guts or not * * @param b guts or no guts (or glory) */ public void setDisplayGuts(boolean b) { WSBoolRecord record = (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); record.setDisplayGuts(b); } /** * fit to page option is on * @param b fit or not */ public void setFitToPage(boolean b) { WSBoolRecord record = (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); record.setFitToPage(b); } /** * set if row summaries appear below detail in the outline * @param b below or not */ public void setRowSumsBelow(boolean b) { WSBoolRecord record = (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); record.setRowSumsBelow(b); } /** * set if col summaries appear right of the detail in the outline * @param b right or not */ public void setRowSumsRight(boolean b) { WSBoolRecord record = (WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid); record.setRowSumsRight(b); } /** * whether alternate expression evaluation is on * @return alternative expression evaluation or not */ public boolean getAlternateExpression() { return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) .getAlternateExpression(); } /** * whether alternative formula entry is on * @return alternative formulas or not */ public boolean getAlternateFormula() { return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) .getAlternateFormula(); } /** * show automatic page breaks or not * @return whether to show auto page breaks */ public boolean getAutobreaks() { return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) .getAutobreaks(); } /** * get whether sheet is a dialog sheet or not * @return isDialog or not */ public boolean getDialog() { return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) .getDialog(); } /** * get whether to display the guts or not * * @return guts or no guts (or glory) */ public boolean getDisplayGuts() { return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) .getDisplayGuts(); } /** * fit to page option is on * @return fit or not */ public boolean getFitToPage() { return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) .getFitToPage(); } /** * get if row summaries appear below detail in the outline * @return below or not */ public boolean getRowSumsBelow() { return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) .getRowSumsBelow(); } /** * get if col summaries appear right of the detail in the outline * @return right or not */ public boolean getRowSumsRight() { return ((WSBoolRecord) sheet.findFirstRecordBySid(WSBoolRecord.sid)) .getRowSumsRight(); } /** * Returns whether gridlines are printed. * @return Gridlines are printed */ public boolean isPrintGridlines() { return getSheet().getPrintGridlines().getPrintGridlines(); } /** * Turns on or off the printing of gridlines. * @param newPrintGridlines boolean to turn on or off the printing of * gridlines */ public void setPrintGridlines( boolean newPrintGridlines ) { getSheet().getPrintGridlines().setPrintGridlines( newPrintGridlines ); } /** * Gets the print setup object. * @return The user model for the print setup object. */ public HSSFPrintSetup getPrintSetup() { return new HSSFPrintSetup( getSheet().getPrintSetup() ); } /** * Gets the user model for the document header. * @return The Document header. */ public HSSFHeader getHeader() { return new HSSFHeader( getSheet().getHeader() ); } /** * Gets the user model for the document footer. * @return The Document footer. */ public HSSFFooter getFooter() { return new HSSFFooter( getSheet().getFooter() ); } /** * Sets whether sheet is selected. * @param sel Whether to select the sheet or deselect the sheet. */ public void setSelected( boolean sel ) { getSheet().setSelected( sel ); } /** * Gets the size of the margin in inches. * @param margin which margin to get * @return the size of the margin */ public double getMargin( short margin ) { return getSheet().getMargin( margin ); } /** * Sets the size of the margin in inches. * @param margin which margin to get * @param size the size of the margin */ public void setMargin( short margin, double size ) { getSheet().setMargin( margin, size ); } /** * Answer whether protection is enabled or disabled * @return true => protection enabled; false => protection disabled */ public boolean getProtect() { return getSheet().getProtect().getProtect(); } /** * Sets the protection on enabled or disabled * @param protect true => protection enabled; false => protection disabled */ public void setProtect(boolean protect) { getSheet().getProtect().setProtect(protect); } /** * Sets the zoom magnication for the sheet. The zoom is expressed as a * fraction. For example to express a zoom of 75% use 3 for the numerator * and 4 for the denominator. * * @param numerator The numerator for the zoom magnification. * @param denominator The denominator for the zoom magnification. */ public void setZoom( int numerator, int denominator) { if (numerator < 1 || numerator > 65535) throw new IllegalArgumentException("Numerator must be greater than 1 and less than 65536"); if (denominator < 1 || denominator > 65535) throw new IllegalArgumentException("Denominator must be greater than 1 and less than 65536"); SCLRecord sclRecord = new SCLRecord(); sclRecord.setNumerator((short)numerator); sclRecord.setDenominator((short)denominator); getSheet().setSCLRecord(sclRecord); } /** * The top row in the visible view when the sheet is * first viewed after opening it in a viewer * @return short indicating the rownum (0 based) of the top row */ public short getTopRow() { return sheet.getTopRow(); } /** * The left col in the visible view when the sheet is * first viewed after opening it in a viewer * @return short indicating the rownum (0 based) of the top row */ public short getLeftCol() { return sheet.getLeftCol();
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -