Hello,
Hi,
Thanks for your posting and using Aspose.Cells for Java
Yes, it is quite possible to add a watermark in both xls and xlsx files using Aspose.Cells for Java.
Please see the code below, it adds a watermark CONFIDENTIAL in a worksheet.
Please download and use the latest version: Aspose.Cells
for Java v7.2.0.6
I have also attached the output file generated by the code and the screenshot.
Java
// Add Watermark
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);
com.aspose.cells.Shape wordart = sheet.getShapes().addTextEffect(MsoPresetTextEffect.TEXT_EFFECT_1,
“CONFIDENTIAL”, “Arial Black”, 50, false, true
, 18, 8, 1, 1, 130, 800);
MsoFillFormat wordArtFormat = wordart.getFillFormat();
wordArtFormat.setForeColor(Color.getRed());
wordArtFormat.setTransparency(0.9);
MsoLineFormat lineFormat = wordart.getLineFormat();
lineFormat.setVisible(false);
workbook.save(“F:\output.xls”);
Documents:
PS: We have also added the similar article (as .NET) into Aspose.Cells for Java documentation, please see the document for your reference:
Screenshot:
Hello,
Hi,
I have checked the above code with the latest version:
Aspose.Cells for Java 7.2.1
and I am able to add the watermark in xlsx format.
Please see the attached output.xlsx file.
Java
// Add Watermark
Workbook workbook = new Workbook();
Worksheet sheet = workbook.getWorksheets().get(0);
com.aspose.cells.Shape wordart = sheet.getShapes().addTextEffect(MsoPresetTextEffect.TEXT_EFFECT_1,
“CONFIDENTIAL”, “Arial Black”, 50, false, true
, 18, 8, 1, 1, 130, 800);
MsoFillFormat wordArtFormat = wordart.getFillFormat();
wordArtFormat.setForeColor(Color.getRed());
wordArtFormat.setTransparency(0.9);
MsoLineFormat lineFormat = wordart.getLineFormat();
lineFormat.setVisible(false);
workbook.save(“F:\Shak-Data-RW\Downloads\output.xlsx”);
Hi Shakeel,
Hi,
Thanks for your feedback.
It’s good to know that latest version resolves this issue.
Let us know if you still face any other issue relating to Aspose.Cells, we will be glad to help you.