Index: src/java/org/apache/poi/hssf/model/Sheet.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/model/Sheet.java,v retrieving revision 1.7 diff -u -b -w -r1.7 Sheet.java --- src/java/org/apache/poi/hssf/model/Sheet.java 30 Apr 2002 23:22:27 -0000 1.7 +++ src/java/org/apache/poi/hssf/model/Sheet.java 2 May 2002 02:55:16 -0000 @@ -86,6 +86,7 @@ * @author Glen Stampoultzis (glens at apache.org) * @see org.apache.poi.hssf.model.Workbook * @see org.apache.poi.hssf.usermodel.HSSFSheet + * @author Shawn Laubach (laubach at acm.org) Just Gridlines, Headers, Footers, and PrintSetup * @version 1.0-pre */ @@ -103,6 +104,10 @@ protected DefaultColWidthRecord defaultcolwidth = null; protected DefaultRowHeightRecord defaultrowheight = null; protected GridsetRecord gridset = null; + protected PrintSetupRecord printSetup = null; + protected HeaderRecord header = null; + protected FooterRecord footer = null; + protected PrintGridlinesRecord printGridlines = null; protected MergeCellsRecord merged = null; protected int mergedloc = 0; private static POILogger log = @@ -225,6 +230,23 @@ rec = null; } } + else if (rec.getSid () == PrintGridlinesRecord.sid) + { + retval.printGridlines = (PrintGridlinesRecord) rec; + } + else if (rec.getSid () == HeaderRecord.sid) + { + retval.header = (HeaderRecord) rec; + } + else if (rec.getSid () == FooterRecord.sid) + { + retval.footer = (FooterRecord) rec; + } + else if (rec.getSid () == PrintSetupRecord.sid) + { + retval.printSetup = (PrintSetupRecord) rec; + } + if (rec != null) { records.add(rec); @@ -275,7 +297,8 @@ records.add(retval.createDelta()); records.add(retval.createSaveRecalc()); records.add(retval.createPrintHeaders()); - records.add(retval.createPrintGridlines()); + retval.printGridlines = (PrintGridlinesRecord) retval.createPrintGridlines (); + records.add (retval.printGridlines); retval.gridset = ( GridsetRecord ) retval.createGridset(); records.add(retval.gridset); records.add(retval.createGuts()); @@ -283,11 +306,14 @@ ( DefaultRowHeightRecord ) retval.createDefaultRowHeight(); records.add(retval.defaultrowheight); records.add(retval.createWSBool()); - records.add(retval.createHeader()); - records.add(retval.createFooter()); + retval.header = (HeaderRecord) retval.createHeader (); + records.add (retval.header); + retval.footer = (FooterRecord) retval.createFooter (); + records.add (retval.footer); records.add(retval.createHCenter()); records.add(retval.createVCenter()); - records.add(retval.createPrintSetup()); + retval.printSetup = (PrintSetupRecord) retval.createPrintSetup (); + records.add (retval.printSetup); retval.defaultcolwidth = ( DefaultColWidthRecord ) retval.createDefaultColWidth(); records.add(retval.defaultcolwidth); @@ -1919,4 +1945,77 @@ } return null; } + + /** + * Returns the HeaderRecord. + * @return HeaderRecord for the sheet. + */ + public HeaderRecord getHeader () + { + return header; + } + + /** + * Sets the HeaderRecord. + * @param newHeader The new HeaderRecord for the sheet. + */ + public void setHeader (HeaderRecord newHeader) + { + header = newHeader; + } + + /** + * Returns the FooterRecord. + * @return FooterRecord for the sheet. + */ + public FooterRecord getFooter () + { + return footer; + } + + /** + * Sets the FooterRecord. + * @param newFooter The new FooterRecord for the sheet. + */ + public void setFooter (FooterRecord newFooter) + { + footer = newFooter; + } + + /** + * Returns the PrintSetupRecord. + * @return PrintSetupRecord for the sheet. + */ + public PrintSetupRecord getPrintSetup () + { + return printSetup; + } + + /** + * Sets the PrintSetupRecord. + * @param newPrintSetup The new PrintSetupRecord for the sheet. + */ + public void setPrintSetup (PrintSetupRecord newPrintSetup) + { + printSetup = newPrintSetup; + } + + /** + * Returns the PrintGridlinesRecord. + * @return PrintGridlinesRecord for the sheet. + */ + public PrintGridlinesRecord getPrintGridlines () + { + return printGridlines; + } + + /** + * Sets the PrintGridlinesRecord. + * @param newPrintGridlines The new PrintGridlinesRecord for the sheet. + */ + public void setPrintGridlines (PrintGridlinesRecord newPrintGridlines) + { + printGridlines = newPrintGridlines; + } + } Index: src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java =================================================================== RCS file: /home/cvspublic/jakarta-poi/src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java,v retrieving revision 1.6 diff -u -b -w -r1.6 HSSFSheet.java --- src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java 27 Apr 2002 01:48:26 -0000 1.6 +++ src/java/org/apache/poi/hssf/usermodel/HSSFSheet.java 2 May 2002 02:55:19 -0000 @@ -78,6 +78,7 @@ * @author Andrew C. Oliver (acoliver at apache dot org) * @author Glen Stampoultzis (glens at apache.org) * @author Libin Roman (romal at vistaportal.com) + * @author Shawn Laubach (laubach at acm.org) (Just a little) */ public class HSSFSheet @@ -738,5 +739,46 @@ { 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()); } }