BookmarkSubscribeRSS Feed
🔒 This topic is solved and locked. Need further help from the community? Please sign in and ask a new question.
RandyHerbison
Calcite | Level 5

I would like to create an accessible PDF with a table structured like example 1 in this web accessibility tutorial.  My SAS code is below.

CommonLook Validator says data cells (2,2) and (2,3) do not have column headers associated with them. When viewing the results as HTML, I can see the column header scope attributes are "col".  Is there a way to view the header scope attributes in the PDF?

Thanks

ods pdf file='c:\temp\test.pdf' accessible;

data _null_;
  dcl odsout ods();
  ods.table_start();
  ods.row_start();
  ods.format_cell();
  ods.format_cell(type: 'H', style_elem: 'header', text: 'A');
  ods.format_cell(type: 'H', style_elem: 'header',text: 'B');
  ods.row_end();
  ods.row_start();
  ods.format_cell(type: 'H', style_elem: 'rowheader', text: 'A');
  ods.format_cell(text: '1');
  ods.format_cell(text: '2');
  ods.row_end();
  ods.table_end();
run;
 
ods pdf close;
1 ACCEPTED SOLUTION

Accepted Solutions
gdkraus
SAS Employee

The CommonLook Validator is correct about the table. The code you have only produces row headers in PDF. To make rows of cells into column headers those rows need to be surrounded with .head_start() and .head_end(), like in the code below.

data _null_;
dcl odsout ods();
ods.table_start();
ods.head_start();
ods.row_start();
ods.format_cell();
ods.format_cell(type: 'H', style_elem: 'header', text: 'A'); * note "type: 'H'" is optional here since it is wrapped in .head_start();
ods.format_cell(type: 'H', style_elem: 'header',text: 'B'); * note "type: 'H'" is optional here since it is wrapped in .head_start();
ods.row_end();
ods.head_end();
ods.row_start();
ods.format_cell(type: 'H', style_elem: 'rowheader', text: 'A');
ods.format_cell(text: '1');
ods.format_cell(text: '2');
ods.row_end();
ods.table_end();
run;

It will not be identical to the example you point out because the upper left cell will be marked as a table header instead of a data cell, however, whether or not an empty upper left cell in a well structured table is a header or a data cell is a pretty minor point since that cell is frequently empty by convention.

 

To answer your first question about how you can see the scope information for table headers in PDF files, there are two techniques. In my SAS Global Forum Paper ODS PDF Accessibility in SAS® 9.4M5: Going Beyond the Basics to Create Advanced Accessible Reports on page 20 I show one technique using the "Order Pane" and the "Table Editor".

 

The other way I sometimes check this is to dig into some more obscure areas of Acrobat, but I find it faster in some cases. Go to the "Tags Panel", find the "<TH>" in question, from the context menu choose "Properties..." then "Edit Attribute Objects", expand the tree nodes under "Attribute Objects" and you will see a key value of "/Scope" with a value of "/Column", "/Row", "/None", or "/Both".

View solution in original post

2 REPLIES 2
gdkraus
SAS Employee

The CommonLook Validator is correct about the table. The code you have only produces row headers in PDF. To make rows of cells into column headers those rows need to be surrounded with .head_start() and .head_end(), like in the code below.

data _null_;
dcl odsout ods();
ods.table_start();
ods.head_start();
ods.row_start();
ods.format_cell();
ods.format_cell(type: 'H', style_elem: 'header', text: 'A'); * note "type: 'H'" is optional here since it is wrapped in .head_start();
ods.format_cell(type: 'H', style_elem: 'header',text: 'B'); * note "type: 'H'" is optional here since it is wrapped in .head_start();
ods.row_end();
ods.head_end();
ods.row_start();
ods.format_cell(type: 'H', style_elem: 'rowheader', text: 'A');
ods.format_cell(text: '1');
ods.format_cell(text: '2');
ods.row_end();
ods.table_end();
run;

It will not be identical to the example you point out because the upper left cell will be marked as a table header instead of a data cell, however, whether or not an empty upper left cell in a well structured table is a header or a data cell is a pretty minor point since that cell is frequently empty by convention.

 

To answer your first question about how you can see the scope information for table headers in PDF files, there are two techniques. In my SAS Global Forum Paper ODS PDF Accessibility in SAS® 9.4M5: Going Beyond the Basics to Create Advanced Accessible Reports on page 20 I show one technique using the "Order Pane" and the "Table Editor".

 

The other way I sometimes check this is to dig into some more obscure areas of Acrobat, but I find it faster in some cases. Go to the "Tags Panel", find the "<TH>" in question, from the context menu choose "Properties..." then "Edit Attribute Objects", expand the tree nodes under "Attribute Objects" and you will see a key value of "/Scope" with a value of "/Column", "/Row", "/None", or "/Both".

RandyHerbison
Calcite | Level 5
Thanks! This is very helpful.