Generating xls or formatted excel file is tedious with SQR.
But we can generate them using Peoplecode with OLE Automation.
We need to create a Excel object and then we can use almost all VBA commands in PeopleCode with Peoplesoft notations, Remember vbconstants like vbblue will not be used here.
Also Make sure you are running this code in windows server with excel installed.
Local object &workApp;Local object &workBook;
Local object &workSheet1, &workSheet2, &workSheet3, &workSheet4;
try
&workApp = CreateObject("COM", "Excel.Application");
ObjectSetProperty(&workApp, "Visible", False);
&workBook = &workApp.WorkBooks.Add();
&workSheet1 = &workBook.WorkSheets(1);
&workSheet2 = &workBook.WorkSheets(2);
&workSheet3 = &workBook.WorkSheets(3);
&workSheet3.activate();
&workSheet4 = &workBook.Worksheets.Add(4);
Tags: