Print custom PDF Report Using PL/SQL Dynamic Region in Oracle Apex 19.1

preview_player
Показать описание
How to Print custom PDF Report
Using PL/SQL Dynamic Region
in Oracle Apex 19.1
رابط دعم المحتوى على باترون
Рекомендации по теме
Комментарии
Автор

Code 1
--
declare
cursor c_emp
is
select EMPNO, ENAME, JOB, MGR, HIREDATE, SAL, COMM, DEPTNO
from EMP

where EMPNO =:P4_EMPNO;

begin
htp.htmlopen; -- genera la etiqueta <HTML>
htp.headopen; -- genera la etiqueta <HEAD>
htp.title('Eployee Report'); -- genera la etiqueta <TITLE> y </TITLE>
htp.headclose; -- genera la etiqueta </HEAD>
htp.bodyopen; -- genera la etiqueta <BODY>
htp.header(1, 'Eployee Report'); -- genera la etiqueta <H1> y </H1>
htp.tableopen (cattributes => 'border=2 width=100% cellpadding=10 bgcolor=#F3F3F3'); -- genera la etiqueta <TABLE>
htp.tablerowopen (cattributes => 'bgcolor="#216BB9"'); -- genera la etiqueta <TR>
htp.tableheader(cvalue => '<font face="ARIAL" size="2.25" color="WHITE">' || 'Employee Number'); -- genera la etiqueta <TH> y </TH>
htp.tableheader(cvalue => '<font face="ARIAL" size="2.25" color="WHITE">' || 'Employee Name');
htp.tableheader(cvalue => '<font face="ARIAL" size="2.25" color="WHITE">' || 'Job');
htp.tableheader(cvalue => '<font face="ARIAL" size="2.25" color="WHITE">' || 'Manager');
htp.tableheader(cvalue => '<font face="ARIAL" size="2.25" color="WHITE">' || 'Hire Date');
htp.tableheader(cvalue => '<font face="ARIAL" size="2.25" color="WHITE">' || 'Salary');
htp.tableheader(cvalue => '<font face="ARIAL" size="2.25" color="WHITE">' || 'Commetion ');
htp.tableheader(cvalue => '<font face="ARIAL" size="2.25" color="WHITE">' || 'Department');

htp.tablerowclose; -- genera la etiqueta </TR>
htp.tablerowopen; -- genera la etiqueta <TR>

for r_emp in c_emp
loop
htp.tabledata(r_emp.EMPNO);
htp.tabledata(r_emp.ENAME, cattributes=>'align=left');
htp.tabledata(r_emp.JOB, cattributes=>'align=left');
htp.tabledata(r_emp.MGR, cattributes=>'align=left');
htp.tabledata(r_emp.HIREDATE, cattributes=>'align=left');
htp.tabledata(r_emp.SAL, cattributes=>'align=left');
htp.tabledata(r_emp.COMM,
htp.tabledata(r_emp.DEPTNO, cattributes=>'align=left');

htp.tablerowclose;
end loop;

htp.tablerowclose; -- genera la etiqueta </TR>
htp.tableclose; -- genera la etiqueta </TABLE>
htp.bodyclose; -- genera la etiqueta </BODY>
htp.htmlclose; -- genera la etiqueta </HTML>
end;

alisaleh
Автор

Great demo :) ..Thanks for sharing
I was able to implement however if I have to save this PDF to a blob file how would you do it?

MrBandhuraj
Автор

-- code 2
declare
V_SAL_TOTAL number;
V_COMM_TOTAL number;
V_COUNT number;
cursor c_emp is
select
EMPNO,
ENAME,
JOB,
--MGR,
APEX_ITEM.TEXT(4, MGR) MGR,
HIREDATE,
translate(SAL,
'0123456789',
unistr('\0660') || unistr('\0661') || unistr('\0662') ||
unistr('\0663') || unistr('\0664') || unistr('\0665') ||
unistr('\0666') || unistr('\0667') || unistr('\0668') ||
unistr('\0669')) as SAL,
COMM,

translate(DEPTNO,
'0123456789',
unistr('\0660') || unistr('\0661') || unistr('\0662') ||
unistr('\0663') || unistr('\0664') || unistr('\0665') ||
unistr('\0666') || unistr('\0667') || unistr('\0668') ||
unistr('\0669')) as DEPTNO,
APEX_ITEM.TEXT_FROM_LOV_QUERY(DEPTNO, 'SELECT DNAME, DEPTNO FROM DEPT') as DEPARTMENT
from
EMP;

