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

            Bug ID: 157053
           Summary: Writer: error for re-used variable when macro changes
                    the witdh of cells in TextTable
           Product: LibreOffice
           Version: unspecified
          Hardware: x86-64 (AMD64)
                OS: Windows (All)
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: Writer
          Assignee: [email protected]
          Reporter: [email protected]

I tried to change the Widths of Cells in TextTable via macro, but it is not
possible to use one variable repeatedly for it. 

1) open new Writer document
2) run macro, it shows error message: "Object not accessible. Invalid use of an
object."



Sub changeWidthsInTextTable
        dim oDoc as object, oTable as object, oVCur as object, oRow as object,
oCell as object, oTableCursor as object, aSeps()
        oDoc=ThisComponent
        rem insert table
        oTable=oDoc.createInstance("com.sun.star.text.TextTable")
        with oTable
                .initialize(3, 4) '3 rows, 4 columns
                .RelativeWidth=100
                .HoriOrient=0
        end with
        oVCur=oDoc.CurrentController.ViewCursor
        oDoc.Text.insertTextContent(oVCur.End, oTable, false)

        '1st change of cell-width -> OK
        oRow=oTable.Rows(0) '1st row
        aSeps=oRow.TableColumnSeparators
        aSeps(0).Position=500
        oRow.TableColumnSeparators=aSeps()

        '2nd change
        oRow=oTable.Rows(2) '3rd row

        'BUG
        'redim aSeps() 'also bug
        aSeps=oRow.TableColumnSeparators '!!! Error "Object not accessible.
Invalid use of an object."

        aSeps(0).Position=1500
        oRow.TableColumnSeparators=aSeps()      
End Sub



It is not possible to use aSeps() again, even the redim is used -> uncomment
line: redim aSeps()



Version: 7.6.1.1 (X86_64) / LibreOffice Community
Build ID: c7cda394c5de06de37d8109c310df89a4d4c3a98
CPU threads: 8; OS: Windows 10.0 Build 17763; UI render: Skia/Raster; VCL: win
Locale: cs-CZ (cs_CZ); UI: cs-CZ
Calc: CL threaded

Also in older version:

Verze: 5.4.7.2 (x64)
ID sestavení: c838ef25c16710f8838b1faec480ebba495259d0
Vlákna CPU: 2; OS: Windows 6.1; Vykreslování UI: výchozí;
Národní prostředí: cs-CZ (cs_CZ); Calc: CL

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

Reply via email to