Shawn's patch

PR:
Obtained from:
Submitted by:
Reviewed by:


git-svn-id: https://svn.apache.org/repos/asf/jakarta/poi/trunk@352592 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Andrew C. Oliver 2002-05-03 04:55:07 +00:00
parent e0f12e5e84
commit 92ad59a0ab
2 changed files with 145 additions and 4 deletions

View File

@ -86,6 +86,7 @@ import org.apache.poi.hssf.record
* @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 @@ public class Sheet
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 @@ public class Sheet
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 @@ public class Sheet
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 @@ public class Sheet
( 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 @@ public class Sheet
}
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;
}
}

View File

@ -78,6 +78,7 @@ import java.util.TreeMap;
* @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
@ -739,4 +740,45 @@ public class HSSFSheet
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());
}
}