Spread for ASP.NET 10 Product Documentation > Developer's Guide > Customizing with Cell Types > Working with Graphical Cell Types > 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.
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.
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 |