Friday, July 04, 2008  



 FarPoint Technologies
 (800) 645-5913

 fpsales@fpoint.com



     
 »Spread for Windows Forms » Product Tour » Managing Data » Placing and Retrieving Data

Previous Placing and Retrieving Data Next

You can place (set) data in cells using a variety of methods and retrieve (get) the data using a complimentary set of methods.

  Back to Top
 Handling Data Using Sheet Methods
You can place data in cells as formatted or unformatted strings or as data objects. The best way to place data in cells depends on whether you want to add string data or data objects, and if you want to add data to an individual cell or to a range of cells. These apply to the sheet:

Add: Apply To: Use:
string with formatting
(for example "$1,234.56")
Individual cell GetText
SetText
Range of cells GetClip
SetClip
string without formatting
(for example "1234.45")
Individual cell GetValue
SetValue
Range of cells GetClipValue
SetClipValue
data object with formatting Range of cells GetArray
SetArray


// Add data to cells A1 through C3
fpSpread1.Sheets[0].SetClip(0, 0, 3, 3,"Sunday\tMonday\tTuesday\r\nWednesday\tThursday\tFriday\r\nSatur day\tSunday\tMonday");

' Add data to cells A1 through C3
FpSpread1.Sheets(0).SetClip(0, 0, 3, 3, "Sunday" + vbTab + "Monday" + vbTab + "Tuesday" + vbCrLf + "Wednesday" + vbTab + "Thursday" + vbTab + "Friday" + vbCrLf + "Saturday" + vbTab + "Sunday" + vbTab + "Monday")


  Back to Top
 Handling Data Using Cell Properties
You can place data in cells as formatted or unformatted strings or as data objects. The best way to place data in cells depends on whether you want to add string data or data objects, and if you want to add data to an individual cell or to a range of cells. These apply to the cell:

Add: Use:
string with formatting
(for example "$1,234.56")
Text
string without formatting
(for example "1234.45")
Value

// C#
FpSpread1.ActiveSheet.Cells[0, 0].Text = "$1234.53";
FpSpread1.ActiveSheet.Cells[0, 1].Value = "1234.53";

' VB
FpSpread1.ActiveSheet.Cells(0, 0).Text = "$1234.53"
FpSpread1.ActiveSheet.Cells(0, 1).Value = "1234.53"


  Back to Top
 Repeatedly Filling a Range of Cells with Copied Cells
You can copy a range of cells and fill another range with those cells, copying the data and the cell type, etc. For example, if you have a 2x2 range, you can repeat (fill) down the next 5 groups of 2x2 vertically.

// Fills a range of cells
fpSpread1.ActiveSheet.Cells[0, 0, 1, 1].Text = "Fill";
fpSpread1.ActiveSheet.FillRange(3, 0, 1, 1, 1, FarPoint.Win.Spread.FillDirection.Right);

' Fills a range of cells
FpSpread1.ActiveSheet.Cells(0, 0, 1, 1).Text = "Fill"
FpSpread1.ActiveSheet.FillRange(4, 0, 1, 1, 1, FarPoint.Win.Spread.FillDirection.Down)


Previous Placing and Retrieving 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)

Tour Home
Overview
Appearance
User Interaction
Cell Types
Formulas
Managing Data
Data Binding
Import/Export
Printing
Keyboard Interaction
Shapes
Models
Spread Designer
 
Map

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