I’m working with large Excel files (around 80MB) in both XLS and XLSX formats. I need to add text watermarks that span multiple lines and columns to these files. What’s the best way to accomplish this using Aspose.Cells?
I’d like the watermark effect to look similar to the image below: shot.png (257.9 KB)
Are there any specific classes or methods in Aspose.Cells that are optimized for this kind of task with large files? Any code samples or best practices would be greatly appreciated.
@amjad.sahi Thank you for your detailed response. I really appreciate the two methods you’ve suggested.
I’m already familiar with adding a single text watermark, but I’m struggling with creating multiple, diagonal watermarks that cover the entire sheet, exactly like the effect shown in the screenshot I provided earlier.
Do you have any specific suggestions or code examples for achieving this effect using Aspose.Cells? I’m particularly interested in methods that can handle large files efficiently.
@msl12
Thank you for your feedback. You are welcome. You can refer to the following example code to set the background image of the worksheet. I took a screenshot of the content of the image you provided as image data and set it as the background of the worksheet. Please refer to the attachment. result.zip (15.7 KB)
// Create a new Workbook.
Workbook workbook = new Workbook();
// Get the first worksheet.
Worksheet sheet = workbook.getWorksheets().get(0);
// Get the image file.
File file = new File(filePath + "background.jpg");
// Get the picture into the streams.
byte[] imageData = new byte[(int) file.length()];
FileInputStream fis = new FileInputStream(file);
fis.read(imageData);
// Set the background image for the sheet.
sheet.setBackgroundImage(imageData);
fis.close();
// Save the excel file
workbook.save(filePath + "out_java.xlsx");
@John.He Thank you so much for your quick and helpful response! I really appreciate you taking the time to create a custom example based on my screenshot. This is exactly the kind of effect I was looking for!