Skip to main content
Known Participant
March 15, 2024
Question

overset table textfram select

  • March 15, 2024
  • 1 reply
  • 684 views

Textframe contains a large table. I want to copy the overset table values to the next frame. I am using visual studio vb.net 2022. My table is within iTableCaptionFrame. the frame placed correctly. the overflows output is true. I  dont know how to copy the overset values. Kindly help

 

Dim iTableCaptionFrame As InDesign.TextFrame = Nothing
iTableCaptionFrame = indesignDocument.TextFrames.Add(, InDesign.idLocationOptions.idAfter, parentTextFram)
iTableCaptionFrame.PlaceXML(iTGrpELm)

iTableCaptionFrame.GeometricBounds = New Object() {8, -30, -8 + tableElm.Height, tableElm.Width - 30}
iTableCaptionFrame.Fit(InDesign.idFitOptions.idFrameToContent)
indesignDocument.Selection = InDesign.idNothingEnum.idNothing
indesignDocument.Select(iTableCaptionFrame)
Dim parenOrigY1 = parentTextFram.GeometricBounds(0)
Dim parenOrigX1 = parentTextFram.GeometricBounds(1)
Dim parenOrigY2 = parentTextFram.GeometricBounds(2)
Dim parenOrigX2 = parentTextFram.GeometricBounds(3)
nextparentTextFram = parentTextFram.NextTextFrame
parentTextFram.Delete()
iTableCaptionFrame.Move(indesignApplication.ActiveDocument.Pages.Item(parentTextFramId + 2))
iTableCaptionFrame.RotationAngle = 90


iTableCaptionFrame.GeometricBounds = New Object() {parenOrigY2, parenOrigX2, parenOrigY1, parenOrigX1}

Dim tabColcount = tableElm.Columns.Count
Dim celExpandWidth = Math.Round(parentFramheight / tabColcount)

For rowNum As Integer = 1 To tableElm.Rows.Count
Dim curRow As InDesign.Row = tableElm.Rows.Item(rowNum)
For celNum As Integer = 1 To curRow.Cells.Count
If curRow.Cells.Count = tabColcount Then
Dim curCel As InDesign.Cell = curRow.Cells.Item(celNum)
curCel.Width = celExpandWidth
End If
Next
Next

If iTableCaptionFrame.Overflows = True Then

end if 

 

This topic has been closed for replies.

1 reply

Community Expert
March 15, 2024

I'm not 100% sure to be honest, just my 2 cents. I'm probably completely wrong.

 

If iTableCaptionFrame.Overflows = True Then
    ' Get the overset text from the table
    Dim oversetText As String = iTableCaptionFrame.Contents

    ' Create a new text frame for the overflow content
    Dim overflowFrame As InDesign.TextFrame = indesignDocument.TextFrames.Add(, InDesign.idLocationOptions.idAfter, iTableCaptionFrame)
    
    ' Place the overset text into the overflow frame
    overflowFrame.Contents = oversetText

    ' Adjust the position of the overflow frame as needed
    overflowFrame.Move(indesignApplication.ActiveDocument.Pages.Item(parentTextFramId + 3)) ' Move to the next page or desired location

    ' Optionally, you can resize the overflow frame to fit its content
    overflowFrame.Fit(InDesign.idFitOptions.idFrameToContent)
End If

 

Known Participant
March 15, 2024
when use iTableCaptionFrame.Contents it returns the whole contents. I want to copy the contents within overset . the red plus symbol. Thanks in advance. help me to clear
Community Expert
March 15, 2024

Ah ok
Maybe an empty strign then loop for oveset content?

 

Something like this?

If iTableCaptionFrame.Overflows = True Then
    Dim oversetText As String = ""

    ' Iterate through the text contents to find the overset text
    For Each textItem As InDesign.Text in iTableCaptionFrame.Texts
        If textItem.Overset = True Then
            oversetText = textItem.Contents
            Exit For ' Exit the loop once overset text is found
        End If
    Next

    ' If overset text is found, proceed to handle it
    If oversetText <> "" Then
        ' Create a new text frame for the overset content
        Dim overflowFrame As InDesign.TextFrame = indesignDocument.TextFrames.Add(, InDesign.idLocationOptions.idAfter, iTableCaptionFrame)
        
        ' Place the overset text into the overflow frame
        overflowFrame.Contents = oversetText

        ' Adjust the position of the overflow frame as needed
        overflowFrame.Move(indesignApplication.ActiveDocument.Pages.Item(parentTextFramId + 3)) ' Move to the next page or desired location

        ' Optionally, you can resize the overflow frame to fit its content
        overflowFrame.Fit(InDesign.idFitOptions.idFrameToContent)
    End If
End If