begin
select SUM(SAL), sum(comm), count (DEPTNO)into V_SAL_TOTAL, V_COMM_TOTAL, V_COUNT from EMP;
htp.p(
'
<table>
<caption style ="text-align=center;" >Employee Report</caption>
<thead>
<tr>
<th>emplyee number</th>
<th>Employee Name</th>
<th>Job</th>
<th>Manager</th>
<th>Hire Date</th>
<th>Salary </th>
<th>Commetion</th>
<th>Department No </th>
<th>Department Name </th>
</tr>
</thead>
<tbody>

'
);for r_emp in c_emp
loop
htp.p(
'
<tr>
<td>' || r_emp.EMPNO || '</td>
<td>' || r_emp.ENAME || '</td>
<td>' || r_emp.JOB || '</td>
<td>' || r_emp.MGR || '</td>
<td>' || r_emp.HIREDATE || '</td>
<td>' || r_emp.SAL || '</td>
<td>' || r_emp.COMM || '</td>
<td>' || r_emp.DEPTNO || '</td>
<td>' || r_emp.DEPARTMENT || '</td>
</tr>
'
);
end
loop;htp.p(
'


</tbody>
<tfoot>
<tr>
<th colspan="5"> Total</th>
<th>'||V_SAL_TOTAL||'</th>
<th>'||V_COMM_TOTAL||'</th>
<th>'||V_COUNT||'</th>
<th> </th>
</tr>
</tfoot>
</table>
'
);
htp.p (
' <style>
table {
font-family: "Helvetica Neue", Helvetica, sans-serif
}

caption {
text-align: left;
color: silver;
font-weight: bold;
text-transform: uppercase;
padding: 5px;
}

thead {
background: SteelBlue;
color: white;
}

th,
td {
padding: 5px 10px;
}

tbody tr:nth-child(even) {
background: WhiteSmoke;
}

tbody tr td:nth-child(2) {
text-align:center;
}

tbody tr td:nth-child(3),
tbody tr td:nth-child(4) {
text-align: right;
font-family: monospace;
}

tfoot {
background: SeaGreen;
color: white;
text-align: right;
}

tfoot tr th:last-child {
font-family: monospace;
}

</style>'
);
end;

alisaleh
Автор

how to repeat heading on 2nd page onward

yakaka
Автор

How can I get the Blob of PDF in pl/sql please.

abo-khaled
Автор

If i have two table how can i to print two page in pdf file ?

MrHaha
Автор

thanks your tutorials is very helpful, but better is that if you provide tutorials in english language...

SAD-ewhl
Автор

Hi Ali thank u for sharing PL/SQL code.
I tried very first PL/SQL code but when I click on the button nothing is happening

princesiddharha
Автор

Hi Sir
I followed this tutorial but print is not initiating the next page when there is more number of rows
what i'm i missing?
Thanks in advance

varshahr
Автор

كبف تمت عملية تعريب الارقام؟ هل هناك اداة جاهزة في ابكس لتعريب الارقام

jwadalsabee
Автор

Can you please guide me on how to save the generated PDF report(From a Dynamic region or a classic report) in Database as a BLOB type. Thanks!

patelbansari
Автор

Asalam o Alaikum!
Sir I use windo.print();
Wholl screen print but my need is only print data.

serialgamers
Автор

Hi sir,
Thanks for the video
i followed the same process but when i click the "pl/sql2" button blank sheet is getting generated with Page name in the header and page link in the footer(these page name and page link should not appear)
i have given window.print() when page loads
where i'm i doing wrong
Thanks in advance...

varshahr
Автор

Can u help me how to remove header from I click on print button in print also has header and footer of application

kaushik
Автор

Please share the code you write in "pl/sql and pl/sql 2 buttons"

awaisexilant
Автор

عند كتابة الفارزة لا يظهر الصفر مثلا عند وجو رقم 0.1 يظهر فقط .1 لا اعرف الحل

zainabalhilaly
Автор

How to export excel and pdf same report?

suvashishdas
Автор

جزيت خيرا ي هندسة ، وين احصل الملفات العليها الشرح لو تكرمت

wizzeico
Автор

auto print JavaScript code
window.print();

alisaleh
Автор

من فضلك اخ على صالح على كود كورس و شكرا

alihabboul