Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

Adding Watermark to Excel

// Load the Excel file
Workbook workbook = new Workbook("Excel.xlsx");

// Get the first default sheet
Worksheet sheet = workbook.getWorksheets().get(0);

// Add watermark
Shape wordart = sheet.getShapes().addTextEffect(MsoPresetTextEffect.TEXT_EFFECT_1, "CONFIDENTIAL",
		"Arial Black", 50, false, true, 18, 8, 1, 1, 130, 800);

// Get the fill format of the word art
FillFormat wordArtFormat = wordart.getFill();

// Set the color
wordArtFormat.setOneColorGradient(Color.getRed(), 0.2, GradientStyleType.HORIZONTAL, 2);

// Set the transparency
wordArtFormat.setTransparency(0.9);

// Make the line invisible
wordart.setHasLine(false);

// Lock shape aspects
wordart.setLocked(true);
wordart.setLockedProperty(ShapeLockType.SELECTION, true);
wordart.setLockedProperty(ShapeLockType.SHAPE_TYPE, true);
wordart.setLockedProperty(ShapeLockType.MOVE, true);
wordart.setLockedProperty(ShapeLockType.RESIZE, true);
wordart.setLockedProperty(ShapeLockType.TEXT, true);

// Save the watermarked Excel file
workbook.save("output.xlsx");
Comment

PREVIOUS NEXT
Code Example
Java :: java to kotlin 
Java :: display hello world in android app 
Java :: java design patterns 
Java :: new int[] java 
Java :: splash full screen android 
Java :: new date api in java 8 
Java :: using super in java 
Java :: private access modifiers 
Java :: java long literal 
Java :: calling static method in java 
Java :: sum of array in java 
Java :: string cannot be resolved to a type eclipse 
Java :: java "-" 
Java :: java meeting scheduler 
Java :: java to python 
Java :: array 2 
Java :: java exception handling 
Java :: java disable stack trace 
Java :: android pick up photo from local device 
Java :: Java extends and implements clause 
Java :: AccountDriver.java 
Java :: how to make bidirectional fromated binding 
Java :: destroy fragent after navigating 
Java :: how to send int value from one actvi to another in android 
Java :: springBoot Register a Custom Auto-Configuration 
Java :: java mongodb document get 
Java :: Java HashMap Class Declaration 
Java :: final private vs private final 
Java :: split the argument String and add the tokens into a list 
Java :: Caused by: java.sql.SQLSyntaxErrorException: ORA-00904: "EXCEPTION": invalid identifier 
ADD CONTENT
Topic
Content
Source link
Name
8+1 =