找回密码
 立即注册

QQ登录

只需一步,快速开始

lvxiangjun1
论坛元老   /  发表于:2012-6-5 11:31:00
11#
如何 自动根据 字数增加单元格宽度
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-6-5 13:56:00
12#
回复 11楼lvxiangjun1的帖子

可以结合 Spread 提供前台事件 DataChanged、方法 SizeToFit 来实现,测试代码:

  1.     <script language="javascript" type="text/javascript" id="FpSpread1_Script0">
  2.                 function FpSpread1_DataChanged(event){
  3.                     //Add code to handle your event here.
  4.                     FpSpread1.SizeToFit();
  5.                 }
  6.         </script>
复制代码
回复 使用道具 举报
lvxiangjun1
论坛元老   /  发表于:2012-6-5 16:10:00
13#
加法运算的 效果没有 单元格显示0,点进去显示 =SUM(D615)
回复 使用道具 举报
lvxiangjun1
论坛元老   /  发表于:2012-6-5 16:10:00
14#
加法运算的 效果没有 单元格显示0,点进去显示 =SUM(D6 : D15)
回复 使用道具 举报
lvxiangjun1
论坛元老   /  发表于:2012-6-5 16:11:00
15#
int rowCount = this.FpSpread1.Sheets[0].RowCount;
            int columnCount = this.FpSpread1.Sheets[0].ColumnCount;
            for (int i = 0; i &lt; columnCount; i++)
            {
                string columnLabel = this.FpSpread1.Sheets[0].ColumnHeader.Columns.Label;
                string formula = &quot;SUM(&quot; + columnLabel + &quot;6&quot; + &quot;:&quot; + columnLabel +&quot;15)&quot;;
                this.FpSpread1.Sheets[0].Cells[rowCount - 1, i].Formula = formula;
            }
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-6-5 16:44:00
16#
回复 15楼lvxiangjun1的帖子

测试代码:

  1. protected void Page_Load(object sender, EventArgs e)
  2.         {
  3.             if (IsPostBack)
  4.                 return;
  5.             //允许客户端自动控制表单大小
  6.             this.FpSpread1.ClientAutoSize = true;
  7.             //允许使用公式
  8.             this.FpSpread1.Sheets[0].AllowUserFormulas = true;
  9.             //允许客户端自动计算
  10.             this.FpSpread1.ClientAutoCalculation = true;

  11.             //设置每页行数
  12.             this.FpSpread1.Sheets[0].RowCount = 20;
  13.             this.FpSpread1.Sheets[0].PageSize = 20;


  14.             int rowCount = this.FpSpread1.Sheets[0].RowCount;
  15.             int columnCount = this.FpSpread1.Sheets[0].ColumnCount;
  16.             for (int i = 0; i &lt; columnCount; i++)
  17.             {
  18.                 string columnLabel = this.FpSpread1.Sheets[0].ColumnHeader.Columns[i].Label;
  19.                 string formula = &quot;SUM(&quot; + columnLabel + &quot;6&quot; + &quot;:&quot; + columnLabel + &quot;15)&quot;;
  20.                 this.FpSpread1.Sheets[0].Cells[rowCount - 1, i].Formula = formula;
  21.             }
  22.         }
复制代码
回复 使用道具 举报
lvxiangjun1
论坛元老   /  发表于:2012-6-5 17:15:00
17#
不行,确定是这2个属性吗?
/允许使用公式
            this.FpSpread1.Sheets[0].AllowUserFormulas = true;
            //允许客户端自动计算
            this.FpSpread1.ClientAutoCalculation = true;
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-6-5 17:29:00
18#
回复 17楼lvxiangjun1的帖子

我这边可以正常运行,请参考,Demo 下载:
回复 使用道具 举报
iceman
社区贡献组   /  发表于:2012-6-5 17:30:00
19#
回复 18楼iceman的帖子
上述代码在我这里运行正常,请参考:测试环境 VS 2010 &amp;&amp; Spread for .NET 6 SP3
Demo下载:
4702.zip (2.88 MB, 下载次数: 478)
回复 使用道具 举报
lvxiangjun1
论坛元老   /  发表于:2012-6-6 11:22:00
20#
..我需要的是后台赋值之后 运行 直接统计功能,而不是运行以后在EXCEL里面赋值计算
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 立即注册
返回顶部