我正在尝试为 Spread.NET 创建自定义单元格类型。我得到的错误是
无法调用抽象基成员:'FarPoint.Web.Spread.BaseCellType.PaintCell(string, System.Web.UI.WebControls.TableCell, FarPoint.Web.Spread.Appearance, FarPoint.Web.Spread.Inset, object, bool) '
这是代码
[Serializable()]
public class BarcodeCellType : FarPoint.Web.Spread.BaseCellType
{
public override Control PaintCell(string id, TableCell parent, Appearance style, Inset margin, object value, bool upperLevel)
{
parent.Attributes.Add("FpCellType", "BarcodeCellType");
if (value != null)
{
try
{
MemoryStream ms = GenerateBarCode(value.ToString());
var img = Bitmap.FromStream(ms);
value = img;
}
catch (Exception ex)
{
value = ex.ToString();
}
}
return base.PaintCell(id, parent, style, margin, value, upperLevel); //ERROR HERE
}
private MemoryStream GenerateBarCode(string codeInfo)
{
using (MemoryStream ms = new MemoryStream())
{
BarCodeBuilder bb = new BarCodeBuilder();
bb.CodeText = codeInfo;
bb.SymbologyType = Symbology.Code128;
bb.BarCodeImage.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);
return ms;
}
}
}