List of usage examples for com.lowagie.text Phrase add
public void add(int index, Object o)
Chunk
, an Anchor
or another Phrase
to this Phrase
. From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addHeaderCellFirstBold(String strCaption, int iColspan, boolean bColor, int iSize, int iSecondSize) throws BadElementException { Font firstFont = null;/*from w ww.j a va2s . c om*/ Font secondFont = null; switch (iSize) { case 8: firstFont = REPORT_SETTINGS.ftTableHeader8B; break; case 9: firstFont = REPORT_SETTINGS.ftTableHeader9B; break; case 12: firstFont = REPORT_SETTINGS.ftTableHeader12B; break; default: firstFont = REPORT_SETTINGS.ftTableHeaderB; break; } switch (iSecondSize) { case 8: secondFont = REPORT_SETTINGS.ftTableHeader8; break; case 9: secondFont = REPORT_SETTINGS.ftTableHeader9; break; case 12: secondFont = REPORT_SETTINGS.ftTableHeader12; break; default: secondFont = REPORT_SETTINGS.ftTableHeader; break; } String firstChar = (StringManager.isNotEmpty(strCaption) ? String.valueOf(strCaption.charAt(0)) : ""); String otherPart = (StringManager.isNotEmpty(strCaption) ? strCaption.substring(1, strCaption.length()) : ""); Chunk firstCharChunk = new Chunk(firstChar, firstFont); Phrase str = new Phrase(otherPart, secondFont); str.add(0, firstCharChunk); Cell cl = new Cell(str); if (bColor) { cl.setBackgroundColor(REPORT_SETTINGS.clTableHeader); } cl.setColspan(iColspan); this.addCell(cl); }
From source file:s2s.report.MiddleTable.java
License:GNU General Public License
public void addCellFirstLineBold(String strCaption, int iColspan, int iSize, int iSecondSize) throws BadElementException { Font firstFont = null;//from www .j a va2 s . c o m Font secondFont = null; switch (iSize) { case 8: firstFont = REPORT_SETTINGS.ftText8B; break; case 9: firstFont = REPORT_SETTINGS.ftText9B; break; default: firstFont = REPORT_SETTINGS.ftText12B; break; } switch (iSecondSize) { case 8: secondFont = REPORT_SETTINGS.ftText8; break; case 9: secondFont = REPORT_SETTINGS.ftText9; break; default: secondFont = REPORT_SETTINGS.ftText12; break; } String newLineChar = "\n"; String firstPart = StringManager.isNotEmpty(strCaption) ? strCaption.substring(0, strCaption.indexOf(newLineChar) + newLineChar.length()) : ""; String otherPart = StringManager.isNotEmpty(strCaption) ? strCaption.substring(firstPart.length()) : ""; Chunk firstCharChunk = new Chunk(firstPart, firstFont); Phrase str = new Phrase(otherPart, secondFont); str.add(0, firstCharChunk); Cell cl = new Cell(str); cl.setColspan(iColspan); this.addCell(cl); }