private List<RecordBase> _records;
protected PrintGridlinesRecord printGridlines = null;
+ protected PrintHeadersRecord printHeaders = null;
protected GridsetRecord gridset = null;
private GutsRecord _gutsRecord;
protected DefaultColWidthRecord defaultcolwidth = new DefaultColWidthRecord();
{
printGridlines = (PrintGridlinesRecord) rec;
}
+ else if ( recSid == PrintHeadersRecord.sid )
+ {
+ printHeaders = (PrintHeadersRecord) rec;
+ }
else if ( recSid == GridsetRecord.sid )
{
gridset = (GridsetRecord) rec;
records.add(createIteration() );
records.add(createDelta() );
records.add(createSaveRecalc() );
- records.add(createPrintHeaders() );
+ printHeaders = createPrintHeaders();
+ records.add(printHeaders);
printGridlines = createPrintGridlines();
records.add( printGridlines );
gridset = createGridset();
{
printGridlines = newPrintGridlines;
}
+
+ /**
+ * Returns the PrintHeadersRecord.
+ * @return PrintHeadersRecord for the sheet.
+ */
+ public PrintHeadersRecord getPrintHeaders()
+ {
+ return printHeaders;
+ }
+
+ /**
+ * Sets the PrintHeadersRecord.
+ * @param newPrintHeaders The new PrintHeadersRecord for the sheet.
+ */
+ public void setPrintHeaders(PrintHeadersRecord newPrintHeaders)
+ {
+ printHeaders = newPrintHeaders;
+ }
/**
* Sets whether the sheet is selected
public boolean isDisplayRowColHeadings() {
return windowTwo.getDisplayRowColHeadings();
}
+
+ /**
+ * Sets whether the RowColHeadings are shown in a viewer.
+ * @param show whether to show RowColHeadings or not
+ */
+ public void setPrintRowColHeadings(boolean show) {
+ windowTwo.setDisplayRowColHeadings(show);
+ }
+
+ /**
+ * Returns if RowColHeadings are displayed.
+ * @return whether RowColHeadings are displayed
+ */
+ public boolean isPrintRowColHeadings() {
+ return windowTwo.getDisplayRowColHeadings();
+ }
/**
/**
* Turns on or off the printing of gridlines.
*
- * @param newPrintGridlines boolean to turn on or off the printing of
+ * @param show boolean to turn on or off the printing of
* gridlines
*/
@Override
- public void setPrintGridlines(boolean newPrintGridlines) {
- getSheet().getPrintGridlines().setPrintGridlines(newPrintGridlines);
+ public void setPrintGridlines(boolean show) {
+ getSheet().getPrintGridlines().setPrintGridlines(show);
+ }
+
+ /**
+ * Returns whether row and column headings are printed.
+ *
+ * @return row and column headings are printed
+ */
+ @Override
+ public boolean isPrintRowAndColumnHeadings() {
+ return getSheet().getPrintHeaders().getPrintHeaders();
+ }
+
+ /**
+ * Turns on or off the printing of row and column headings.
+ *
+ * @param show boolean to turn on or off the printing of
+ * row and column headings
+ */
+ @Override
+ public void setPrintRowAndColumnHeadings(boolean show) {
+ getSheet().getPrintHeaders().setPrintHeaders(show);
}
/**
* Gets the flag indicating whether this sheet displays the lines
* between rows and columns to make editing and reading easier.
*
- * @return <code>true</code> if this sheet displays gridlines.
- * @see #isPrintGridlines() to check if printing of gridlines is turned on or off
+ * @return <code>true</code> if this sheet prints gridlines.
+ * @see #isDisplayGridlines() to check if gridlines are displayed on screen
*/
boolean isPrintGridlines();
/**
- * Sets the flag indicating whether this sheet should display the lines
+ * Sets the flag indicating whether this sheet should print the lines
* between rows and columns to make editing and reading easier.
- * To turn printing of gridlines use {@link #setPrintGridlines(boolean)}
*
- *
- * @param show <code>true</code> if this sheet should display gridlines.
- * @see #setPrintGridlines(boolean)
+ * @param show <code>true</code> if this sheet should print gridlines.
+ * @see #setDisplayGridlines(boolean) to display gridlines on screen
*/
void setPrintGridlines(boolean show);
+
+ /**
+ * Gets the flag indicating whether this sheet prints the
+ * row and column headings when printing.
+ *
+ * @return <code>true</code> if this sheet prints row and column headings.
+ */
+ boolean isPrintRowAndColumnHeadings();
+
+ /**
+ * Sets the flag indicating whether this sheet should print
+ * row and columns headings when printing.
+ *
+ * @param show <code>true</code> if this sheet should print row and column headings.
+ */
+ void setPrintRowAndColumnHeadings(boolean show);
/**
* Gets the print setup object.
}
/**
- * Gets the flag indicating whether this sheet displays the lines
- * between rows and columns to make editing and reading easier.
+ * Returns whether gridlines are printed.
*
- * @return <code>true</code> if this sheet displays gridlines.
- * @see #isPrintGridlines() to check if printing of gridlines is turned on or off
+ * @return whether gridlines are printed
*/
@Override
public boolean isPrintGridlines()
}
/**
- * Sets the flag indicating whether this sheet should display the lines
- * between rows and columns to make editing and reading easier.
- * To turn printing of gridlines use {@link #setPrintGridlines(boolean)}
+ * Turns on or off the printing of gridlines.
*
- *
- * @param show <code>true</code> if this sheet should display gridlines.
- * @see #setPrintGridlines(boolean)
+ * @param show boolean to turn on or off the printing of gridlines
*/
@Override
public void setPrintGridlines(boolean show)
{
_sh.setPrintGridlines(show);
}
+
+ /**
+ * Returns whether row and column headings are printed.
+ *
+ * @return whether row and column headings are printed
+ */
+ @Override
+ public boolean isPrintRowAndColumnHeadings()
+ {
+ return _sh.isPrintRowAndColumnHeadings();
+ }
+
+ /**
+ * Turns on or off the printing of row and column headings.
+ *
+ * @param show boolean to turn on or off the printing of row and column headings
+ */
+ @Override
+ public void setPrintRowAndColumnHeadings(boolean show)
+ {
+ _sh.setPrintRowAndColumnHeadings(show);
+ }
/**
* Gets the print setup object.
worksheet.getPrintOptions() : worksheet.addNewPrintOptions();
opts.setGridLines(value);
}
+
+ /**
+ * Returns whether row and column headings are printed.
+ *
+ * @return whether row and column headings are printed
+ */
+ @Override
+ public boolean isPrintRowAndColumnHeadings() {
+ CTPrintOptions opts = worksheet.getPrintOptions();
+ return opts != null && opts.getHeadings();
+ }
+
+ /**
+ * Turns on or off the printing of row and column headings.
+ *
+ * @param value boolean to turn on or off the printing of row and column headings
+ */
+ @Override
+ public void setPrintRowAndColumnHeadings(boolean value) {
+ CTPrintOptions opts = worksheet.isSetPrintOptions() ?
+ worksheet.getPrintOptions() : worksheet.addNewPrintOptions();
+ opts.setHeadings(value);
+ }
/**
* Tests if there is a page break at the indicated row
}
/**
- * Test basic display properties
+ * Test basic display and print properties
*/
@Test
public void sheetProperties() throws IOException {
assertFalse(sheet.isPrintGridlines());
sheet.setPrintGridlines(true);
assertTrue(sheet.isPrintGridlines());
+
+ assertFalse(sheet.isPrintRowAndColumnHeadings());
+ sheet.setPrintRowAndColumnHeadings(true);
+ assertTrue(sheet.isPrintRowAndColumnHeadings());
assertFalse(sheet.isDisplayFormulas());
sheet.setDisplayFormulas(true);