Table Continuation

Skip Navigation LinksHome  /  Support  /  Forums  /  DynamicPDF CoreSuite for .NET (v8)  /  Re: Table Continuation

DynamicPDF CoreSuite for .NET (v8) Forum

 Feb 11 2016 9:27 AM
Hello !

I am using the GetOverflowRows() method for splitting a long Table into parts that fit on a Page. After the PageList is created i want to add an Outline for a specific Row of that long Table.

// The "Table Continuation" is done in a seperate helper class so i just have the resulting PageList and the Row i remembered when building the long Table :/

So my solution was to iterate through the PageList and check for each Table on each Page if the Row is in that specific Table, but each Table on each Page has all Rows and some kind of "ViewWindow" / "StartRow" that defines the Rows to be drawn for that Page.. so i cannot find out on which Page the Row really is.

// It is possible to GetVisibleRowCount() for each Table, but i cannot determine where the Table starts.. :(

While debugging the Table objects i discovered a private member called  "StartRow"  that already holds the information i would need, but its a private member so i cannot access it.

So my final question is: Can u please provide a Public property or method that returns the StartRow of the Table object e.g. GetVisibleStartRow() ??

Combined with the GetVisibleRowCount() method i could determine the "ViewWindow" for each Table object.. that would be so great!

--------------

Our company (Plasser & Theurer) is using your product(s) for a long time now (couple of years) and we are very satisfied with it.

--------------

Thanks for your Respone!
 Feb 12 2016 9:32 AM
Posted by a ceTe Software moderator
Hello,

Can you please send over the following details to support@cete.com so we can look into it further?

1.Exact version and build number of the DynamicPDF DLL file used in the application. You can get this information in DLL references properties (Version and Description fields) in Visual Studio.
2.Screenshot showing the “StartRow” private member in debug mode.

The above details will help our developers to investigate this further to decide whether the “StartRow” private member can be made as public or not. 

Thanks,
ceTe Software Support Team
 Mar 01 2016 5:07 AM
Posted by a ceTe Software moderator
Hello,

Thanks for sending all the details to our support team. Our developers analyzed this and marked the VisibleStartRow as public member using which you can get the starting row number of the table.  This feature is included in v8.0.1 DynamicPDF API. You can download the v8.0.1 DynamicPDF product including this feature from our website here. Also below is code sample to use VisibleStartRow property.

            Document document = new Document();
            string someText = "Text to test  ";
            Table2 table = new Table2(0, 0, 400, 700);
            table.Columns.Add(200);
            for (int i = 1; i < 500; i++)
            {
                Row2 row = table.Rows.Add();
                Cell2 cell1 = row.Cells.Add(someText + i);
                cell1.Splittable = true;
            }
            do
            {
                Page page = new Page();
                document.Pages.Add(page);
                int startRow = table.VisibleStartRow;
                page.Elements.Add(table);
                table = table.GetOverflowRows();
                
            } while (table != null);

            document.InitialPageZoom = PageZoom.FitPage;
            document.Draw(@"C:\Temp\Mydocument.pdf");

Thanks,
ceTe Software Support Team.
 Aug 14 2017 6:26 AM
I have a similar problem. To calculate overflows for table, row and cells I was using the below internal properties by getting their values via reflection in cete Dynamic PDF version 6

StartRow and EndRow properties for Table2 object
StartLine, EndLine, Lines and CellEnd properties for Cell2 object
Splitted property of Row2 object

Below is the method that gets the property values via reflection:

Private Shared Function GetPropertyValue(Of T)(ByVal obj As Object, ByVal name As String, ByVal defaultValue As T) As T
        If obj Is Nothing Then
            Return defaultValue
        End If
        Dim pi As Reflection.PropertyInfo = obj.GetType().GetProperty(name,
                Reflection.BindingFlags.GetProperty Or
                Reflection.BindingFlags.Instance Or
                Reflection.BindingFlags.NonPublic)
        If pi Is Nothing Then
            Return defaultValue
        End If
        Return CType(pi.GetValue(obj, Nothing), T)
End Function


Now we bought license for cete Dynamic PDF version 8 and saw that these internal properties are not available anymore. Using these internal properties is very critical for rendering the output correctly.

Can these internal properties be added back to version 8? I need to find a workaround.

Thanks
MERT SUSTA
 Aug 14 2017 4:19 PM
Posted by a ceTe Software moderator
Hello Mert,

We do not recommend using undocumented internal methods/properties as they are subject to change and we cannot guarantee their availability in future versions. We suggest that you use public members that are documented in the product documentation. In Table2 class we have already exposed StartRow internal property as a public property VisibleStartRow. However, not all internal properties can be made public this way. 

Please try to achieve your requirements using the public members available in v8 listed below:

Table2 Members

Cell2 Members

Row2 Members

In case you are unable to achieve your requirements using these public members, please email the details of your requirements to support@cete.com.
Thanks,
ceTe Software Support Team.
 Aug 15 2017 4:48 AM
Thank you for your reply. My problem is when the last row does not fit into page and is splitted into two I cannot know how the text content inside the row cells are splitted. The splitted text in current page and overflow text written in next page at the top.

In version 6 I was using StartLine, EndLine and Lines internal properties of Cell2 object as displayed in below code:


Dim startLine As Integer = GetPropertyValue(cell, "StartLine", 0)
Dim endLine As Integer = GetPropertyValue(cell, "EndLine", 0)
Dim lineList As Text.TextLineList = GetPropertyValue(Of Text.TextLineList)(cell, "Lines", Nothing)

If startLine > 0 OrElse lineList.Count > endLine Then
        Dim lines() As Text.TextLine = GetPropertyValue(Of Text.TextLine())(lineList, "Lines", Nothing)
        Dim lastLine As Text.TextLine = lines(endLine - 1)
        Dim splittedText As String = cellText.Substring(lines(startLine).Start, lastLine.Start + lastLine.Length)
        Dim overflowText As String = cellText.Substring(lines(endLine).Start)
        printableCell = lastPrintableRow.Cells.Add(splittedText)
        CopyCellProperties(cell, printableCell)
        nextFirstRowText.Add(overflowText)
        Continue For
End If
 Aug 18 2017 2:16 PM
Posted by a ceTe Software moderator
Hello,

Both v6 & v8 have the capability to automatically split the cell if they overflow. It is not necessary to use the internal methods to make the content split manually.

For the split to happen automatically you have to enable the Splittable property on Cell2 object, this property is available in both v6 and v8. Here is the sample code that should split the overflow cell contents between the current and next page automatically.

        Dim MyDocument As Document = New Document

        Dim MyTable As Table2 = New Table2(0, 0, 100, 700)

        ' Add columns to the table
        MyTable.Columns.Add(100)


        ' This loop populates the table
        Dim I As Integer
        For I = 1 To 35
            Dim MyRow As Row2 = MyTable.Rows.Add(20)
            Dim cell As Cell2 = MyRow.Cells.Add("Test Row with long text #" & I)            
            cell.Splittable = True
        Next

        Do
            Dim MyPage As Page = New Page
            MyDocument.Pages.Add(MyPage)
            MyPage.Elements.Add(MyTable)
            MyTable = MyTable.GetOverflowRows()
        Loop While Not (MyTable Is Nothing)
       
        MyDocument.Draw("output.pdf")


Thanks,
ceTe Software Support Team.
 Aug 18 2017 2:20 PM
Thank you for your reply. I will try that.

All times are US Eastern Standard time. The time now is 4:30 AM.