找回密码
 立即注册

QQ登录

只需一步,快速开始

feixing1357

注册会员

10

主题

23

帖子

61

积分

注册会员

积分
61

活字格认证

feixing1357
注册会员   /  发表于:2010-5-24 19:57  /   查看:7663  /  回复:1
在使用spread时,我发现spread自动生成的html代码太多了,以一个textbox为例,
a.使用ASP.NET,画面生成后,代码如下:
<th width="155" style="border-right: solid 1px #fff;">
     管理Code(<font color="#FF0000">※</font>)
</th>

b.我在一个Excel文件中画一个TextBox,画面上用spread打开该Excel文件,画面生成后,代码如下:

<tr FpSpread="r" FpKey="4" style="height:13px;">
    <td class="s2s10s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl23" FpCellType="readonly" col="4" scol="4" colspan="4" rowspan="2" style="overflow:hidden;"><nobr>管理コード(※)</nobr></td><td class="s4s16s0" valign="top" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl35" col="8" scol="8" colspan="6" rowspan="2" style="overflow:hidden;padding-right:0px;padding-left:0px;"><input name="ctl00$ContentPlaceHolder1$vaFpSiseisyoInfo$4,8" type="text" value="1222" size="10" id="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_4,8" tabindex="-1" class="spread_textbox_style" FpEditor="TextBox" style="width:100%;width:95%;height:100%;" /></td><td class="s2s13s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl29" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s13s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl29" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s14s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl31" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s14s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl31" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s13s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl29" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s13s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl29" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s14s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl31" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s14s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl31" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s14s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl31" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s14s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl31" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s14s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl31" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s2s15s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl33" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s0s6s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl15" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td><td class="s0s6s0" FpEditorID="ctl00_ContentPlaceHolder1_vaFpSiseisyoInfo_ctl15" FpCellType="readonly" style="overflow:hidden;"><nobr>&amp;nbsp;</nobr></td>
</tr>

由于我的画面项目比较多,这样在画面加载时很慢,请问,能想办法使spread自动生成的html尽量的少么?

1 个回复

倒序浏览
gw0506
超级版主   /  发表于:2010-5-25 09:54:00
沙发
你可以通过帮助文档中提供的【Maintaining State】章节的相关信息来决定用什么方法最适合你的要求。

有几种不同的办法来减少生成的代码。不过性能,数据量和开发人员的代码量都是你需要考虑的因素,所以希望你能简单阅读一下【Maintaining State】章节,综合选择。

单就减少生成代码的问题,你可以:
Private Sub FpSpread1_SaveOrLoadSheetState(ByVal sender As Object, ByVal e As FarPoint.Web.Spread.SheetViewStateEventArgs) Handles FpSpread1.SaveOrLoadSheetState
    If (e.IsSave) Then         Session(e.SheetView.SheetName) = e.SheetView.SaveViewState()
    Else
        e.SheetView.LoadViewState(Session(e.SheetView.SheetName))
    End If
    e.Handled = True
End Sub



更多详情,请参见[知识库与精华区]: http://gcdn.grapecity.com/showtopic-583.html
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部