Hello
We are running into an issue with applying tags to table header cells when tables continue onto more than one page. When viewing the document using Adobe Acrobat, the <P> tags with table header text all show up under the first <TH> tag in the document. The header text should show up once under each <TH> tag for each separate <Table> tag on each page.
Sample code that reproduces the issue is below.
Does anyone know of an alternate way of doing this to get around this issue while still being able to set the properties of the cell tags?
Thanks in advance for any responses.
Tim
Document document = new Document();
float yPosition;
document.Tag = new TagOptions(true);
Table2 table = new Table2(0, 0, 600, 400);
table.Columns.Add(150);
table.Columns.Add(90);
table.RepeatColumnHeaderCount = 1;
string text = "This is to test the overflow of the cell contents to next page dynamically";
text += text;
text += text;
text += text;
text += text;
text += text;
Row2 row1 = table.Rows.Add(30);
row1.CellDefault.Align = TextAlign.Left;
row1.CellDefault.VAlign = VAlign.Top;
Cell2 TableHeader1 = row1.Cells.Add("Header 1");
Cell2 TableHeader2 = row1.Cells.Add("Header 2");
//Commenting out this code will render the table header tags correctly
StructureElement StructureTableCellTag = new StructureElement(TagType.TableHeader);
StructureTableCellTag.Identifier = "123";
AttributeObject ao = new AttributeObject(AttributeOwner.Table);
ao.SetScope(Scope.Column);
StructureTableCellTag.AttributeLists.Add(ao);
TableHeader1.Tag = StructureTableCellTag;
TableHeader2.Tag = StructureTableCellTag;
//Commenting out the above code render the table header tags correctly
for (int i = 0; i < 1; i++)
{
Row2 row3 = table.Rows.Add(30);
Cell2 cell2 = row3.Cells.Add(text);
cell2.Align = TextAlign.Left;
cell2.VAlign = VAlign.Top;
cell2.Splittable = true;
Cell2 cell3 = row3.Cells.Add("text" + (i + 1));
cell3.Splittable = true;
}
//Adding table to page.
do
{
Page page = new Page();
table.Height = page.Dimensions.Body.Height - 30;//value 30 is the height of the footer table.
float width = table.Width;
float height = table.Height;
document.Pages.Add(page);
page.Elements.Add(table);
if (height > table.GetRequiredHeight())
{
yPosition = (float)(table.Y + table.GetRequiredHeight());
}
else
{
yPosition = (float)(table.Y + table.Height - 3);
}
table = table.GetOverflowRows();
} while (table != null);
document.DrawToWeb(@"TableHeaderTags.pdf");