Hi,
The “Paper Size” changes after adding trademark.(Version Aspose.Cells 8.2.0.1) Kindly check the pictures in the attachment.
The “Paper Size” should be “A4”, but it changes to “Letter”.(Page 3)
Here is the code:
// excel signature
@Override
protected void xxx(DecorateContext context) throws DecorateException {
logger .debug(“ExcelDecorator.doSignature”);
Workbook workbook = context.getContent(Workbook.class );
DecorateRequest request = context.getRequest();
StringBuilder signSb = new StringBuilder();
signSb.append(EdocTool.getInstance().encryptAES(request.getDocId())).append(“,”)
.append(EdocTool.getInstance().encryptAES(request.getDocVersion())).append(“,”)
.append(EdocTool.getInstance().encryptAES(request.getQrCode()));
CustomDocumentPropertyCollection cps = workbook.getCustomDocumentProperties();
//Record to encrypt the information to the property field
cps.add(DIGITAL_SIGN , signSb.toString());
}
protected void doSave(DecorateContext context) throws DecorateException {
logger .debug(“ExcelDecorator.doSave”);
String path = context.getRequest().getNewDocTempFullPath();
Workbook workbook = context.getContent(Workbook.class );
try {
File tarFile = new File(path);
(tarFile.getParentFile()).mkdirs();
workbook.save(path);
logger .debug(“save(path):” +path);
/
} catch (Exception e) {
throw new DecorateException(“save excel file error “, e);
}
}
// Add QR code
private void addQrCode(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);
}
}
// Add watermark
private void xxx(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);
}
}
}
Thanks & Regards
余佳婧 (Sara Yu)
深圳市华软泰科科技有限公司
Shenzhen Chinasoft Information Technology Co., Ltd.
深圳市南山区高新区南区科技南十路深圳航天技术创新研究院D209
Rm.209, Shenzhen Academy of Aeroapace Technology Bldg., Kejinan 10th Rd.,South High-tech Zone,Nanshan Dist.,Shenzhen,China 518057
Skype: sara.yu1688
Tel: +86-755-26994896
Fax: +86-755-26996813
Mob:+86-18823209951
QQ: 444391387
Web: www.sz168.com.cn