I have a problem with the oracle apex default PDF showing custom heading and company logo. as like below picture
CodePudding user response:
EJ Egyed,
Here is my code below,
DECLARE
l_columns apex_data_export.t_columns;
l_context apex_exec.t_context;
l_export apex_data_export.t_export;
l_print_config apex_data_export.t_print_config;
BEGIN
l_context := apex_exec.open_query_context(
p_location => apex_exec.c_location_local_db,
p_sql_query => 'select * FROM emp order by deptno' );
-- Define columns
apex_data_export.add_column(
p_columns => l_columns,
p_name => 'DEPTNO',
p_heading => 'Dept No');
apex_data_export.add_column(
p_columns => l_columns,
p_name => 'EMPNO',
p_heading => 'Emp No');
apex_data_export.add_column(
p_columns => l_columns,
p_name => 'ENAME',
p_heading => 'Emp Name');
apex_data_export.add_column(
p_columns => l_columns,
p_name => 'SAL',
p_heading => 'Salary',
p_format_mask => 'FML999G999G999G999G990D00');
l_print_config := apex_data_export.get_print_config(
p_orientation => apex_data_export.c_orientation_portrait,
p_border_width => 1,
p_body_font_color => 'Black',
p_page_header => 'Dekko Legacy Group',
p_page_header_font_color => 'Black',
p_page_header_font_size => 20,
p_page_header_font_family => null,
p_page_header_font_weight => apex_data_export.c_font_weight_bold,
p_page_header_alignment => 'CENTER',
p_page_footer => 'Generated by '|| :APP_USER,
p_page_footer_font_color => 'Black',
p_page_footer_font_size => 10,
p_page_footer_font_family => null,
p_page_footer_font_weight => apex_data_export.c_font_weight_bold,
p_page_footer_alignment => 'LEFT',
p_border_color => 'Black');
l_export := apex_data_export.export (
p_context => l_context,
p_format => :P32_FORMAT,--apex_data_export.c_format_pdf,
p_columns => l_columns,
p_file_name => 'employees',
p_print_config => l_print_config
);
apex_exec.close( l_context );
apex_data_export.download(p_export => l_export);
EXCEPTION
WHEN others THEN
apex_exec.close( l_context );
raise;
END;
CodePudding user response:
It's hard to add a logo and custom header to the default PDF export of Oracle APEX.
This is why we created APEX Office Print, which allows you to export based on a template you create. In your case, it's as easy as adding the logo and header in your Excel template and using a tag where you want the data to be. You find examples in the AOP Sample Apps.
There's a free tier of AOP and also paid options. Although it might be payable, you will save enormous time on creating the PDFs and reports you need and you have a much bigger toolset and options to give your end-users.
Hope that helps.