BASIC|Calc: How delete empty cells in all range in one pass

asked 2019-10-25 09:12:27 +0100

chris1701 gravatar image

Hi

The next problem is how to quick delete all empty cells in a range.

I wrote the code that delete empty cell in a 3 dimension array:

    for x=0 to max_col
      for y=0 to max_row
        if cell="" then                 
                Doc.Sheets(1).removeRange(CellRangeAddress,com.sun.star.sheet.CellDeleteMode.LEFT)
       end if
     next y
   next x

This is simple example not the whole code but its work. The problem is that its work weary slow

Is there any other solution to delete empty cells in whole range in one pass?

edit retag flag offensive close merge delete

Comments

You may look at this extension, that was also very slow initially; so I had to tweak it to not use removeRange in the loop, and instead move blocks up, and then remove one trailing range.

Mike Kaganski gravatar imageMike Kaganski ( 2019-10-25 09:23:20 +0100 )edit