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”);

excelLic.setLicense(is);

} catch (Exception e) {

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

} finally {

EdocTool.getInstance().releaseStream(is);

}

}

}

}

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.setAllowDeletingColumn(false );

protection.setAllowDeletingRow(false );

protection.setAllowEditingContent(false );

protection.setAllowEditingObject(false );

protection.setAllowEditingScenario(false );

protection.setAllowFormattingCell(false );

protection.setAllowFormattingRow(false );

protection.setAllowInsertingColumn(false );

protection.setAllowInsertingHyperlink(false );

protection.setAllowInsertingRow(false );

protection.setAllowSelectingLockedCell(true );

protection.setAllowSelectingUnlockedCell(true );

protection.setAllowSorting(true );

protection.setAllowUsingPivotTable(false );

// protection.setAllowSelectingUnlockedCell(false);

// protection.setAllowSelectingLockedCell(false);

protection.setPassword(pwd);

}

Here was your previous response.


Hi,

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 8.1.2.5 on your end.


You were sent this email because you opted to receive email

notifications when someone responded to this thread.

To unsubscribe,
either:

  1. Visit the above URL and deselect ‘Email me when someone
    replies…’
  2. Visit your user profile page and uncheck ‘Enable email
    tracking’

Thanks,
Aspose.com team

Hi,


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.

Java

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/.

Hi,

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!

Hi,

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.