If you are using the Spread 8.0 ActiveX control in Visual Studio .NET, please keep in mind the following:
- The EditMode property is listed as Ctl.EditMode in Visual Basic .NET. The EditMode property without the ctl is readonly.
- Context-sensitive help does not work when you are using the control in Visual Studio .NET. Alternatively, you can access the help for the product through the Start->Programs->Spread 8->Documentation->Online Help menu item.
- To display the Spread Designer when working with the control in C++, double-click the control. The right-click pop-up menu does not display a menu item to open the Spread Designer.
- Enumerations are not defined the same for Visual Basic .NET as they were in previous versions of Visual Basic. For example, to use the SpreadHeader constant, you can use the numeric equivalent (-999), or you can use the enumeration in which the constant now resides, the CoordConstant enumeration. The code for using the constant would now be:
AxfpSpread1.Row = FPSpread.CoordConstants.SpreadHeader
To view the enumerations in Spread 8, use the Object Browser in Visual Studio .NET.
- Setting pictures in code requires different code, as shown in the following example that loads a bitmap into a picture cell:
AxfpSpread1.Col = 1
AxfpSpread1.Row = 1
AxfpSpread1.CellType = FPSpread.CellTypeConstants.CellTypePicture
AxfpSpread1.TypePictPicture =
System.Drawing.Bitmap.FromFile("C:\Files\marble.bmp")
- The following code illustrates how to call the GetText method in Visual Basic .NET and C#:
-
[Visual Basic]
Dim ret As Boolean
Dim var As Object
ret = AxfpSpread1.GetText(1, 1, var)
MsgBox(Convert.ToString(var))
Or
Dim i As Long
Dim ret As Boolean
Dim var As Object
For i = 1 To 3
ret = AxfpSpread1.GetText(1, i, var)
TextBox1.Text = var
Erase var
Next i
[C#]
public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;
private AxfpSpread.AxfpSpread AxfpSpread1;
[MarshalAs(UnmanagedType.BStr)] public object var;
private void button1_Click(object sender, System.EventArgs e)
{
AxfpSpread1.GetText(1, 1, ref var);
System.Windows.Forms.MessageBox.Show(var.ToString());
}
}
- The following code illustrates how to use flags with the PrintSheet method in C#:
-
[C#]
object printflag;
printflag=1;
axvaSpread1.PrintSheet(ref printflag);