On 05/08/2011, Andreas Säger <[email protected]> wrote: > Am 04.08.2011 09:03, Onyeibo Oku wrote: >> I did a python macro that adds sheets, renames them and fills in some >> formula in select cells. It also has a portion that deletes the sheets. >> >> I find that the sheet creation runs faster although there's more lines of >> code running. Whereas the sheet removal macro is just 2lines and runs >> 3-5times slower. Both routines use 'FOR' loops (the creating routine even >> has a nested loop). >> >> What could be responsible? Does calc recalculate for each removed sheet? >> Can that feature be toggled off via macro just before the removal loops >> ...and toggled back on? >> >> Thanks in advance :) >> --------------------------------------------- >> from [email protected] :) >> > > Removed sheets may have references, a new sheet can not have any > references nor is it referenced. > > bAC = isAutomaticCalculationEnabled() > doc.enableAutomaticCalculation(False) > do_stuff > doc.enableAutomaticCalculation(bAC) >
Thanks Andreas, I've done that but the problem persists. I also made another observation. One of the reserved sheets have formulas spanning about 10columns by 1750rows (some of them having up to 4-6levels of nested 'IF's with conditional formats). When I remove that sheet, the macro executes instantly. What I don't understand is why Calc still computes that sheet while deleting other sheets. The macro makes no reference to it and it doesn't reference the deleted sheets. The 'culprit' sheet uses named cell refs but all within itself except one cell that references a cache sheet which never gets deleted. More baffling is that it happens with AutomaticCalculation set to False. I wonder if watching the huge range with a listener will produce better performance results. -- For unsubscribe instructions e-mail to: [email protected] Problems? http://www.libreoffice.org/get-help/mailing-lists/how-to-unsubscribe/ Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette List archive: http://listarchives.libreoffice.org/global/users/ All messages sent to this list will be publicly archived and cannot be deleted
