https://bugs.documentfoundation.org/show_bug.cgi?id=173419

--- Comment #2 from Ismail <[email protected]> ---
I am providing a StarBasic macro as a partial workaround for this table
distortion issue.

Workaround Description:
This macro fixes the row misalignments by reading the standard column
separators (TableColumnSeparators) from the first row and applying them across
all subsequent rows in the table.

Limitations:

It is only a partial workaround.

To restore the table structure, it forces the cell text orientation back to
horizontal (oCell.WritingMode = 1), which removes the vertical text formatting
entirely.

While it aligns the column separators for tables (including LTR/English
tables), it does not fix the underlying engine bug when vertical text is
active.

Basic
Sub FixDocxTable1
    Dim oTables As Object
    Dim oTable As Object
    Dim oRows As Object
    Dim oRow0 As Object
    Dim oRow As Object
    Dim masterSeps As Variant
    Dim cellNames() As String
    Dim i As Long, j As Long
    Dim oCell As Object

    oTables = ThisComponent.TextTables
    If oTables.Count = 0 Then Exit Sub

    For i = 0 To oTables.Count - 1
        oTable = oTables.getByIndex(i)

        On Error Resume Next
        oTable.TableDirection = 1 ' Set RTL direction
        On Error GoTo 0

        oRows = oTable.Rows
        If oRows.Count > 0 Then
            oRow0 = oRows.getByIndex(0)
            masterSeps = oRow0.TableColumnSeparators

            For j = 1 To oRows.Count - 1
                oRow = oRows.getByIndex(j)
                If UBound(masterSeps) >= 0 Then
                    On Error Resume Next
                    oRow.TableColumnSeparators = masterSeps
                    On Error GoTo 0
                End If
            Next j
        End If

        cellNames = oTable.getCellNames()
        For j = 0 To UBound(cellNames)
            oCell = oTable.getCellByName(cellNames(j))
            On Error Resume Next
            oCell.WritingMode = 1 ' Reset text orientation to horizontal
            On Error GoTo 0
        Next j
    Next i
End Sub

-- 
You are receiving this mail because:
You are the assignee for the bug.

Reply via email to