OpenOffice.org OpenOffice - 3.3 Základní průvodce Strana 326

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 434
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 325
Listing 16. A simple sheet filter using two columns.
Sub SimpleSheetFilter_2()
Dim oSheet ' Sheet to filter.
Dim oRange ' Range to be filtered.
Dim oFilterDesc ' Filter descriptor.
Dim oFields(1) As New com.sun.star.sheet.TableFilterField
oSheet = ThisComponent.getSheets().getByIndex(0)
oRange = oSheet.getCellRangeByName("E12:G19")
REM If argument is True, creates an
REM empty filter descriptor.
oFilterDesc = oRange.createFilterDescriptor(True)
REM Setup a field to view cells with content that
REM start with the letter b.
With oFields(0)
.Field = 0 ' Filter column A.
.IsNumeric = False ' Use a string, not a number.
.StringValue = "b.*" ' Everything starting with b.
.Operator = com.sun.star.sheet.FilterOperator.EQUAL
End With
REM Setup a field that requires both conditions and
REM this new condition requires a value greater or
REM equal to 70.
With oFields(1)
.Connection = com.sun.star.sheet.FilterConnection.AND
.Field = 5 ' Filter column F.
.IsNumeric = True ' Use a number
.NumericValue = 70 ' Values greater than 70
.Operator = com.sun.star.sheet.FilterOperator.GREATER_EQUAL
End With
oFilterDesc.setFilterFields(oFields())
oFilterDesc.ContainsHeader = False
oFilterDesc.UseRegularExpressions = True
oSheet.filter(oFilterDesc)
End Sub
Advanced filters
An advanced filter supports up to eight filter conditions, as opposed to the three
supported by the simple filter. The criteria for an advanced filter is stored in a sheet.
The first step in creating an advanced filter is entering the filter criteria into the
spreadsheet.
1) Select an empty space in the Calc document. The empty space may reside in
any sheet in any location in the Calc document.
326 OpenOffice.org 3.3 Calc Guide
Zobrazit stránku 325
1 2 ... 321 322 323 324 325 326 327 328 329 330 331 ... 433 434

Komentáře k této Příručce

Žádné komentáře