Watermark overlapping in Excel in footer using Aspose Cells for Java API

Hi
The watermark is overlapping in Excel in the footer using Aspose Cells for Java API.

It is not allowing to upload sample xls file It is a Excel 97 document.

How to share the same?

private boolean watermarkTextExcelFile (File excelFile, String watermarkText, String fileSuffix, String outputDirectory) throws Exception {

	boolean watermarkedFile = false;

	String fileName = "";
	try {

		fileName = excelFile.getName();
		String filePath = excelFile.getPath();
		String fileExtension = ".xlsx";
		if (!fileName.endsWith(".xlsx")) {
			fileExtension = ".xls";
		}

		//to apply license
	//	com.aspose.cells.License license = new com.aspose.cells.License();
	//	license.setLicense("Aspose.Total.Java.lic");
		String fileNameWithOutExt = FilenameUtils.removeExtension(fileName);

		// Load the Excel file
		Workbook workbook = new Workbook(filePath);

		//WorksheetCollection worksheets = workbook.getWorksheets();
		int worksheetCount = 100;
		for (int i = 0; i < worksheetCount; i++) {

			// Get the first default sheet
			Worksheet sheet = null;

			try {
				sheet = workbook.getWorksheets().get(i);
			}
			catch (Exception ex) {
				//	logger.error("watermarkTextExcelFile load sheet ex:" + ex.getMessage());
				errlog.error("watermarkTextExcelFile load sheet ex:" + ex.getMessage() + ": " + fileName);

			}

			if(sheet != null) {
				PageSetup pageSetup = sheet.getPageSetup();
				pageSetup.setFooter(2, watermarkText); // 2 represents the section where you want to add the watermark (Center section in the footer)
				//	FontSetting fontSetting = pageSetup.getFooterFont(2); // 2 is the section where you added the watermark
				//	fontSetting..setSize(12); // Set the font size
				//	fontSetting.setBold(true); // Make the text bold
				//	fontSetting.setColor(Color.getRed()); // Set the font color to red
				// Add watermark
				//	Shape wordart = sheet.getShapes().addTextEffect(MsoPresetTextEffect.TEXT_EFFECT_1, watermarkText,
				//			"Arial", 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(com.aspose.cells.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);
			}
			else {
				// no sheet
				break;
			}
		}

		// Save the watermarked Excel file
		String watermarkedFilePath = outputDirectory + fileSeparator + fileNameWithOutExt + fileSuffix + fileExtension;
		workbook.save(watermarkedFilePath);

		//	logger.debug("watermarkedFilePath: " + watermarkedFilePath);
		infolog.info("watermarkedFilePath: " + watermarkedFilePath);

		watermarkedFile = true;
	}
	catch (Exception ex) {
		//	logger.error("watermarkTextWordFile ex:", ex);
		errlog.error("watermarkTextExcelFile ex:" + ex + ":" + fileName);

	}

	return watermarkedFile;
}

This is the code used to watermark the excel file

@sabkan,

Aspose.Cells follows MS Excel standards and specifications when setting headers/footers for the worksheet. Could you please test your scenario/case in MS Excel manually if watermark (text) is also overlapping in the footer?

Also, you may zip input Excel file and output Excel file and attach the zipped archive here, we will evaluate your issue using your sample code snippet with your file(s).