Hi Team,
I am using Aspose.Cells for adding watermark to excel file.
Description: Before adding watermark, all excel cells were accessible through mouse click but after adding watermark, cells covering watermark text area are not accessible through mouse click. I can only access them using arrow keys.
Codeblock:
public void addWatermark(Worksheet sheet)
{
com.aspose.cells.Shape wordart = sheet.getShapes().addTextEffect(MsoPresetTextEffect.TEXT_EFFECT_1,“This is a Watermark”, “Arial Black”, 30, false, true, 4, 8, 4, 1, 60, 500);
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);
MsoFillFormat wordArtFormat = wordart.getFillFormat();
wordArtFormat.setForeColor(Color.getRed());
wordArtFormat.setTransparency(0.9);
MsoLineFormat lineFormat = wordart.getLineFormat();
lineFormat.setVisible(false);
}
Any suggestions in this regards would be really helpful.
Thanks.
@ranipatil,
This is not an issue rather it is due to your lines of code and word art shape type area. The word art shape occupies certain area, i.e., “E5:L8” range of cells (approx.). In short, you have to use arrow keys to write into those cells accordingly. For confirmation, you may change the following lines to following to know which area the watermark (word art) shape occupies:
e.g.
Sample code:
wordart.setLockedProperty(ShapeLockType.SELECTION, false);
wordart.setLockedProperty(ShapeLockType.SHAPE_TYPE, false);
Let us know if you still have any confusion or issue.
@Amjad_Sahi
Hi Amjad, thanks for the info.
I set those props to prevent changing watermark.
I see that watermark added is above the cells and thats why those particular cells are not accessible through mouse click.
Is there any way to send this watermark behind the cells ?
@ranipatil,
This is the behavior of MS Excel for word art shapes and nothing to do with Aspose.Cells. In MS Excel, I do not see “Send to Back” property for word art shapes, so this might not be supported by Aspose.Cells. However, if you could accomplish the task in MS Excel manually for word art shapes, kindly do let us know with steps details and sample Excel file, we will check on how to do it via Aspose.Cells APIs.
PS. please zip the file prior attaching here.