Forum Discussion
pradeep_kamatha
12 years agoContributor
THanks for your suggestion.. I am not ablet o compile it.. Could you please go through below code and suggest me how I need to call..
function TableToExcel(tableObject, excelFileName)
{
var objExcel = Sys.OleObject("Excel.Application");
objExcel.Visible = false;
objExcel.DisplayAlerts = false;
objExcel.Worksheets.("Sheet1").Range("A1:W100").ClearContents
var objWBook = objExcel.Workbooks.Add();
var objWSheet = objWBook.Sheets(1);
for (var i = 0; i < tableObject.RowCount; i++)
for (var j = 0; j < tableObject.ColumnCount; j++)
objWSheet.Cells(i+1, j+1) = tableObject.Values(i, j);
objWBook.SaveAs(excelFileName) ;
Log.Message("Data has been uploaded to C:\\CAL.xlsx");
objExcel.ActiveWorkbook.Saved = true;
objExcel.DeleteCustomList()
objExcel.Application.Quit();
}
function test()
{
TableToExcel(DBTables.AMI_READ_ROUND, "C:\\CAL.xlsx");
}
function TableToExcel(tableObject, excelFileName)
{
var objExcel = Sys.OleObject("Excel.Application");
objExcel.Visible = false;
objExcel.DisplayAlerts = false;
objExcel.Worksheets.("Sheet1").Range("A1:W100").ClearContents
var objWBook = objExcel.Workbooks.Add();
var objWSheet = objWBook.Sheets(1);
for (var i = 0; i < tableObject.RowCount; i++)
for (var j = 0; j < tableObject.ColumnCount; j++)
objWSheet.Cells(i+1, j+1) = tableObject.Values(i, j);
objWBook.SaveAs(excelFileName) ;
Log.Message("Data has been uploaded to C:\\CAL.xlsx");
objExcel.ActiveWorkbook.Saved = true;
objExcel.DeleteCustomList()
objExcel.Application.Quit();
}
function test()
{
TableToExcel(DBTables.AMI_READ_ROUND, "C:\\CAL.xlsx");
}
Related Content
- 6 years ago
- 3 years ago
- 13 years ago
- 4 years ago
Recent Discussions
- 2 days ago
- 7 days ago
- 11 days ago