Skip to main content

Basic object detection in python using OpenCv and Numpy - by Dustbiin

Styling the excel sheet data like font size, color, font family, and text alignment - by Dustbiin

Apache poi provide very powerful fetcher for data formation and changing the color, size and font family-



Create workspace and sheet-

XSSFWorkbook workBook = new XSSFWorkbook();
Sheet sheet = workBook.createSheet("My sheet");

Create Font object and set font styling-

Font font = workbook.createFont();
font.setBold( true );
font.setFontHeight( (short) ( 25 * 10 ) );
// set font family
font.setFontName("Courier New");
// set font color
font.setColor( IndexedColors.WHITE.getIndex() );

Create CellStyle object and set alignment of data in cell and set font to the data-

CellStyle cellStyle = new CellStyle();
cellStyle.setFont(font);
// use when you want to wrap text in multipal line
cellStyle.setWrapText(true);

Create Row and Cell and set cellStyle for the cell data-

XSSFRow row = sheet.createRow( 1 );
Cell cell = row.createCell(1);
cell.setCellValue("Hello World");
cell.setCellStyle(cellStyle);

Comments

Popular posts from this blog

Custom cell color in Excel Apache POI - By Dustbiin

Create custom color for cell background by using java color class Create custom color- XSSFWorkbook workBook = new XSSFWorkbook (); IndexedColorMap colorMap = workbook.getStylesSource().getIndexedColors(); Font tableHeadOneFontStyle = workbook.createFont();  tableHeadOneFontStyle.setBold( true ); tableHeadOneFontStyle.setColor( IndexedColors.BLACK.getIndex() ); XSSFCellStyle tableHeaderOneColOneStyle = workbook.createCellStyle(); tableHeaderOneColOneStyle.setFont( tableHeadOneFontStyle ); tableHeaderOneColOneStyle.setFillForegroundColor( new XSSFColor( new java.awt.Color( 255, 231, 153 ), colorMap ) ); tableHeaderOneColOneStyle.setFillPattern( FillPatternType.SOLID_FOREGROUND ); tableHeaderOneColOneStyle = setLeftRightBorderColor( tableHeaderOneColOneStyle ); tableHeaderOneColOneStyle = alignCenter( tableHeaderOneColOneStyle );

Create Digital signature field in iText Pdf - by Dustbiin

 Creating signature field in iText PDF -  First need to add dependency  <dependency> <groupId>com.itextpdf.tool</groupId> <artifactId>xmlworker</artifactId> <version>5.4.5</version> </dependency> <dependency> <groupId>com.itextpdf</groupId> <artifactId>itextpdf</artifactId> <version>5.4.5</version> </dependency> <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcprov-jdk15on</artifactId> <version>1.60</version> </dependency> <dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcpkix-jdk15on</artifactId> <version>1.60</version> <type>jar</type> <!-- <scope>compile</scope> <optional>true</optional> --> </dependency> For certified you pdf document by digital sign first you need to...

Create design by connecting dot's using opencv and numpy - by Dustbiin

Create basic design by using connecting dot's using your mouse- I have been create this by using mouse event check out the code below- use Python, OpenCv , NumPy import numpy as np import cv2 def click_event(event , x , y , flags , param): if event == cv2.EVENT_LBUTTONDOWN: print(x , " , " , y) font = cv2.FONT_HERSHEY_SIMPLEX strXY = str(x) + ' , ' + str(y) # cv2.putText(img,strXY, (x, y), font, .1, (255, 255, 0), 2) cv2.circle(img , (x , y) , 3 , ( 0 , 0 , 255 ) , - 1 ) points.append((x , y)) if len(points) >= 2 : cv2.circle(img , points[- 1 ] , 3 , ( 0 , 0 , 255 ) , - 1 ) # cv2.putText(img,strXY, points[-1], font, .1, (255, 255, 0), 2) cv2.line(img , points[- 2 ] , points[- 1 ] , ( 0 , 0 , 255 ) , 1 ) cv2.imshow( "Image" , img) points = [] img = np.zeros(( 512 , 512 , 3 )) cv2.imshow( "Image" , img) cv2.setMouseCallback( 'Image' ...