FpSpread1.ActiveSheetView.GetText(1, 1)取不到值
开发工具:vs2017 Spread12文件名Test11.aspx前端代码如下:
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Test11.aspx.vb" Inherits="BillFind_Test11" %>
<%@ Register assembly="FarPoint.Web.Spread, Version=12.45.20182.0, Culture=neutral, PublicKeyToken=327c3516b1b18457" namespace="FarPoint.Web.Spread" tagprefix="FarPoint" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<FarPoint:FpSpread ID="FpSpread1" runat="server" BorderColor="#A0A0A0" BorderStyle="Solid" BorderWidth="1px" EditModeReplace="True" Height="200px" Width="400px" ActiveSheetViewIndex="0" currentPageIndex="0" DesignString="<?xml version="1.0" encoding="utf-8"?><Spread />" pageSize="10">
<TouchInfo SelectionGripperLineColor=""></TouchInfo>
<commandbar backcolor="#F6F6F6" buttonfacecolor="Control" buttonhighlightcolor="ControlLightLight" buttonshadowcolor="ControlDark" Visible="False">
<Background BackgroundImageUrl="SPREADCLIENTPATH:/img/cbbg.gif"></Background>
</commandbar>
<sheets>
<FarPoint:SheetView SheetName="Sheet1" AllowPage="False" DesignString="<?xml version="1.0" encoding="utf-8"?><Sheet><Data><RowHeader class="FarPoint.Web.Spread.Model.DefaultSheetDataModel" rows="3" columns="1"><AutoCalculation>True</AutoCalculation><AutoGenerateColumns>True</AutoGenerateColumns><ReferenceStyle>A1</ReferenceStyle><Iteration>False</Iteration><MaximumIterations>1</MaximumIterations><MaximumChange>0.001</MaximumChange></RowHeader><ColumnHeader class="FarPoint.Web.Spread.Model.DefaultSheetDataModel" rows="1" columns="4"><AutoCalculation>True</AutoCalculation><AutoGenerateColumns>True</AutoGenerateColumns><ReferenceStyle>A1</ReferenceStyle><Iteration>False</Iteration><MaximumIterations>1</MaximumIterations><MaximumChange>0.001</MaximumChange></ColumnHeader><DataArea class="FarPoint.Web.Spread.Model.DefaultSheetDataModel" rows="3" columns="4"><AutoCalculation>True</AutoCalculation><AutoGenerateColumns>True</AutoGenerateColumns><ReferenceStyle>A1</ReferenceStyle><Iteration>False</Iteration><MaximumIterations>1</MaximumIterations><MaximumChange>0.001</MaximumChange><SheetName>Sheet1</SheetName></DataArea><SheetCorner class="FarPoint.Web.Spread.Model.DefaultSheetDataModel" rows="1" columns="1"><AutoCalculation>True</AutoCalculation><AutoGenerateColumns>True</AutoGenerateColumns><ReferenceStyle>A1</ReferenceStyle><Iteration>False</Iteration><MaximumIterations>1</MaximumIterations><MaximumChange>0.001</MaximumChange></SheetCorner><ColumnFooter class="FarPoint.Web.Spread.Model.DefaultSheetDataModel" rows="1" columns="4"><AutoCalculation>True</AutoCalculation><AutoGenerateColumns>True</AutoGenerateColumns><ReferenceStyle>A1</ReferenceStyle><Iteration>False</Iteration><MaximumIterations>1</MaximumIterations><MaximumChange>0.001</MaximumChange></ColumnFooter></Data><Presentation><AxisModels><Column class="FarPoint.Web.Spread.Model.DefaultSheetAxisModel" ShortXmlName="true" orientation="Horizontal" count="4"><Items><i i="-1"><SortIndicator>Ascending</SortIndicator></i></Items></Column><RowHeaderColumn class="FarPoint.Web.Spread.Model.DefaultSheetAxisModel" ShortXmlName="true" defaultSize="40" orientation="Horizontal" count="1"><Items><i i="-1"><SortIndicator>Ascending</SortIndicator><Size>40</Size></i></Items></RowHeaderColumn><ColumnHeaderRow class="FarPoint.Web.Spread.Model.DefaultSheetAxisModel" ShortXmlName="true" defaultSize="22" orientation="Vertical" count="1"><Items><i i="-1"><Size>22</Size></i></Items></ColumnHeaderRow><ColumnFooterRow class="FarPoint.Web.Spread.Model.DefaultSheetAxisModel" ShortXmlName="true" defaultSize="22" orientation="Vertical" count="1"><Items><i i="-1"><Size>22</Size></i></Items></ColumnFooterRow></AxisModels><StyleModels><RowHeader class="FarPoint.Web.Spread.Model.DefaultSheetStyleModel" Rows="3" Columns="1"><AltRowCount>2</AltRowCount><DefaultStyle class="FarPoint.Web.Spread.NamedStyle" Parent="RowHeaderDefault" /><ConditionalFormatCollections /></RowHeader><ColumnHeader class="FarPoint.Web.Spread.Model.DefaultSheetStyleModel" Rows="1" Columns="4"><AltRowCount>2</AltRowCount><DefaultStyle class="FarPoint.Web.Spread.NamedStyle" Parent="ColumnHeaderDefault" /><ConditionalFormatCollections /></ColumnHeader><DataArea class="FarPoint.Web.Spread.Model.DefaultSheetStyleModel" Rows="3" Columns="4"><AltRowCount>2</AltRowCount><DefaultStyle class="FarPoint.Web.Spread.NamedStyle" Parent="DataAreaDefault" /><ConditionalFormatCollections /></DataArea><SheetCorner class="FarPoint.Web.Spread.Model.DefaultSheetStyleModel" Rows="1" Columns="1"><AltRowCount>2</AltRowCount><DefaultStyle class="FarPoint.Web.Spread.NamedStyle" Parent="CornerDefault" /><ConditionalFormatCollections /></SheetCorner><ColumnFooter class="FarPoint.Web.Spread.Model.DefaultSheetStyleModel" Rows="1" Columns="4"><AltRowCount>2</AltRowCount><DefaultStyle class="FarPoint.Web.Spread.NamedStyle" Parent="ColumnFooterDefault" /><ConditionalFormatCollections /></ColumnFooter></StyleModels><MessageRowStyle class="FarPoint.Web.Spread.Appearance"><BackColor>LightYellow</BackColor><ForeColor>Red</ForeColor></MessageRowStyle><SheetCornerStyle class="FarPoint.Web.Spread.NamedStyle" Parent="CornerDefault" /><AllowLoadOnDemand>false</AllowLoadOnDemand><LoadRowIncrement >10</LoadRowIncrement ><LoadInitRowCount >30</LoadInitRowCount ><LoadOnDemandMode >Standard</LoadOnDemandMode ><LoadOnDemandInterval >500</LoadOnDemandInterval ><LoadOnDemandTriggerMode >Timed</LoadOnDemandTriggerMode ><LoadOffsetFromBottom >0</LoadOffsetFromBottom ><AllowVirtualScrollPaging>false</AllowVirtualScrollPaging><VirtualScrollPagingPrevRowCount>0</VirtualScrollPagingPrevRowCount><VirtualScrollPagingFormatString>第{page}页 共{count}页</VirtualScrollPagingFormatString><TopRow>0</TopRow><PreviewRowStyle class="FarPoint.Web.Spread.PreviewRowInfo" /></Presentation><Settings><Name>Sheet1</Name><Categories><Appearance><GridLineColor>#d0d7e5</GridLineColor><SelectionBackColor>#eaecf5</SelectionBackColor><SelectionBorder class="FarPoint.Web.Spread.Border" /></Appearance><Behavior><EditTemplateColumnCount>2</EditTemplateColumnCount><GroupBarText>拖放一个列以便按照该列进行分组。</GroupBarText><AllowPage>False</AllowPage></Behavior><Layout><ColumnHeaderRowCount>1</ColumnHeaderRowCount><RowHeaderColumnCount>1</RowHeaderColumnCount></Layout></Categories><ColumnHeaderRowCount>1</ColumnHeaderRowCount><ColumnFooterRowCount>1</ColumnFooterRowCount><PrintInfo><Header /><Footer /><ZoomFactor>0</ZoomFactor><FirstPageNumber>1</FirstPageNumber><Orientation>Auto</Orientation><PrintType>All</PrintType><PageOrder>Auto</PageOrder><BestFitCols>False</BestFitCols><BestFitRows>False</BestFitRows><PageStart>-1</PageStart><PageEnd>-1</PageEnd><ColStart>-1</ColStart><ColEnd>-1</ColEnd><RowStart>-1</RowStart><RowEnd>-1</RowEnd><ShowBorder>True</ShowBorder><ShowGrid>True</ShowGrid><ShowColor>True</ShowColor><ShowColumnHeader>Inherit</ShowColumnHeader><ShowRowHeader>Inherit</ShowRowHeader><ShowFilterBar>Inherit</ShowFilterBar><ShowColumnFooter>Inherit</ShowColumnFooter><ShowColumnFooterEachPage>True</ShowColumnFooterEachPage><ShowTitle>True</ShowTitle><ShowSubtitle>True</ShowSubtitle><UseMax>True</UseMax><UseSmartPrint>False</UseSmartPrint><Opacity>255</Opacity><PrintNotes>None</PrintNotes><Centering>None</Centering><RepeatColStart>-1</RepeatColStart><RepeatColEnd>-1</RepeatColEnd><RepeatRowStart>-1</RepeatRowStart><RepeatRowEnd>-1</RepeatRowEnd><SmartPrintPagesTall>1</SmartPrintPagesTall><SmartPrintPagesWide>1</SmartPrintPagesWide><HeaderHeight>-1</HeaderHeight><FooterHeight>-1</FooterHeight></PrintInfo><TitleInfo class="FarPoint.Web.Spread.TitleInfo"><Style class="FarPoint.Web.Spread.StyleInfo"><BackColor>White</BackColor><HorizontalAlign>Right</HorizontalAlign></Style></TitleInfo><LayoutMode>CellLayoutMode</LayoutMode><AutoFilterMode>FilterGadget</AutoFilterMode><CurrentPageIndex type="System.Int32">0</CurrentPageIndex></Settings></Sheet>">
</FarPoint:SheetView>
</sheets>
<TouchStrips>
<FarPoint:TouchStrip Area="Chart" NoTouchStrip="True"></FarPoint:TouchStrip>
</TouchStrips>
<TitleInfo BackColor="White" ForeColor="" HorizontalAlign="Center" VerticalAlign="NotSet" Font-Size="X-Large"></TitleInfo>
</FarPoint:FpSpread>
<asp:Button ID="Button1" runat="server" Text="Button" />
</div>
</form>
</body>
</html>
后端代码如下:
Partial Class BillFind_Test11
Inherits System.Web.UI.Page
Private Sub BillFind_Test11_Init(sender As Object, e As EventArgs) Handles Me.Init
FpSpread1.ActiveSheetView.SetText(1, 1, "Test")
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim strTemp As String
strTemp = FpSpread1.ActiveSheetView.GetText(1, 1).ToString
MsgBox(strTemp)
End Sub
End Class
现在的问题是按Button1按钮,永远显示的是Test,取不到最新输入的值(不管在对应的单元格输入什么值),一直取的是原来窗体初始化时候的值,请问是什么原因?
如果是用户修改的值,需要先提交数据到服务器才能获取到。 可以在button事件里先 FpSpread1.SaveChanges();再取值
页:
[1]