当前位置:首页
开发技术指南» 文章正文
    引言:

 ·radiobuttonlist问题,在线求助    »显示摘要«
    摘要: <asp:radiobuttonlist id="rbltype" runat="server" width="100%" forecolor="red" repeatdirection="horizontal" autopostback="true"> &l......
 ·response.redirect("left.aspx");    »显示摘要«
    摘要: 我做的页面是框架,在一个事件处理程序中通过象response.redirect()这类方法,直接从一个frame到另外一个frame,请大家给点意见。 ......


怎么操纵excel

我需要用excel出报表,怎么操作啊

NO.1   作者: armyguo

给你一段代码看看:  
   
  unit   Unit_ExcelReport;  
   
  interface  
   
  uses  
      SysUtils,   Windows,   Messages,   Classes,   Graphics,   Controls,  
      Forms,   Dialogs,   ComObj,   Variants,   Math,   DB,   ADODB,   DateUtils,   StrUtils;  
   
  const   ErrFileNoExists   =   报表模板文件   "%s"   不存在!;  
   
  type  
      TReportProgressEvent   =   procedure   (Sender:   TObject;   Position,   Max:   Integer)    
          of   Object;  
      TMDReportProgressEvent   =   procedure   (Sender:   TObject;   MPos,   MMax,  
          Pos,   Max:   Integer)   of   Object;  
      TStatuChangeEvent   =   procedure   (Sender:   TObject;   Statu:   String)   of   Object;  
      TNo21Total   =   Record  
          LMAmount,   MinAm,   MOutAm,   MAmOut:   Double;  
          LMMoney,   MInMoney,   MOutMoney,   MMoney:   Double;  
      end;  
      TCurreAmt   =   Record  
          CURRE:   String;  
          Amount,   RMBAmount,   TaxAmount:   Double;  
      end;  
   
  type  
      TExcelReport   =   class   (TObject)  
      private  
          FBeginRow:   Integer;  
          FCurrentSheet:   Variant;  
          FDPageCount:   Integer;  
          FDPageRecordCount:   Integer;  
          FDPageTotal:   Integer;  
          FDRecordCount:   Integer;  
          FDRecordTotal:   Integer;  
          FDRowCount:   Integer;  
          FDRowCountPerRecord:   Integer;  
          FExcelApp:   Variant;  
          FOnStatusChange:   TStatuChangeEvent;  
          FPageBeginCol:   Integer;  
          FPageCount:   Integer;  
          FPageEndCol:   Integer;  
          FPageRecordCount:   Integer;  
          FPageRowCount:   Integer;  
          FPageTotal:   Integer;  
          FPatternSheet:   Variant;  
          FPosition:   Integer;  
          FRecordCount:   Integer;  
          FRecordTotal:   Integer;  
          FReportSheet:   Variant;  
          FReportWorkBook:   Variant;  
          FRowCount:   Integer;  
          FRowCountPerRecord:   Integer;  
          FTempletFileName:   string;  
          FTempletWorkbook:   Variant;  
          function   GetActiveSheet:   Variant;  
          function   GetActiveWorkBook:   Variant;  
          function   GetCells:   Variant;  
          function   GetWorkBooks:   Variant;  
          procedure   SetVisible(Value:   Boolean);  
      public  
          NewPageCount:Integer;  
          constructor   Create(TempletFileName:   String);   reintroduce;  
          destructor   Destroy;   override;  
          procedure   InitReportWorkBook;  
          procedure   NewPage;   virtual;  
          procedure   NewReportSheet;   virtual;  
          procedure   OpenPatternFile;  
          procedure   PrintOut;   virtual;  
          procedure   SaveAs(AFileName:   string);  
          procedure   SetBorders(Range:   String);  
          procedure   SetCellsValue(ARow,   ACol:   Integer;   Value:   Variant);  
          property   ActiveSheet:   Variant   read   GetActiveSheet;  
          property   ActiveWorkBook:   Variant   read   GetActiveWorkBook;  
          property   BeginRow:   Integer   read   FBeginRow   write   FBeginRow;  
          property   Cells:   Variant   read   GetCells;  
          property   DPageCount:   Integer   read   FDPageCount   write   FDPageCount;  
          property   DPageRecordCount:   Integer   read   FDPageRecordCount   write    
                          FDPageRecordCount;  
          property   DPageTotal:   Integer   read   FDPageTotal   write   FDPageTotal;  
          property   DRecordCount:   Integer   read   FDRecordCount   write   FDRecordCount;  
          property   DRecordTotal:   Integer   read   FDRecordTotal   write   FDRecordTotal;  
          property   DRowCount:   Integer   read   FDRowCount   write   FDRowCount;  
          property   DRowCountPerRecord:   Integer   read   FDRowCountPerRecord   write    
                          FDRowCountPerRecord;  
          property   ExcelApp:   Variant   read   FExcelApp;  
          property   PageBeginCol:   Integer   read   FPageBeginCol   write   FPageBeginCol;  
          property   PageCount:   Integer   read   FPageCount;  
          property   PageEndCol:   Integer   read   FPageEndCol   write   FPageEndCol;  
          property   PageRecordCount:   Integer   read   FPageRecordCount   write  
                          FPageRecordCount;  
          property   PageRowCount:   Integer   read   FPageRowCount   write   FPageRowCount;  
          property   PageTotal:   Integer   read   FPageTotal   write   FPageTotal;  
          property   PatternSheet:   Variant   read   FPatternSheet;  
          property   Position:   Integer   read   FPosition   write   FPosition;  
          property   RecordCount:   Integer   read   FRecordCount   write   FRecordCount;  
          property   RecordTotal:   Integer   read   FRecordTotal   write   FRecordTotal;  
          property   ReportSheet:   Variant   read   FReportSheet;  
          property   ReportWorkBook:   Variant   read   FReportWorkBook;  
          property   RowCount:   Integer   read   FRowCount;  
          property   RowCountPerRecord:   Integer   read   FRowCountPerRecord   write  
                          FRowCountPerRecord;  
          property   TempletWorkbook:   Variant   read   FTempletWorkbook;  
          property   Visible:   Boolean   write   SetVisible;  
          property   WorkBooks:   Variant   read   GetWorkBooks;  
      published  
          property   OnStatusChange:   TStatuChangeEvent   read   FOnStatusChange   write    
                          FOnStatusChange;  
      end;  
   
   
  function   PatternPath:   string;  
   
  function   TPXDateToStrDate(TpxDate:   String;   DateFmt:   String=YYYY"-"MM"-"DD):  
                  TDateTime;  
   
  function   FormatDate(Date:   TDate;   Fmt:String=YYYY"-"MM"-"DD):   string;  
   
  function   FormatQty(Qty:   Real;   Fmt:   String   =   #,####.00):   string;  
   
  function   FormatCurr(Curr:   Real;   Fmt:   String=#,###.00):   string;  
   
  function   nString(n:   Integer;   Str:   String=0):   string;  
   
  function   StrToCode39Str(Str:   String):   string;  
   
  function   MyDateToInt(DateStr:String):String;  
   
  function     SetMonth(Month:Integer):String;  
   
  function     SetDay(Day:Integer):String   ;  
   
  procedure   EnterToTab(TheForm:   TForm;   var   Key:   Char);  
   
 


    摘要: 我有一個csv文件,想用bulk insert語句把它導入到臨時錶中,語句如下: create table #temp ( customer_part_desc [nvarchar] (30) null, order_number [nvarchar] (20) null, line_number [nvarchar] (20) null, order_type [n......
» 本期热门文章:

©2000-2007 All Rights Reserved. 最佳浏览:1024X768 MSIE