Add watermark in Diagonal and with RED FONT into xlsx file

Hello. I’m trying to add watermark to each sheet of xls(x) file. Currently, my code does this, but alwais in black font and also in the center of the page. I want it to be red and from in diagonal from bottom to top.
What should i change in my code?
try {
Workbook wb = new Workbook(filePath);
Iterator it = wb.getWorksheets().iterator();
while(it.hasNext()) {
Worksheet sheet = (Worksheet);
Shape wordart = sheet.getShapes().addTextEffect(MsoPresetTextEffect.TEXT_EFFECT_1, text, “Arial Red”, 50, false, true, 18, 8, 1, 1, 130, 800);
FillFormat wordArtFormat = wordart.getFill();
wordArtFormat.setOneColorGradient(Color.getRed(), 0.2, GradientStyleType.DIAGONAL_UP, 2);
LineFormat lineFormat = wordart.getLine();
return true;
} catch (Exception e) {
return false;


You may set the rotation angle to set it to diagonal style. Moreover, there is no font with name “Arial Red”. Please try the following sample code for your task. Please refer to it and then you may update it accordingly.
Sample code:

        // Instantiate a new Workbook
        Workbook workbook = new Workbook();

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

        // Add Watermark
        com.aspose.cells.Shape wordart = sheet.getShapes().addTextEffect(MsoPresetTextEffect.TEXT_EFFECT_1, "CONFIDENTIAL",
                "Arial", 60, false, true,24,8, 3, 4, 120, 700);

        //Set rotation angle

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

        // Set the color

        // Set the transparency

        // Make the line invisible
        LineFormat lineFormat = wordart.getLine();

        // Save the file"f:\\files\\WordArtToWorksheet_out1.xlsx");

Hope, this helps a bit.


It has helped. I have just changed a few things, but it is working as expected now. Thank you!


Good to know that the updated code segment works for your needs. Feel free to write us back if you have further queries or comments.