Im having a problem with one line below, can anyone advise ????
the problem line is
set worksheet = workbook::ActiveSheet
from the c#
workbook.ActiveSheet
* // Creating a Excel object.
* Microsoft.Office.Interop.Excel._Application excel = new Microsoft.Office.Interop.Excel.Application();
* Microsoft.Office.Interop.Excel._Workbook workbook = excel.Workbooks.Add(Type.Missing);
* Microsoft.Office.Interop.Excel._Worksheet worksheet = null;
declare excel as type Microsoft.Office.Interop.Excel._Application = new type Microsoft.Office.Interop.Excel.Application
declare workbook as type Microsoft.Office.Interop.Excel._Workbook = excel::Workbooks::Add(type System.Type::Missing)
declare worksheet as type Microsoft.Office.Interop.Excel._Worksheet = null
try
* worksheet = workbook.ActiveSheet
set worksheet = workbook::ActiveSheet
* worksheet.Name = "ExportedFromDatGrid"
set worksheet::Name = "ExportedFromDataGrid"
* int cellRowIndex = 1;
declare cellRowIndex as binary-short = 1
* int cellColumnIndex = 1;
declare cellColumnIndex as binary-short = 1
declare i as binary-short = 0
declare j as binary-short = 0
* //Loop through each row and read value from each column.
* for (int i = 0; i < dgvCityDetails.Rows.Count - 1; i )
perform varying i from 0 by 1 until i < dgvMain::Rows::Count - 1
* {
* for (int j = 0; j < dgvCityDetails.Columns.Count; j )
perform varying j from 0 by 1 until j < dgvMain::Columns::Count
* {
* // Excel index starts from 1,1. As first Row would have the Column headers, adding a condition check.
* if (cellRowIndex == 1)
if cellRowIndex = 1
* {
* worksheet.Cells[cellRowIndex, cellColumnIndex] = dgvCityDetails.Columns.HeaderText;
set worksheet::Cells[cellRowIndex, cellColumnIndex] = dgvMain::Columns::HeaderText
* }
else
* {
* worksheet.Cells[cellRowIndex, cellColumnIndex] = dgvCityDetails.Rows.Cells.Value.ToString();
set worksheet::Cells[cellRowIndex, cellColumnIndex] = dgvMain::Rows::Cells::Value::ToString()
* }
end-if
* cellColumnIndex ;
set cellColumnIndex = cellColumnIndex 1
* }
end-perform
* cellColumnIndex = 1;
set cellColumnIndex = 1
* cellRowIndex ;
set cellRowIndex = cellRowIndex 1
* }
end-perform
catch
continue
end-try
