Hi,
I want to publish a excel report with merged cells. I am unable to merge the cells.
output = Context.createExcelWorkbook("Book"); sheet = output.createSheet("Sheet1"); row1= sheet .createRow(0); row2= sheet.createRow(1); //I want to merge first coumn and second column of second row //So I tried this sheet .addRegion(0,1,1,1); //But it always throws me an error!!
When I use above code I am getting Error Index:1 Size=0
Can anyone guide me on this please?
Hi Eva,
Thanks a lot.!
Your code works!!. I got it after replacing filename in createExcelWorkbook with Context.getSelectedFile
But I want to know what's difference between
var workbook = Context.createExcelWorkbook(Context.getSelectedFile());
And
var workbook = Context.createExcelWorkbook("FileName");
?
You're welcome.
With this version, the name for the report output is hard-coded and every output has this name ("FileName.xls").
var workbook = Context.createExcelWorkbook("FileName.xls");
With the following version, the report output is assigned the name that you had defined when you started the report and set the output settings ("Save output as").
var workbook = Context.createExcelWorkbook(Context.getSelectedFile());
Hello, I'm having a similar problem. But instead of creating a new excel i'm creating it from a template. the error gives me the following info:
index:11 size: 10
my code is:
var xlsTemplateData = Context.getFile("Template.xlsx", Constants.LOCATION_SCRIPT) return Context.createExcelWorkbook(Context.getSelectedFile(), xlsTemplateData);
Thank you