Best SeLion code snippet using com.paypal.selion.internal.reports.excelreport.Styles.createCustomFont
Source:Styles.java
...36 style.setAlignment(alignment[0]);37 }38 return style;39 }40 private static HSSFFont createCustomFont(short colorIndex, Byte underlineWeight) {41 HSSFFont font = wb1.createFont();42 font.setFontName(HSSFFont.FONT_ARIAL);43 font.setFontHeightInPoints((short) 10);44 font.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);45 font.setColor(colorIndex);46 font.setUnderline(underlineWeight);47 return font;48 }49 private static HSSFCellStyle setAllBorders(short borderWeight, HSSFCellStyle existingStyle) {50 existingStyle.setBorderBottom(borderWeight);51 existingStyle.setBorderTop(borderWeight);52 existingStyle.setBorderLeft(borderWeight);53 existingStyle.setBorderRight(borderWeight);54 return existingStyle;55 }56 public static void initStyles(HSSFWorkbook wb) {57 wb1 = wb;58 setHeadingStyle(createCustomStyle(createCustomFont(HSSFColor.LEMON_CHIFFON.index, HSSFFont.U_NONE),59 HSSFCellStyle.ALIGN_CENTER));60 getHeadingStyle().setFillPattern(HSSFCellStyle.SOLID_FOREGROUND);61 getHeadingStyle().setFillForegroundColor(new HSSFColor.BLUE_GREY().getIndex());62 setHeadingStyle(setAllBorders(HSSFCellStyle.BORDER_DOUBLE, getHeadingStyle()));63 subHeading1Style = createCustomStyle(createCustomFont(HSSFColor.LIGHT_BLUE.index, HSSFFont.U_NONE));64 subHeading1Style = setAllBorders(HSSFCellStyle.BORDER_THIN, subHeading1Style);65 setSubHeading2Style(createCustomStyle(createCustomFont(HSSFColor.BROWN.index, HSSFFont.U_NONE),66 HSSFCellStyle.ALIGN_CENTER));67 setSubHeading2Style(setAllBorders(HSSFCellStyle.BORDER_MEDIUM, getSubHeading2Style()));68 setSubHeading2StyleThinBorder(createCustomStyle(createCustomFont(HSSFColor.BROWN.index, HSSFFont.U_NONE),69 HSSFCellStyle.ALIGN_LEFT));70 setSubHeading2StyleThinBorder(setAllBorders(HSSFCellStyle.BORDER_THIN, getSubHeading2StyleThinBorder()));71 setThinBorderStyle(wb.createCellStyle());72 setThinBorderStyle(setAllBorders(HSSFCellStyle.BORDER_THIN, getThinBorderStyle()));73 setStyleBorderThinCenter(wb.createCellStyle());74 setStyleBorderThinCenter(setAllBorders(HSSFCellStyle.BORDER_THIN, getStyleBorderThinCenter()));75 getStyleBorderThinCenter().setAlignment(HSSFCellStyle.ALIGN_CENTER);76 setStyleBorderThinLeftTop(wb.createCellStyle());77 setStyleBorderThinLeftTop(setAllBorders(HSSFCellStyle.BORDER_THIN, getStyleBorderThinLeftTop()));78 getStyleBorderThinLeftTop().setAlignment(HSSFCellStyle.ALIGN_LEFT);79 getStyleBorderThinLeftTop().setVerticalAlignment(HSSFCellStyle.VERTICAL_TOP);80 setHyperLinkStyle(wb.createCellStyle());81 setHyperLinkStyle(setAllBorders(HSSFCellStyle.BORDER_THIN, getHyperLinkStyle()));82 HSSFFont hyperLinkFont = createCustomFont(HSSFColor.BLUE.index, HSSFFont.U_SINGLE);83 hyperLinkFont.setBoldweight(HSSFFont.BOLDWEIGHT_NORMAL);84 getHyperLinkStyle().setFont(hyperLinkFont);85 }86 public static HSSFCellStyle getHeadingStyle() {87 return headingStyle;88 }89 private static void setHeadingStyle(HSSFCellStyle headingStyle) {90 Styles.headingStyle = headingStyle;91 }92 public static HSSFCellStyle getSubHeading2Style() {93 return subHeading2Style;94 }95 private static void setSubHeading2Style(HSSFCellStyle subHeading2Style) {96 Styles.subHeading2Style = subHeading2Style;...
createCustomFont
Using AI Code Generation
1import com.paypal.selion.internal.reports.excelreport.Styles;2import com.paypal.selion.internal.reports.excelreport.Styles.FontType;3public class CustomFont {4 public static void main(String[] args) {5 Styles.createCustomFont("CustomFont", FontType.BOLD, 12, "Arial", IndexedColors.RED);6 }7}
createCustomFont
Using AI Code Generation
1Font font = Styles.createCustomFont("Arial", 10, true, false, false, IndexedColors.BLACK.index);2style.setFont(font);3style.setBorder(BorderStyle.THIN, BorderStyle.THIN, BorderStyle.THIN, BorderStyle.THIN);4style.setFill(IndexedColors.WHITE.index);5style.setAlignment(HorizontalAlignment.CENTER);6style.setWrapText(true);
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!