下面的DEMO能再现:
<%@ Page Language="VB" Inherits="System.Web.UI.Page" %>
<!DOCTYPE html>
<script language="VB" type="text/VB" runat="server">
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
If Request.Item("fpcallback") = "true" Then
Return
End If
InitVaSpread1()
End Sub
Private Sub InitVaSpread1()
vaSpread1.EditModeReplace = True
vaSpread1.ProcessTab = True
vaSpread1.HorizontalScrollBarPolicy = ScrollBarPolicy.Never
vaSpread1.VerticalScrollBarPolicy = ScrollBarPolicy.Always
vaSpread1.ActiveSheetView.DefaultRowHeight = 37
vaSpread1.ActiveSheetView.RowCount = 3
vaSpread1.ActiveSheetView.ColumnCount = 3
vaSpread1.ActiveSheetView.Columns(0).Width = 119.04
vaSpread1.ActiveSheetView.Columns(1).Width = 271.04
vaSpread1.ActiveSheetView.Columns(2).Width = 0.0
vaSpread1.ActiveSheetView.Columns(0).BackColor = Drawing.Color.Yellow
vaSpread1.ActiveSheetView.Columns(1).CellType = New TextCellType With {.AllowWrap = True}
Dim validator As New GrapeCity.Web.Input.IMValidators.GcTextLengthValidator()
validator.ValidateOnInput = True
validator.ErrorMessage = "Maxlength over 50 bytes"
validator.MaximumLength = 50
validator.LengthAsByte = True
DirectCast(vaSpread1.ActiveSheetView.Columns(1).CellType, TextCellType).Validators.Add(validator)
vaSpread1.ColumnHeader.Visible = False
vaSpread1.RowHeader.Visible = False
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script type="text/javascript" src="Scripts/SpreadExtensions.js"></script>
<script type="text/javascript">
window.addEventListener("load", function () {
var fpSpread = FpSpread("vaSpread1");
fpSpread.CallBack("XXX");
for (i = 0 ; i < 3 ; i++) {
fpSpread.SetValue(i, 0, "AAA", true);
fpSpread.SetValue(i, 1, "ABCDEFG", true); //发生异常的地方
}
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="hidden" name="VASPREAD1_CALLBACK_HREF" value="<%=Request.Url%>"/>
<FarPoint:FpSpread ID="vaSpread1" runat="Server" BorderColor="#A0A0A0" BorderStyle="Solid" BorderWidth="1px" Height="159" Width="409" >
<commandbar backcolor="#F6F6F6" buttonfacecolor="Control" buttonhighlightcolor="ControlLightLight" buttonshadowcolor="ControlDark"></commandbar>
<sheets>
<FarPoint:SheetView SheetName="Sheet1">
</FarPoint:SheetView>
</sheets>
</FarPoint:FpSpread>
</div>
</form>
</body>
</html>
|