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
Reproduced in: Version: 24.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: b3fdd999f87312447d03915585812b3a5cd48141 CPU threads: 8; OS: Linux 5.15; UI render: default; VCL: gtk3 Locale: en-AU (en_AU.UTF-8); UI: en-US Calc: threaded Same in OOo 3.3. Using a different variable name (e.g. "aSeps2") works. However, I found that you don't need to reassign a second time with aSeps=oRow.TableColumnSeparators for what you want to achieve. Try this: 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 'aSeps=oRow.TableColumnSeparators aSeps(0).Position=1500 oRow.TableColumnSeparators=aSeps() End Sub Does that fix your issue? Related: https://ask.libreoffice.org/t/object-not-accessible-invalid-use-of-an-object-after-executeupdate/31829
It isn't fix of problem, but it is easy to bypass bug now. If there is used 2nd variable for oRow.TableColumnSeparators, then this 2nd variable is usable repeatedly without bug. So bypass is -> use one variable for initial settings (without repeated aSeps=oRow.TableColumnSeparators, only aSeps(X).Position=...), and 2nd variable for potential changes. 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 'aSeps=oRow.TableColumnSeparators aSeps(0).Position=1500 oRow.TableColumnSeparators=aSeps() rem functional with one variable aSeps2() used more times dim a$, i%, aSeps2() const max=3 for i=1 to max a=CInt(inputbox("Index of row - step " & i & "/" & max, "Change cell in 1st column to 80% width", i-1)) oRow=oTable.Rows(a) aSeps2=oRow.TableColumnSeparators 'no error aSeps2(0).Position=aSeps2(0).Position*0.8 'set only 80% of width oRow.TableColumnSeparators=aSeps2() next i End Sub
[Automated Action] NeedInfo-To-Unconfirmed
Dear Kamil Landa, To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year. There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present. If you have time, please do the following: Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/ If the bug is present, please leave a comment that includes the information from Help - About LibreOffice. If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice. Please DO NOT Update the version field Reply via email (please reply directly on the bug tracker) Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not appropriate in this case) If you want to do more to help you can test to see if your issue is a REGRESSION. To do so: 1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/ 2. Test your bug 3. Leave a comment with your results. 4a. If the bug was present with 3.3 - set version to 'inherited from OOo'; 4b. If the bug was not present in 3.3 - add 'regression' to keyword Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa Thank you for helping us make LibreOffice even better for everyone! Warm Regards, QA Team MassPing-UntouchedBug
Bug is still present Version: 26.2.0.0.alpha0+ (X86_64) / LibreOffice Community Build ID: 6d020f728b573c8c33929f8c494f9b748f576fe5 CPU threads: 8; OS: Windows 10 X86_64 (build 17763); UI render: Skia/Raster; VCL: win Locale: cs-CZ (cs_CZ); UI: en-US Calc: CL threaded