Exporting security task to excel sheet and coloring cells according security rule present for security task.

Hi,

Exporting security task to excel sheet and coloring cells according security rule present for security task.i am using the below code ,Whenever i run this code i am getting error like “The number of arguments provided is different from the number of arguments accepted by the method.”.I am having 1500 records in security task table.Please someone suggest me to resolve the error.

SysExcelApplication application;
SysExcelWorkBooks workbooks;
SysExcelWorkBook workbook;
SysExcelWorksheets worksheets;
sysExcelWorksheet worksheet;
SysExcelCells cells;
SysExcelCell cell;
SysExcelCell cell1;

str fileName;
int row=2,rowcal= 2;
int i,j;
COM comObj, intObj;
SecurityTask SecurityTask,SecurityTask1,securityTaskRecIdRow,securityTaskRecIdCol;
SecuritySegregationOfDutiesRule SecuritySegregationOfDutiesRule;

int col = 2,colinc =2;
str 50 strcell1,strcell2,strcell3,strcell4;
int countfield;
int iloop,jloop;
;
select count(RecId) from SecurityTask1 where SecurityTask1.Type == SecurityTaskType::Duty;

application = SysExcelApplication::construct();
workbooks = application.workbooks(); //gets the workbook object
workbook = workbooks.add(); // creates a new workbook
worksheets = workbook.worksheets(); //gets the worksheets object

worksheet = worksheets.itemFromNum(1);
cells = worksheet.cells();

while select SecurityTask
where SecurityTask.Type == SecurityTaskType::Duty
{
if(row == 128 )
break;
cells.item(row,1).value(SecurityTask.Name);
cells.item(1,col).value(SecurityTask.Name);

strcell1 = cells.item(row,1).value().bStr();
strcell2 = cells.item(1,col).value().bStr();
if(strcell1 == SecurityTask.Name && strcell2 == SecurityTask.Name)
{
comObj = cells.item(row,col).comObject();
intObj = comObj.Interior();
intObj.color(000000);//#D3D3D3
}
col++;
row++;
}

for(iloop =1;iloop<=SecurityTask1.RecId;iloop++)
{
for(jloop = 1 ;jloop <=SecurityTask1.RecId ;jloop++)
{

strcell3 = cells.item(rowcal,1).value().bStr();
strcell4 = cells.item(1,colinc).value().bStr();
if(strcell3 != strcell4)
{

select securityTaskRecIdRow where securityTaskRecIdRow.Name == strcell3;
select securityTaskRecIdCol where securityTaskRecIdCol.Name == strcell4;
select SecuritySegregationOfDutiesRule where SecuritySegregationOfDutiesRule.FirstSecurityTask == securityTaskRecIdRow.RecId &&
SecuritySegregationOfDutiesRule.SecondSecurityTask == securityTaskRecIdCol.RecId;
if(SecuritySegregationOfDutiesRule.Severity == SegregationOfDutiesSeverity::High)
{

comObj = cells.item(127,38).comObject();
intObj = comObj.Interior();
intObj.color(255);
}
else if (SecuritySegregationOfDutiesRule.Severity == SegregationOfDutiesSeverity::Medium)
{

comObj = cells.item(rowcal,colinc).comObject();
intObj = comObj.Interior();
intObj.color(16711680);
}
else if(SecuritySegregationOfDutiesRule.Severity == SegregationOfDutiesSeverity::Low)
{

comObj = cells.item(rowcal,colinc).comObject();
intObj = comObj.Interior();
intObj.color(2551650);
}

}
colinc++;
}
rowcal++;
}
application.visible(true);

}

Were you able to identify which line of code is causing the error?

Hi,

Now getting error like “method ‘value’ in com object of class ‘range’ returned error code 0x800a03ec () which means:” in while select SecurityTask where SecurityTask.Type == SecurityTaskType::Duty .before running this code excel open but now above error is showing.Please suggest me to resolve error.

Hi,
Please some one suggest me to resolve the error.