How to Add a Watermark Above the Text or Image into a Excel Document?

Now I have the same problem with excel watermark, I want to add watermark on the text and image, and fill the excel with watermark, not art word form, because art word can be deleted at will. Please help me again!
1、input excel and output excel in (17.0 KB)
2、here’s my code (1.5 KB)
3、Aspose.cells version is 22.6.0image.png (1.6 KB)
4、windows 10

@good_luck I moved your question into Aspose.Cells forum. My colleagues from Aspose.Cells team will help you shortly.


Thanks for the sample files.

Aspose.Cells follows MS Excel standards and specifications when setting background image for the sheet. Please note the background image won’t set to front on the image/text or shading color of the cells. This is same with MS Excel, you can perform the task in MS Excel and you will notice the same behavior. If you still think your desired task can be done in MS Excel manually, kindly do provide a sample Excel file containing the background set as per your needs. We will check it soon.

I think for your needs you may try to add wordart watermark to the sheet, you can do certain locking aspects of the watermark so that the user interaction could be limited or completely blocked. See the document with example code for your reference.

I have tried this, added art word watermark, and the locks that should be set are all set, but opening the file can still modify the watermark content, location, and even delete.
1、input file and output file in (17.0 KB)
2、here’s my code (938 Bytes)

  • The others are the same as those introduced above

Could you post you excepted result file here? We will check it soon.

This is the response.xls file in the (9.0 KB)

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): CELLSJAVA-45204

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.

So there’s a problem with your API? Is there any other way to generate the watermark I want?

We have found that the output result of aspose is not consistent with your expected result. We need further research to determine the issue. We will notify you as soon as there is any update.

After our research, we found that the output is different from your expected file because there is a problem with the font setting in the code. Please refer to the code and you will get the desired result.

Workbook book = new Workbook(filePath + "in.xlsx");
        WorksheetCollection worksheets = book.getWorksheets();
        for(int i = 0; i < worksheets.getCount(); i++) {
            Worksheet worksheet = worksheets.get(i);
            Shape shape = worksheet.getShapes().
            FillFormat shapeFill = shape.getFill();
             com.aspose.cells.Color color = com.aspose.cells.Color.fromArgb(210, 210,210);
            shapeFill.setOneColorGradient(color, 1, GradientStyleType.HORIZONTAL, 1);
            LineFormat lineFormat = shape.getLine();
        + "out_java.xlsx");

can you try it?


When I run the code in the post and open the generated result file in Excel 2016, I cannot delete the watermark. Do you open the file with other software (such as WPS)?



Aspose.Cells follows MS-Excel rules, so the generated files should be viewed in Excel. If you open it with other software, you may encounter some small issues. If you have any other questions, please feel free to contact us.