Hi iceman:
我现在又发现个问题,当我使用程序代码给表格中的某个单元格增加图片框时候,则在第一次时,其当前行的行头和表格体的行高不一致,对不齐,会错位的。(如果我再执行一次,又会对齐了)
说明,我的环境为:VS2010 Spread for asp.net 6.0 浏览器为:firefox.
另,我的程序中使用了UpdatePanel(这个我测试过,如果没有UpdatePanel,就不会发生以上问题。)问题是,我现在系统中必须要有UpdatePanel.看请问下该如何解决这个问题。
谢谢!
详细代码如下:
html Code:
------------------------------------------------
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm14.aspx.cs" Inherits="_0000_Popup.WebForm14" %>
<%@ Register Assembly="FarPoint.Web.Spread" Namespace="FarPoint.Web.Spread" TagPrefix="FarPoint" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<style type="text/css">
.Size img
{
width: 100%;
height: 100%;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<FarPoint:FpSpread ID="FpSpread1" runat="server" BorderColor="Black" BorderStyle="Solid"
BorderWidth="1px" Height="370px" Width="870px">
<CommandBar BackColor="Control" ButtonFaceColor="Control" ButtonHighlightColor="ControlLightLight"
ButtonShadowColor="ControlDark">
</CommandBar>
<Sheets>
<FarPoint:SheetView SheetName="Sheet1">
</FarPoint:SheetView>
</Sheets>
</FarPoint:FpSpread>
<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</form>
</body>
</html>
C#后台代码
-----------------------------------------------------------
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using FarPoint.Web.Spread;
using System.Drawing;
namespace _0000_Popup
{
public partial class WebForm14 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
this.FpSpread1.SaveViewStateToSession = false;
this.FpSpread1.SaveOrLoadSheetState+=new SheetViewStateEventHandler(FpSpread1_SaveOrLoadSheetState);
if (!this.IsPostBack)
{
this.FpSpread1.ActiveSheetView.AllowInsert = true;
this.FpSpread1.ActiveSheetView.RowCount = 0;
FpSpread1.Sheets[0].ColumnCount = 2;
}
}
protected void FpSpread1_SaveOrLoadSheetState(object sender, SheetViewStateEventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
FpSpread1.ActiveSheetView.AddRows(0, 1);
ImageCellType iim = new ImageCellType();
iim.ImageUrl = "Img/GPG4.jpg";
iim.CssClass = "Size";
iim.ImageAlign = ImageAlign.Middle;
FpSpread1.ActiveSheetView.Columns[1].Width = 150;
FpSpread1.ActiveSheetView.Cells[0, 1].CellType = iim;
FpSpread1.ActiveSheetView.Cells[0, 1].Value = null;
FpSpread1.ActiveSheetView.Cells[0, 1].Text = "";
FpSpread1.SaveChanges();
}
}
}
其中的图片,你可以随便找张图片代替(尽量找张大点的图片,效果会明显点)。
以上,请帮忙看看,想想办法。谢谢! |
|