Java Code Examples for com.lowagie.text.Cell#setHeader()

The following examples show how to use com.lowagie.text.Cell#setHeader() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ElementFactory.java    From gcs with Mozilla Public License 2.0 5 votes vote down vote up
/**
 * Creates a Cell object based on a list of properties.
 * 
 * @param attributes
 * @return a Cell
 */
public static Cell getCell(Properties attributes) {
	Cell cell = new Cell();
	String value;

	cell.setHorizontalAlignment(attributes.getProperty(ElementTags.HORIZONTALALIGN));
	cell.setVerticalAlignment(attributes.getProperty(ElementTags.VERTICALALIGN));

	value = attributes.getProperty(ElementTags.WIDTH);
	if (value != null) {
		cell.setWidth(value);
	}
	value = attributes.getProperty(ElementTags.COLSPAN);
	if (value != null) {
		cell.setColspan(Integer.parseInt(value));
	}
	value = attributes.getProperty(ElementTags.ROWSPAN);
	if (value != null) {
		cell.setRowspan(Integer.parseInt(value));
	}
	value = attributes.getProperty(ElementTags.LEADING);
	if (value != null) {
		cell.setLeading(Float.parseFloat(value + "f"));
	}
	cell.setHeader(Utilities.checkTrueOrFalse(attributes, ElementTags.HEADER));
	if (Utilities.checkTrueOrFalse(attributes, ElementTags.NOWRAP)) {
		cell.setMaxLines(1);
	}
	setRectangleProperties(cell, attributes);
	return cell;
}
 
Example 2
Source File: ElementFactory.java    From itext2 with GNU Lesser General Public License v3.0 5 votes vote down vote up
/**
 * Creates a Cell object based on a list of properties.
 * @param attributes
 * @return a Cell
 */
public static Cell getCell(Properties attributes) {
	Cell cell = new Cell();
	String value;

	cell.setHorizontalAlignment(attributes
			.getProperty(ElementTags.HORIZONTALALIGN));
	cell.setVerticalAlignment(attributes
			.getProperty(ElementTags.VERTICALALIGN));

	value = attributes.getProperty(ElementTags.WIDTH);
	if (value != null) {
		cell.setWidth(value);
	}
	value = attributes.getProperty(ElementTags.COLSPAN);
	if (value != null) {
		cell.setColspan(Integer.parseInt(value));
	}
	value = attributes.getProperty(ElementTags.ROWSPAN);
	if (value != null) {
		cell.setRowspan(Integer.parseInt(value));
	}
	value = attributes.getProperty(ElementTags.LEADING);
	if (value != null) {
		cell.setLeading(Float.parseFloat(value + "f"));
	}
	cell.setHeader(Utilities.checkTrueOrFalse(attributes,
			ElementTags.HEADER));
	if (Utilities.checkTrueOrFalse(attributes, ElementTags.NOWRAP)) {
		cell.setMaxLines(1);
	}
	setRectangleProperties(cell, attributes);
	return cell;
}
 
Example 3
Source File: SpreadsheetDataFileWriterPdf.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
private Cell getHeaderCell(String headerTxt) throws BadElementException{
	//set header cells:								
	Cell c = new Cell(new Chunk(headerTxt, getBoldFont()));
	c.setHeader(true);
	c.setBackgroundColor(Color.LIGHT_GRAY);
	
	return c;
}
 
Example 4
Source File: Coversheet.java    From kfs with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * Helper method to create a Header Cell from text
 *
 * @returns {@link Cell} with the header flag set
 */
protected Cell getHeaderCell(final String text) throws BadElementException {
    final Font headerFont = FontFactory.getFont(FontFactory.HELVETICA, 12, Font.BOLD);
    final Cell retval = new Cell(new Chunk(text, headerFont));
    retval.setBorder(NO_BORDER);
    retval.setHeader(true);
    return retval;
}
 
Example 5
Source File: SpreadsheetDataFileWriterPdf.java    From sakai with Educational Community License v2.0 5 votes vote down vote up
private Cell getHeaderCell(String headerTxt) throws BadElementException{
	//set header cells:								
	Cell c = new Cell(new Chunk(headerTxt, getBoldFont()));
	c.setHeader(true);
	c.setBackgroundColor(Color.LIGHT_GRAY);
	
	return c;
}