Tony Miller
17-Nov-2026 22:00:34
Ok, I am trying a new attempt at this..
I have a process on a button click of a page, this process will generate an xlsx file from the region’s data and send it via email.. I am having a slight issue with one thing.. When trying to set the HEADER and Footer of the document I am running into issues:
DECLARE
l_context apex_exec.t_context;
l_export apex_data_export.t_export;
l_region_id number;
l_mail_id NUMBER;
l_print_config apex_data_export.t_print_config;
BEGIN
-- 1. Get the Region ID using your IR’s Static ID
SELECT region_id
INTO l_region_id
FROM apex_application_page_regions
WHERE application_id = :APP_ID
AND page_id = :APP_PAGE_ID
AND static_id = ‘MY_IR_STATIC_ID’;
l_context := apex_region.open_query_context(
p_page_id => :APP_PAGE_ID,
p_region_id => l_region_id
);
l_print_config := apex_data_export.get_print_config(
p_page_header => ‘My Tab Name’,
p_page_footer => ‘CUI Warning!! This Report Contains CUI Data!!’
);
l_export := apex_data_export.export(
p_context => l_context,
p_format => apex_data_export.c_format_xlsx,
p_print_config => l_print_config,
p_file_name => ‘report_with_footer_header’
);
apex_exec.close(l_context);
l_mail_id := apex_mail.send(
p_to => ‘’,
p_from => ‘’,
p_subj => ‘Automated Sample Report (XLSX)’,
p_body => ‘Hello, please find the requested XLSX export attached to this email.‘,
p_body_html => ‘<p>Hello,</p><p>Please find the requested XLSX data export attached.</p>’
);
apex_mail.add_attachment(
p_mail_id => l_mail_id,
p_attachment => l_export.content_blob, -- Extracting the BLOB component
p_filename => ‘report_with_footer_header.xlsx’,
p_mime_type => ‘application/vnd.openxmlformats-officedocument.spreadsheetml.sheet’
);
END;
The footer is set just fine but the text for the header ends up being the tab label for the xlsx file. What I REALLY need is to have the ‘CUI Warning!! This Report Contains CUI Data!!’ text as the 1st line of the xlsx file, like the text is the last line of the xlsx file..
Any suggestions?