<!-- Don't forget to update status.xml too! -->
<release version="3.1.1-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="add">45623 - Support for additional HSSF header and footer fields, including bold and full file path</action>
<action dev="POI-DEVELOPERS" type="add">45623 - Support stripping HSSF header and footer fields (eg page number) out of header and footer text if required</action>
<action dev="POI-DEVELOPERS" type="add">45622 - Support stripping HWPF fields (eg macros) out of text, via Range.stripFields(text)</action>
<action dev="POI-DEVELOPERS" type="add">New HPSF based TextExtractor for document metadata, org.apache.poi.hpsf.extractor.HPSFPropertiesExtractor</action>
<!-- Don't forget to update changes.xml too! -->
<changes>
<release version="3.1.1-alpha1" date="2008-??-??">
+ <action dev="POI-DEVELOPERS" type="add">45623 - Support for additional HSSF header and footer fields, including bold and full file path</action>
<action dev="POI-DEVELOPERS" type="add">45623 - Support stripping HSSF header and footer fields (eg page number) out of header and footer text if required</action>
<action dev="POI-DEVELOPERS" type="add">45622 - Support stripping HWPF fields (eg macros) out of text, via Range.stripFields(text)</action>
<action dev="POI-DEVELOPERS" type="add">New HPSF based TextExtractor for document metadata, org.apache.poi.hpsf.extractor.HPSFPropertiesExtractor</action>
* Returns the string that represents the change in font.
*
* @param font the new font
- * @param style the fonts style
+ * @param style the fonts style, one of regular, italic, bold, italic bold or bold italic
* @return The special string to represent a new font size
*/
public static String font( String font, String style )
* @return The special string for tab name
*/
public static String tab() {
- return TAB_FIELD.sequence;
+ return SHEET_NAME_FIELD.sequence;
+ }
+
+ /**
+ * Returns the string representing the start bold
+ *
+ * @return The special string for start bold
+ */
+ public static String startBold() {
+ return BOLD_FIELD.sequence;
+ }
+
+ /**
+ * Returns the string representing the end bold
+ *
+ * @return The special string for end bold
+ */
+ public static String endBold() {
+ return BOLD_FIELD.sequence;
}
/**
}
- public static final Field TAB_FIELD = new Field("&A");
+ public static final Field SHEET_NAME_FIELD = new Field("&A");
public static final Field DATE_FIELD = new Field("&D");
public static final Field FILE_FIELD = new Field("&F");
+ public static final Field FULL_FILE_FIELD = new Field("&Z");
public static final Field PAGE_FIELD = new Field("&P");
public static final Field TIME_FIELD = new Field("&T");
public static final Field NUM_PAGES_FIELD = new Field("&N");
- public static final Field UNDERLINE_FIELD = new Field("&U");
- public static final Field DOUBLE_UNDERLINE_FIELD = new Field("&E");
+
+ public static final Field PICTURE_FIELD = new Field("&P");
+
+ public static final PairField BOLD_FIELD = new PairField("&B"); // PAID
+ public static final PairField ITALIC_FIELD = new PairField("&I");
+ public static final PairField STRIKETHROUGH_FIELD = new PairField("&S");
+ public static final PairField SUBSCRIPT_FIELD = new PairField("&Y");
+ public static final PairField SUPERSCRIPT_FIELD = new PairField("&X");
+ public static final PairField UNDERLINE_FIELD = new PairField("&U");
+ public static final PairField DOUBLE_UNDERLINE_FIELD = new PairField("&E");
/**
* Represents a special field in a header or footer,
ALL_FIELDS.add(this);
}
}
+ /**
+ * A special field that normally comes in a pair, eg
+ * turn on underline / turn off underline
+ */
+ public static class PairField extends Field {
+ private PairField(String sequence) {
+ super(sequence);
+ }
+ }
}
String withPage = "I am a&P test header";
String withLots = "I&A am&N a&P test&T header&U";
String withFont = "I&22 am a&\"Arial,bold\" test header";
- String withOtherAnds = "I am a&P test header&Z";
+ String withOtherAnds = "I am a&P test header&&";
+ String withOtherAnds2 = "I am a&P test header&a&b";
assertEquals(simple, HSSFHeader.stripFields(simple));
assertEquals(simple, HSSFHeader.stripFields(withPage));
assertEquals(simple, HSSFHeader.stripFields(withLots));
assertEquals(simple, HSSFHeader.stripFields(withFont));
- assertEquals(simple + "&Z", HSSFHeader.stripFields(withOtherAnds));
+ assertEquals(simple + "&&", HSSFHeader.stripFields(withOtherAnds));
+ assertEquals(simple + "&a&b", HSSFHeader.stripFields(withOtherAnds2));
// Now test the default strip flag
HSSFWorkbook wb = HSSFTestDataSamples.openSampleWorkbook("EmbeddedChartHeaderTest.xls");
head.setAreFieldsStripped(true);
assertEquals("Top Left", head.getLeft());
assertTrue(head.areFieldsStripped());
+
+ // Now even more complex
+ head.setCenter("HEADER TEXT &P&N&D&T&Z&F&F&A&G");
+ assertEquals("HEADER TEXT &G", head.getCenter());
}
/**