Spread for ASP.NET 8.0 Product Documentation
Setting an Image Cell

An image cell can contain a graphic image from a file. The cell may or may not already have text associated with it. The text can be displayed to the right or the left of the image in the cell.

Image Cell Type Example

To create a cell that contains an image, follow this procedure.

For details on the properties and methods for this cell type, refer to the ImageCellType class in the Assembly Reference.

Using Code

  1. Define the image cell type by creating an instance of the ImageCellType class.
  2. Set the text to appear to the left or right of the image.
  3. Assign the image cell to a cell (or cells).

Example

This example sets the column and width of the cell so that the image and text can appear together alongside each other, sets the cell type to image cell, and sets the defined text to appear to the left of the graphic image.

C#
Copy Code
FpSpread1.Sheets[0].Columns[1].Width = 240;
FpSpread1.Sheets[0].Rows[1].Height = 50;
FarPoint.Web.Spread.ImageCellType imagecell = new FarPoint.Web.Spread.ImageCellType();
imagecell.ImageUrl = "images\fplogo.jpg";
imagecell.TextOnRight = false; // display text to left of image
FpSpread1.ActiveSheetView.Cells[1,1].Text="This is the logo.";
FpSpread1.ActiveSheetView.Cells[1,1].CellType = imagecell;
VB
Copy Code
FpSpread1.Sheets(0).Columns(1).Width = 240
FpSpread1.Sheets(0).Rows(1).Height = 50
Dim imagecell As New FarPoint.Web.Spread.ImageCellType()
imagecell.ImageUrl = "images\fplogo.jpg"
imagecell.TextOnRight = false
FpSpread1.ActiveSheetView.Cells(1,1).Text="This is the logo."
FpSpread1.ActiveSheetView.Cells(1,1).CellType = imagecell

Using the Spread Designer

  1. In the work area, select the cell or cells for which you want to set the cell type.
  2. Select the Home menu.
  3. Select the SetCellType icon under the CellType section.
  4. Select the cell type and any other cell properties.
  5. Select OK to close the dialog.
  6. Click Apply and Exit to close the Spread Designer.
See Also

 

 


Copyright © GrapeCity, inc. All rights reserved.

Support Options | Documentation Feedback