Quantcast
Channel: Aspose.Pdf Product Family
Viewing all articles
Browse latest Browse all 3131

PDF table rows overlap each other if table goes over a page

$
0
0
Hello

I have an issue when a table goes over a page long. The first two rows on the new page seem to render on top of each other (see attached screenshot and Output.pdf).

I don't think I am doing anything to fancy. It seems to be related to setting the PageMarginTop and PageMarginBottom values in the section. If I leave these out it seems to render OK.

Any help appreciated. I just upgraded to the latest version of Aspose.Pdf: 8.9.0.0 (.net 3.5 version).

Cheers,
Dave

Code (XML is attached):
        public bool ExportTestPdf()
        {
            Pdf pdf = new Pdf();
            XmlDocument pdfXml = new XmlDocument();
            pdfXml.LoadXml(Resources.TestPdf);
            pdf.BindXML(pdfXml, null);

            Section sectionMain = pdf.Sections["SectionMain"];
           
            Table questionTable = (Table)sectionMain.Paragraphs["QuestionTable"];

            Row baseHeaderRow = questionTable.Rows["Header"];
            questionTable.Rows.Remove(baseHeaderRow);

            Row baseRow = questionTable.Rows["BaseRow"];
            questionTable.Rows.Remove(baseRow);

            for (int i = 0; i < 80; i++)
            {
                if (i % 20 == 0)
                {
                    Row rowHeader = (Row)baseHeaderRow.CompleteClone();

                    Segment headerText = ((Text)rowHeader.Cells["QuestionHeaderCell"].Paragraphs["QuestionHeaderLabel"]).Segments[0];

                    headerText.Content = "Some Topic: " + i;

                    questionTable.Rows.Add(rowHeader);
                }

                Row row = (Row)baseRow.CompleteClone();

                Segment questionText = ((Text)row.Cells["QuestionCell"].Paragraphs["QuestionLabel"]).Segments[0];

                questionText.Content = "This is a question: " + i;

                questionTable.Rows.Add(row);
            }

            string filename = "Output.pdf";

            pdf.Save(filename, SaveType.OpenInAcrobat, HttpContext.Current.Response);

            return true;
        }

Viewing all articles
Browse latest Browse all 3131

Trending Articles