snguyen's picture

Hi there,

I am trying to make a cell in an Excel workbook hidden or locked but once got the output, I still could see and edit the cell in the output file. I was not sure if I had missed something. Below is my hopeless code.

Any idea would be most appreciated

Regards,

Sam

var oExcelWorkbook = Context.createExcelWorkbook("myexcel.xls");
//
var oSheet = oExcelWorkbook.createSheet("mysheet");
var oHeaderSet = oSheet.createRow(0);       

var oCell = oHeaderSet.createCell(i);
oXlsCellStyle = oCell.getCellStyle();
oXlsCellStyle.setAlignment(Constants.ALIGN_CENTER);
oXlsCellStyle.setHidden(true);
oXlsCellStyle.setLocked(true);
oCell.setCellStyle(oXlsCellStyle);
oCell.setCellValue("ABC");
oExcelWorkbook.write();