Writing XLS file using SQR and PeopleCode

Your rating: None Average: 1.8 (5 votes)

We can write a XLS file using PeopleCode and SQR. We will be simply writing a XLS file using HTML tags.
Below is the SQR code.

Let $filename='C:\PeopleSoft\PsftHRMS90\'||$Prcs_Process_Instance||'\Report'||$Prcs_Process_Instance||'.xls'
Open $filename  as 2 for-writing record=20000 status=#filestat2
<*start of  table *>
Write 2 from '<table border = 1>'

<*start of heading row*>
Write 2 from '<tr>'
<*heading cell tag, we can have multiple headings cells in a heading row*>
Write 2 from '<th>'
Write 2 from  $head
Write 2 from '</th>'
<*end of heading cell tag*>
Write 2 from '</tr>'
<*end of heading row*>

<*start of data row*>
Write 2 from '<tr>'
<*data cell tag, we can have multiple data cells in a heading row*>

Write 2 from '<td>'
Write 2 from  $data
write 2 from '</td>'

<*end of data cell tag*>
Write 2 from '</tr>'
<*end of data row*>
Write 2 from '</table>'

<*end of  table *>

We are writing a HTML table using HTML tags. Read more about them to create beautiful tables with proper borders etc.
Similarly we can use the Writeline function of PeopleCode to write a XLS file.

Please try to help out with unanswered topics on the forum. Chances are you have had the same issue/question some time in your IT career!

Comments

Have a question? Please ask it on the forum instead.
jorge's picture
jorge (not verified)
Re: Writing XLS file using SQR and PeopleCode

Hi there, i just want to ask if there a way where this HTML tag can password protect the XLS created? So the user will be prompted with password before opening the file?

Thanks.
Jorge

Post new comment

CAPTCHA
The question below is to prevent automated spam submissions.
3 + 16 =
Solve this simple math problem and enter the result. E.g. for 1+3, enter 4.