CSDN首页 空间 新闻 论坛 Blog 下载 读书 网摘 搜索 .NET Java 视频 接项目 求职 在线学习 买书 程序员 通知
山寨机中的战斗机! 程序优化工程师到底对IT界有没有贡献
CSDN社区
搜索 收藏 打印 关闭
CSDN社区 >  Delphi >  数据库相关

谁用过cell组件开发报表,进来看看

楼主gl0218(红尘㊣浪子)2006-03-30 09:49:36 在 Delphi / 数据库相关 提问

我想从数据库中取出制定的值赋给cell报表中指定的行和列,因为刚开始不熟悉,所以参考vb下的演示源代码设计,可是无法触发CalcFunc事件,各位大哥帮忙给看看或者提供另外一种思路。谢谢了  
  问题点数:30、回复次数:3Top

1 楼gl0218(红尘㊣浪子)回复于 2006-03-30 09:50:20 得分 0

附:源代码:  
  unit   Unit1;  
   
  interface  
   
  uses  
      Windows,   Messages,   SysUtils,   Variants,   Classes,   Graphics,   Controls,   Forms,  
      Dialogs,     StdCtrls,sys_public,data,unit3,  
      DB,   ADODB,   Grids,   DBGrids,     OleCtrls,   CELL50Lib_TLB,  
      ExtCtrls   ;  
  type  
      TForm1   =   class(TForm)  
          Cell1:   TCell;  
          Label1:   TLabel;  
          ListBox1:   TListBox;  
          Label2:   TLabel;  
          Button1:   TButton;  
          Button2:   TButton;  
          Button3:   TButton;  
          Button4:   TButton;  
          Button5:   TButton;  
          Button6:   TButton;  
          procedure   FormCreate(Sender:   TObject);  
          procedure   Button7Click(Sender:   TObject);  
          procedure   Button8Click(Sender:   TObject);  
          procedure   Cell1CalcFunc(ASender:   TObject;   const   name:   WideString;  
              rettype,   paranum:   Integer);  
          procedure   Cell1QueryFuncGuide(ASender:   TObject;   const   name:   WideString;  
              var   hasguide:   Integer);  
   
      private  
          {   Private   declarations   }  
   
              procedure   definefun();  
              procedure   setfun(index:longint);  
              function   opendb(filedname   :string   ;row   :double):double;  
      public  
          {   Public   declarations   }  
      end;  
   
  var  
      Form1:   TForm1;  
      strarray,HelpArray:array[0..17]   of   string;  
   
  implementation  
   
  {$R   *.dfm}  
   
  procedure   TForm1.FormCreate(Sender:   TObject);  
  var  
  path:string;  
   
  begin  
        path   :=   ExtractFilePath(application.ExeName)+'资产负债表.cll';  
        cell1.OpenFile(path,'');  
        definefun();  
        setfun(1);  
        cell1.ReDraw;  
        label2.Caption   :=helparray[0];  
  end;  
  procedure   tform1.definefun();  
  var  
  str   :string;  
  begin  
  //strarray   :=   char(13);  
  str   :=   '''资产负债表取数函数''   Any   货币资金(   str:string,[Double   num]   )';  
  str   :=   str   +   #13#10   +   'BEGIN_HELP';                                   //#13回车     #10空格  
  str   :=   str   +   #13#10   +   '货币资金(   String   str,Double   index   )';  
  str   :=   str   +   #13#10   +   '本函数用来获取数据库中的   货币资金   字段的值';  
  str   :=   str   +   #13#10   +   'END_HELP';  
  cell1.DefineFunctions(str);  
  //showmessage('definefun');  
  str   :=   '';  
  str   :=str   +   #13#10   +   '货币资金(   String   str,Double   index   )';  
  str   :=   str   +     #13#10   +   '本函数用来获取数据库中的   货币资金   字段的值';  
  HelpArray[0]   :=   str;  
  end;  
  procedure   tform1.setfun(index:longint);  
  var  
  temp,strtemp:string;  
  //i:integer;  
  begin  
      listbox1.Clear;  
      strTemp   :=   '货币资金('   +   Char(34)   +   '货币资金'   +   Chr(34)   +   ','     +   IntToStr(index)+   ')';  
  Cell1.SetFormula(3,7,0,strtemp);  
  //showmessage(strtemp);  
  listbox1.Items.Add(strtemp);  
  temp   :=   Cell1.CellToLabel(3,   7);  
  strArray[0]   :=   temp  
   
   
  end;  
  function   tform1.opendb(filedname   :string   ;row   :double):double;  
  var  
  index   :longint;  
  i:integer;  
  begin  
  with   dm1.aq   do  
      begin  
          SQL.Clear;  
          SQL.Add('Select   *   From   资产负债表');  
          Active   :=   true;  
          dm1.aq.Open;  
          end;  
          for   i   :=1   to   dm1.aq.Fields.Count   do  
          begin  
              if   dm1.aq.fields[i].FieldName   =   filedname   then  
                      begin  
                          index   :=i;  
                          exit;  
                      end;  
          end;  
          i:=1;  
          while   not   dm1.aq.Eof   do  
          begin  
              if   i=row   then  
                  begin  
                      opendb   :=   dm1.aq.Fields[index].Value;  
                      exit;  
                  end;  
                  i   :=i   +1;  
          end;  
          dm1.aq.Close;  
  end;  
   
   
  procedure   TForm1.Button7Click(Sender:   TObject);  
   
      //jg   :integer;  
  begin  
  with   dm1.aq   do  
              begin  
          SQL.Clear;  
          SQL.Add('Select   *   From   资产负债表');  
          Active   :=   true;  
          dm1.aq.Open;  
          end;  
        //   dbgrid1.DataSource   :=   dm1.aq;  
   
  end;  
   
  procedure   TForm1.Button8Click(Sender:   TObject);  
   
  begin  
      {with   Dm1.ADOConnection1   do  
          begin  
              Open;  
              if   Connected   then  
                  showmessage('连接成功')  
              else  
                  showmessage('连接失败');  
          end;}  
        //para   :=0;  
   
  end;  
  procedure   TForm1.Cell1CalcFunc(ASender:   TObject;   const   name:   WideString;  
      rettype,   paranum:   Integer);  
      var  
      para   :longint;  
      result   :double;  
  begin  
      showmessage('calcfunc');  
      result   :=   opendb(cell1.GetFuncStringPara(0,para),cell1.GetFuncDoublePara(1,para));  
       
        cell1.SetFuncResult(result,'',0);  
  end;  
   
  procedure   TForm1.Cell1QueryFuncGuide(ASender:   TObject;  
      const   name:   WideString;   var   hasguide:   Integer);  
  begin  
  If   name   =   '货币资金'   Then   hasguide   :=   1;  
  If   name   =   '短期投资'   Then   hasguide   :=   1;  
  If   name   =   '应收票据'   Then   hasguide   :=   1;  
  If   name   =   '坏帐准备'   Then   hasguide   :=   1;  
  If   name   =   '预付帐款'   Then   hasguide   :=   1;  
  If   name   =   '存货'   Then   hasguide   :=   1;  
  If   name   =   '待处理流动资产净损失'   Then   hasguide   :=   1;  
  If   name   =   '其他流动资产'   Then   hasguide   :=   1;  
  If   name   =   '固定资产原价'   Then   hasguide   :=   1;  
  If   name   =   '在建工程'   Then   hasguide   :=   1;  
  If   name   =   '无形资产'   Then   hasguide   :=   1;  
  If   name   =   '短期借款'   Then   hasguide   :=   1;  
  If   name   =   '应付票据'   Then   hasguide   :=   1;  
  If   name   =   '应付帐款'   Then   hasguide   :=   1;  
  If   name   =   '应付工资'   Then   hasguide   :=   1;  
  If   name   =   '长期借款'   Then   hasguide   :=   1;  
  If   name   =   '长期应付款'   Then   hasguide   :=   1;  
  end;  
   
  end.Top

2 楼gl0218(红尘㊣浪子)回复于 2006-03-31 14:43:48 得分 0

顶起来,大家都帮帮忙啊,急~~~~~~~~~~~~~~~~~~~~Top

3 楼decal(我用DELPHI)回复于 2006-04-12 15:20:17 得分 30

好东西,有资料分享啊楼主,支持Top

相关问题

  • 哪里有国人开发的CELL组件下载(做报表用的)
  • 用cell组件开发的软件如何打包?
  • 请教各位:B/S模式的MIS报表功能的实现,比如使用cell组件?
  • C++Builder中使用CELL组件
  • 求教用asp开发报表
  • 用java能否开发图形报表程序
  • 用JAVA开发 中国式报表,请大家给点意见
  • 有用jasperreport开发报表经验的朋友进来聊聊!
  • 现在常用的报表开发工具是什么?
  • 请问各位,.net开发用哪种报表好?

关键词

  • cell
  • tbutton
  • tobject
  • procedure
  • button
  • unit
  • sender

得分解答快速导航

  • 帖主:gl0218
  • decal

相关链接

  • Delphi类图书
  • Delphi类源码下载
  • Delphi控件下载

广告也精彩

反馈

请通过下述方式给我们反馈
反馈
提问
网站简介|广告服务|VIP资费标准|银行汇款帐号|网站地图|帮助|联系方式|诚聘英才|English|问题报告
北京创新乐知广告有限公司 版权所有, 京 ICP 证 070598 号
世纪乐知(北京)网络技术有限公司 提供技术支持
Copyright © 2000-2008, CSDN.NET, All Rights Reserved
GongshangLogo