We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Re: We met a problem when operating aspose.cell

Hello ,
They try the newest version.
But after uploading the license code they click the "print preview", it still crashed. It works fine if they remove the license code.
Here is the related code.
Uploaded license code:

public void loadExcelLicense() {

synchronized (sync) {

if (excelLic == null) {

InputStream is = null;

try {

excelLic = new com.aspose.cells.License();

is = LicenseManager.class.getResourceAsStream("config/Aspose.Cells.lic");


} catch (Exception e) {

throw new RuntimeException("load Cells license failed!", e);

} finally {






QR code:

private void xxx(Worksheet sheet, byte[] picData, int position) {

if (picData != null) {

PageSetup pageSetup = sheet.getPageSetup();

String footerStr = pageSetup.getFooter(position);

if (footerStr == null) {

footerStr = "&G";

} else {

footerStr = "&G\n" + footerStr;


pageSetup.setFooter(position, footerStr);// "&G"

pageSetup.setFooterPicture(position, picData);



Watermark Code:

private void yyy(Worksheet sheet, byte[] vPicData, byte[] hPicData, int position) {

if (vPicData != null || hPicData != null) {

PageSetup pageSetup = sheet.getPageSetup();

int orientation=pageSetup.getOrientation();

String footerStr = pageSetup.getFooter(position);

if (footerStr == null || "&G".equals(footerStr)) {

footerStr = "&G";

} else if (!footerStr.contains("&G")) {

footerStr = "&G\n" + footerStr;


pageSetup.setFooter(position, footerStr);// "&G"

if (orientation == 1) {

pageSetup.setFooterPicture(position, vPicData);

} else {

pageSetup.setFooterPicture(position, hPicData);




Locked Document content:

private void zzz(final String pwd, Worksheet sheet) {

sheet.protect(ProtectionType.ALL, pwd, pwd);

sheet.protect(ProtectionType.NONE, pwd, pwd);

sheet.protect(ProtectionType.CONTENTS, pwd, pwd);

sheet.protect(ProtectionType.OBJECTS, pwd, pwd);

sheet.protect(ProtectionType.SCENARIOS, pwd, pwd);

sheet.protect(ProtectionType.STRUCTURE, pwd, pwd);

sheet.protect(ProtectionType.WINDOWS, pwd, pwd);

Protection protection = sheet.getProtection();















// protection.setAllowSelectingUnlockedCell(false);

// protection.setAllowSelectingLockedCell(false);



Here was your previous response.


Thank you for contacting Aspose support.
We have checked your provided spreadsheet "(Add_wartermark)test.xlsx" that caused the MS Excel 2007 to crash upon viewing in Preview mode. However, we could investigate the matter further because you haven't yet shared the source code to create such spreadsheet. We would request you to please provide the source code as well as the images to be inserted in the resultant spreadsheet to replicate the problem. Upon reviewing the requested information, we will be in a better position to assist you with this problem.

Before you provide us the above requested information, please give a try to the latest version of Aspose.Cells for Java on your end.


You were sent this email because you opted to receive email

notifications when someone responded to this thread.

To unsubscribe,
1. Visit the above URL and deselect ‘Email me when someone
2. Visit your user profile page and uncheck ‘Enable email

Aspose.com te


Thank you for providing the source code.

We are able to replicate the problem of MS Excel getting crashed when resultant spreadsheet is checked in print preview. The problem occurs only when spreadsheet is generated in licensed mode. However, we have noticed that the problem does not relate to the watermarking as we are able to reproduce the issue with following simple lines of code.


Workbook book = new Workbook(myDir + “test.xlsx”);
Worksheet sheet = book.getWorksheets().get(0);

protect(“123”, sheet);

book.save(myDir + “licensed.xlsx”, SaveFormat.XLSX);

Please note, protect is the same method as shared in your post as of zzz.

We have logged the problem in our bug tracking system under the ticket CELLSJAVA-40957 for further investigation & correction purposes. Please spare us little time to properly analyze the problem cause, and to provide a fix for it. In the meanwhile, we will keep you posted with updates in this regard/.


Thanks for using Aspose.Cells for Java.

Please download and try this fix: Aspose.Cells for Java v8.2.0.1 and let us know your feedback.

It works fine now. Thank you very much for your support. It’s timely, efficient & patient!


Thanks for your feedback and using Aspose.Cells.

It is good to know that your issue is resolved with the latest version. Let us know if you encounter any other issue, we will be glad to look into it and help you further.

The issues you have found earlier (filed as CELLSJAVA-40957) have been fixed in this update.

This message was posted using Notification2Forum from Downloads module by Aspose Notifier.