Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix table header row for accessibility (Issue #1299) #1369

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion src/gen-xml.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ import {
valToPts,
} from './gen-utils'

// Bob Dolan 2025-01-27 | Issue #1299
import PptxGenJS from '../types'
import TableToSlidesProps = PptxGenJS.TableToSlidesProps
// Bob Dolan 2025-01-27 | Issue #1299

const ImageSizingXml = {
cover: function (imgSize: { w: number, h: number }, boxDim: { w: number, h: number, x: number, y: number }) {
const imgRatio = imgSize.h / imgSize.w
Expand Down Expand Up @@ -179,7 +184,17 @@ function slideObjectToXml (slide: PresSlide | SlideLayout): string {
'</p:nvGraphicFramePr>'
strXml += `<p:xfrm><a:off x="${x || (x === 0 ? 0 : EMU)}" y="${y || (y === 0 ? 0 : EMU)}"/><a:ext cx="${cx || (cx === 0 ? 0 : EMU)}" cy="${cy || EMU
}"/></p:xfrm>`
strXml += '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table"><a:tbl><a:tblPr/>'

// Bob Dolan 2025-01-27 | Issue #1299
// strXml += '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table"><a:tbl><a:tblPr/>'
// if autoPageRepeatHeader is true, first row of table should be marked as a header row to improve accessibility and to pass PowerPoint accessibility review
strXml += '<a:graphic><a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/table"><a:tbl><a:tblPr'
if ((objTabOpts as TableToSlidesProps).autoPageRepeatHeader) {
strXml += ' firstRow="1"'
}
strXml += '/>'
// Bob Dolan 2025-01-27 | Issue #1299

// + ' <a:tblPr bandRow="1"/>';
// TODO: Support banded rows, first/last row, etc.
// NOTE: Banding, etc. only shows when using a table style! (or set alt row color if banding)
Expand Down