Aspose.pdf table header with text not repeat on all pages

Hi I am using aspose.pdf and genrating dynamic table .
first row of table used like header .i want to use this as header for table for all page but it add blank row without text at all pages.
I have used these property …
tableq.RepeatingRowsCount = 1;

rowupperQuest1.IsRowBroken = false;// for stop breaking row on end of page

tableq.IsKeptWithNext = false;

kindly suggest any solution

Kindly share the complete details of the scenario, including source PDF (if any) and code, so that we could replicate this problem on our environment. We will investigate and share our findings with you.

hi, @imran.rafique thanks for the concerned,please look below scenario

I have a table which will come more than two page, I have first row of table heading1,heading2,heading3 .
I want to repeate first row as header on every page with text heading1,heading2,heading3 .if you have any thing like table header please share …
I am using aspose.pdf

@jitendra1,

You can add a header with a single table row to each page, and then managed the entire table with the rows in the PDF page content without header. Please try the following code example:

[C#]

string dataDir = @"C:\Pdf\test516\";
//Instantiate PDF instance by calling empty constructor
Document document = new Document();
//Create a section in the pdf document
Aspose.Pdf.Page page1 = document.Pages.Add();
Aspose.Pdf.Page page2 = document.Pages.Add();

// Create a Header Section of the PDF file
Aspose.Pdf.HeaderFooter header = new Aspose.Pdf.HeaderFooter();
//Instantiate a table object
Aspose.Pdf.Table tab1 = new Aspose.Pdf.Table();
tab1.HorizontalAlignment = HorizontalAlignment.Center;
header.Paragraphs.Add(tab1);
tab1.ColumnWidths = "100";

//Create rows in the table and then cells in the rows
Aspose.Pdf.Row row1 = tab1.Rows.Add();
row1.Cells.Add("Heading1").Alignment = HorizontalAlignment.Center;
row1.Cells.Add("Heading2").Alignment = HorizontalAlignment.Center;
row1.Cells.Add("Heading3").Alignment = HorizontalAlignment.Center;
            
page1.Header = header;
page2.Header = header;
document.Save(@"C:\Pdf\test517\Output.pdf", SaveFormat.Pdf);

This is the output PDF: Output.pdf (2.5 KB)

hi team ,

I have actual issue that first tr not repeating as th . I have already page header containing Image then line and page footter
containing image:post_office: then line(


) then after paging(1|confidential) across page .first page contain another table and from second page to last page contain another table in which i want to fix th.I can’t fix th in page header because page header and table margin to much long and table start from second page .

@jitendra1,

Kindly share a sample of input PDF along with an expected output PDF document. We will investigate and share our findings with you.

please find sample as attachment
TOP Headerpdf.pdf (334.0 KB)

@jitendra1,

In order to achieve the formatting of first row like header row, we can iterate through the cells of first row, and then format text as follows:

[C#]

// Get access to first table on page, their first cell and text fragments in it
TextFragment fragment = absorber.TableList[2].RowList[0].CellList[0].TextFragments[1];
fragment.TextState.FontStyle = FontStyles.Bold;
// Change text of the first text fragment in the cell
fragment.Text = "hi world";

Please refer to this help topic: Manipulate tables in existing PDF. Please note, TableAbsorber class cannot retrieve a table without the complete borders.