Files
odfstudio/wizards/source/scriptforge/python
Jean-Pierre Ledure 43507de576 ScriptForge - (SF_Calc) new CompactUp() and CompactLeft() methods
The CompactUp(CompactLeft) method:

Delete the rows(columns) of a specified range matching a filter
expressed as a formula applied on each row(column).
The deleted cells can span whole rows(columns)
or be limited to the width(height) of the range.
The execution of the method has no effect on the
current selection.

Args:
  Range: the range in which cells have to be erased, as a string
  WholeRow(WholeColumn): when True (default = False),
    erase whole rows(columns)
  FilterFormula: the formula to be applied on each row(column).
    The row(column) is erased when the formula results in True.
    The formula shall probably involve one or more cells of
    the first row(column) of the range..
    By default, a row is erased when all the cells
    of the row(column) are empty,
    i.e. suppose the range is "A1:J200" (width = 10),
    the default value [for CompactUp] becomes "=(COUNTBLANK(A1:J1)=10)"

Returns:
  A string representing the location of the initial range
  after compaction, or the zero-length string if the whole range
  has been deleted.

Examples for CompactUp():
  newrange = oDoc.CompactUp("SheetX.G1:L10")
      ' All empty rows of the range are suppressed
  newrange = oDoc.CompactUp("SheetX.G1:L10", WholeRow := True, _
      FilterFormula := "=(G1=""X"")")
      ' The rows having a "X" in column G are completely suppressed

Both methods are available for use from Basic and Python scripts.

Change-Id: Ib1269b22bcd189ca86a1bd3bda2c67e895598cb0
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/132783
Tested-by: Jean-Pierre Ledure <jp@ledure.be>
Tested-by: Jenkins
Reviewed-by: Jean-Pierre Ledure <jp@ledure.be>
2022-04-10 18:06:05 +02:00
..