Macro slow in version 4.1.3 and not in version 3.2.0

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
loomismilitia
Posts: 3
Joined: Wed Nov 30, 2016 11:39 am

Macro slow in version 4.1.3 and not in version 3.2.0

Post by loomismilitia »

Hello guys,

Maybe you can help me.

I have a macro to hide and unhide some rows in OpenOffice Calc.
It checks in one column if the cell value obeys a condition, if so hide or unhide that row.

I have recently installed the new OpenOffice 4.1.3 and this macro becomes running very slow.
In version 3.2.0 it runs very fast.

Do you have any thoughts??

Here is some code snippets I am using:

Code: Select all

Dim Sheet as  object
Dim srcCol as integer 
Dim strRow as integer

Sheet = ThisComponent.Sheets(0)
valCell = Sheet.getCellByPosition(srcCol,strRow) 
valCell.Rows.isVisible= false
 
OpenOffice 3.2.0 on Windows 10 / OpenOffice 4.1.3 on Windows 10
User avatar
Zizi64
Volunteer
Posts: 11361
Joined: Wed May 26, 2010 7:55 am
Location: Budapest, Hungary

Re: Macro slow in version 4.1.3 and not in version 3.2.0

Post by Zizi64 »

How you calculate or get the parameters srcCol, strRow?
How many rows you want hide or unhide?

Please upload your example .ods file and the full macro here.
Tibor Kovacs, Hungary; LO7.5.8 /Win7-10 x64Prof.
PortableApps/winPenPack: LO3.3.0-7.6.2;AOO4.1.14
Please, edit the initial post in the topic: add the word [Solved] at the beginning of the subject line - if your problem has been solved.
User avatar
RoryOF
Moderator
Posts: 34618
Joined: Sat Jan 31, 2009 9:30 pm
Location: Ireland

Re: Macro slow in version 4.1.3 and not in version 3.2.0

Post by RoryOF »

Put in a few timing printouts to narrow down where the problem occurs.
Apache OpenOffice 4.1.15 on Xubuntu 22.04.4 LTS
loomismilitia
Posts: 3
Joined: Wed Nov 30, 2016 11:39 am

Re: Macro slow in version 4.1.3 and not in version 3.2.0

Post by loomismilitia »

Hello,

You can find attached the example ods and the macro.

You should click on cell 'hide/unhide' to view the macro in action.
This is a loop from row 13 to row 9000.

Even if you comment all the lines on Sub ProcessSheet (maybe a heavy processing ) the macro is taking much more time compared to version 3.2.0 (it's instantaneous).

Thanks for your support.
Attachments
macro.txt
macro
(23.12 KiB) Downloaded 111 times
Example.ods
Example
(39.65 KiB) Downloaded 110 times
OpenOffice 3.2.0 on Windows 10 / OpenOffice 4.1.3 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro slow in version 4.1.3 and not in version 3.2.0

Post by Villeroy »

Runs within a second or two with LibreOffice5. Whatever that code tries to do, I'd prefer to do this without any macro code. Looks like a typical "VBA solution".
P.S. unhiding takes some 5 seconds.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
loomismilitia
Posts: 3
Joined: Wed Nov 30, 2016 11:39 am

Re: Macro slow in version 4.1.3 and not in version 3.2.0

Post by loomismilitia »

But this not answer why in version 3.2.0 it is instantaneous.
In version 4.1.3 it takes several seconds.
OpenOffice 3.2.0 on Windows 10 / OpenOffice 4.1.3 on Windows 10
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Macro slow in version 4.1.3 and not in version 3.2.0

Post by Villeroy »

Only a core developer could answer this question.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply