Friday, July 04, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread »Product Tour » Working with Data

Previous Working with Data Next

Return Formatted Data | Return Unformatted Data | Copy, Move, Swap, Delete Data | Sort Data | Add Formulas to a Spreadsheet | Allow Users to Enter Formulas | Create and Use Custom Functions | Search for Data

  Back to Top
 Return Formatted Data
   You can return formatted data using different properties or methods, depending on the data you want to return.

Clip: Use to return a block of data
Text: Use to return data for a cell
GetText: Similiar to the Text property, but a much faster method


The following example returns the text from cell B2

fpSpread1.GetText 1, 2, varText


  Back to Top
 Return Unformatted Data
   You can return unformatted data using different properties or methods, depending on the data you want to return.

ClipValue: Use to return a block of data
Value: Use to return data for a cell
GetFloat, GetInteger: Use to return data for numeric cells


The following example returns the value of cell B2.

fpSpread1.Col = 1
fpSpread1.Row = 2
strText = fpSpread1.Value

 Back to Top
 Copy, Move, Swap, Delete Data
   Your user can copy, move, swap and delete data in the Spread or you can programatically do this through code.

This example copies the first 2 rows and columns to column 1 beginning on row 4. Spread also supports the clipboard so you can copy data using the shortcut keys.

fpSpread1.CopyRange 1, 1, 5, 5, 1, 10

  Back to Top
 Sort Data
   You can sort spreadsheet data using up to 256 sort keys. To sort data, first specify the data you want to sort, then specify which column or row you want to sort by, the priority of that column or row in the sort (sort by that column or row first, second, third, and so on), and whether you want to sort in ascending or descending order.

The following example sorts the data on column 2

fpSpread1.SortKey(1) = 2
fpSpread1.SortKeyOrder(1) = SS_SORT_ORDER_ASCENDING
fpSpread1.Sort -1, -1, -1, -1, SortByRow

  Back to Top
 Add Formulas to a Spreadsheet
   You can define formulas (mathematical expressions) for currency, number, and percent cells in a spreadsheet. The fpSpread control includes over 100 mathematical, logical, and statistical functions.

The following example sums the range of cells A1 through A4 and places the total in cell B2.

fpSpread1.Row = 2
fpSpread1.Col = 2
fpSpread1.Formula = "SUM(A1:A4)"


  Back to Top
  Allow Users to Enter Formulas
   By default, users cannot enter formulas in cells in the spreadsheet. If you prefer, you can let users enter formulas in currency, number, and percent cells.

fpSpread1.AllowUserFormulas = True


  Back to Top
 Create and Use Custom Functions
   If Spread does not contain a needed function, you can define your own custom functions to use.

The following examples creates a new custom function named FARPOINT. The code for this function is placed within the CustomFunction event.

ret = fpSpread1.AddCustomFunction("FARPOINT", 3)
fpSpread1.Col = 2
fpSpread1.Row = 2
fpSpread1.Formula = "FARPOINT(B15,C15+1,D15)"
 

  Back to Top
 Search for Data
   You can search the spreadsheet for data by searching a specified column or row. You can also specify search options, such as whether to search for partial matches or to ignore text case.

The following example searches column 2 for "FarPoint" and displays the found row number in a message box.

ret = fpSpread1.SearchCol(2, 1, fpSpread1.MaxRows, "FarPoint", SearchFlagsNone)
MsgBox "FarPoint was found in row " & ret, 0, "Search"


Previous Working with Data Next

    
 Have a question?
Have a Question? Ask Us!
Subscribe to the RSS feed!RSS Subscribe
 

 
SD Times 'TOP 100' Industry Innovator - Read the press release (pdf)


Developer Tour
Adding Data
Saving Data
Working with Data
Working with Spreadsheets
Printing Spreadsheets
Customizing Columns and Rows
Working with Cells
Working with Cell Types
Binding to Databases
Customizing the Spreadsheet Display
Customizing User Interaction
Spread Designer Overview
50 Spread Events
Rate Tour

Copyright © 1991-2007 FarPoint Technologies, Inc. All rights reserved. All names are property of their respective owners.