⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 scexcelexport.pas

📁 导出delphi程序的一些数据到
💻 PAS
字号:
{--------------------------------------------------------------------------------
* Description : TscExcelExport

  This TscExcelExport component is an advanced, powerful but easy component to
  export all records of a dataset from Delphi to MS Excel (97, 2000, XP or 2003).
  Many features are provided to change the layout, to add totals, to create groups, ...

* Dates : February 2000 - September 2006
* Version : 3.5 (Delphi 5, 6, 7, 2005, 2006 and Turbo Delphi)

* Author : Stefan Cruysberghs
* Email : stefancr@scip.be
* Website : http://www.scip.be
  Visit SCIP.be for other components, tools and articles
--------------------------------------------------------------------------------
Copyrights and distribution
* All copyrights to this component are owned by the author Stefan Cruysberghs.
* This component is freeware for non-commercial use and may be freely distributed.
* The author doesn't give a warranty for error free running of this component.
* Registered users can count on it that bugs will be solved as soon as possible.
Registration
* If you like this component or you are using it in a commercial environment
  then you have to register it.
* You will encourage the author to further develop and improve this component.
* You will receive an email when new versions or upgrades are available and
  support will be provided by e-mail.
* The registration cost is 35 US$ (single developer license)
  and 100 US$ (Site license (unlimited developers))
* You can register yourself online on the website of Reg.Net (ID = 11696)
  https://secure.reg.net/product.asp?ID=11696
--------------------------------------------------------------------------------
Installation
* Open the run-time package (X=Delphi version) ExcelExportPackX.dpr and build it
* Open the design-time package (X=Delphi version) dclExcelExportPackX.dpr and compile and install it
* The TscExcelExport component can be found in the tabsheet 'SC' of the component palette.
* When you like to add the component to an existing package, add the unit
  scExcelExport to a run-time package. Make sure the DCP file dclOffice is added as required.
  This file can be found in the Borland\Delphi\Lib folder.
  The unit scExcelExportReg.pas contains the registration and property and component editor.
  This unit should be included in a design-time package.
Live templates
* The 2 live templates (ExcelExportCreate.xml and ExcelExportUse.xml)
  for Delphi (BDS) 2006 should be copied to
  C:\Program Files\Borland\BDS\4.0\Objrepos\code_templates\delphi
--------------------------------------------------------------------------------
* Versions of Excel typelibraries which can be used

Use scExcelExportConfig.inc to set one of the compiler directives

* EXCELXP      ExcelXP.pas         package DclOfficeXP
* EXCEL2000    Excel2000.pas       package DclOffice2k, package DclOffice2k50
* EXCEL97      Excel97.pas

Delphi         | Turbo |  2006 |  2005 |   7   |   6   | 5 SP1 |   5   |
------------------------------------------------------------------------
ExcelXP.pas    |   x   |   x   |   x   |   x   |       |       |       |
------------------------------------------------------------------------
Excel2000.pas  |   x   |   x   |   x   |   x   |   x   |   x   |       |
------------------------------------------------------------------------
Excel97.pas    |       |       |       |   x   |   x   |   x   |   x   |
------------------------------------------------------------------------

* Each typelibrary supports the extra features of the newer version of Office.
* The pas files can be found in C:\Program Files\Borland\BDS\4.0\OCX\Servers
* The installed version of MS Office should be the same or more recent
  as the version of the Delphi unit.
  e.g.
  - unit Excel2000.pas can be used with MS Excel XP
  - unit Excel97.pas can be used with MS Excel 2003
  - unit Excel2000.pas can not be used with MS Excel 97

MS Excel       |  2007 |  2003 |   XP  |  2000 |   97  |
--------------------------------------------------------
ExcelXP.pas    |   x   |   x   |   x   |       |       |
--------------------------------------------------------
Excel2000.pas  |   x   |   x   |   x   |   x   |       |
--------------------------------------------------------
Excel97.pas    |   x   |   x   |   x   |   x   |   x   |
--------------------------------------------------------

* The warnings 'unsafe code', 'unsafe type' and 'unsafe typecast' should be ignored.
  In Delphi 7, 2005, 2006 and Turbo Delphi these warnings can be disabled in your project options.
--------------------------------------------------------------------------------
Version 1.0 (February 2000)
Version 1.2 
  - Improved connection to Excel
Version 1.3
  - Added Orientation of titles
  - Added StyleColumnWidth
Version 1.4
  - Improved GetColumnCharacters
  - Added Border properties and background colors for Titles, Data and Summary
  - Added Summary properties (SummarySelection, SummaryFields, SummaryCalculation)
Version 1.5
  - Improved speed of exporting data
  - Improved exporting string-fields
  - Added ConnectTo property
Version 1.6
  - Suppression of reference to Dataset.RecordCount (thanks to G閞ard Beneteau)
  - Added VisibleFieldsOnly property
Version 1.7
  - Notification when disconnecting dataset
  - Very fast export by using a variant matrix (thanks to Frank van den Bergh)
Version 1.8
  - Bug in exporting titles (thanks to Roberto Parola)
  - Setting format of cells before exporting data (thanks to Asbj鴕n Heggvik)
  - Added BlockOfRecords property : little bit faster and more control of memory
  - Added properties to set begin row of titles and data
Version 1.9
  - Added properties (Orientation, WrapText, Alignment) to font (thanks to David Balick)
    (property OrientationTitles is removed)
  - Added HeaderText (thanks to David Balick)
  - Improved some routines
Version 2.0
  - Added read only property with row number of last data row
  - Added property with the Excel tabsheet so after the export
    it is possible to access the cells in Excel
  - Added event OnExportRecords
Version 2.1
  - Bugfixes
Version 2.2
  - Bugfix when exporting filtered dataset (thanks to Heinz Faerber)
  - New column width styles : cwFieldDisplayWidth, cwFieldDataSize, cwEnhAutoFit (idea from Scott Stanek)
Version 2.3
  - Added properties begin column data/titles and header (idea from Knjazev Sergey)
  - Added property ShowTitles
Version 2.4
  - Support for Delphi 6.0
Version 2.5
  - D6 : problem when using disconnect
Version 2.6
  - Bugfixes and some improvements
  - Added method LoadDefaultProperties to reset all properties
  - Improvement SetFormat (thanks to Enrico Chiaramonte)
  - Improvements using borders (thanks to Ot醰io)
  - Added event OnGetCellBackgroundColorEvent (thanks to Yuri Plotnikov)
  - Added events to export data without using a TDataset
    and new property DataPipe : dpDataset, dpCustom (thanks to David Balick)
  - Event OnExportRecords will be triggered after exporting the record
Version 2.7
  - Some bugfixes
  - Added new unit scExcelExportReg which contains a component editor
  - Added exceptions to prevent access violations
    (EFileNotExists, ENoDatasetConnected, EDatasetNotActive, ENoActiveWorkbook)
  - Added new property Filename which can be used to add data to existing file
  - Add data to existing worksheet when name of given worksheet already exists
  - Added new feature to group rows (thanks to Vadim Mescheryakov & Stijn Vansummeren)
  - Added new group options properties : ClearContents, BorderRange, IntervalFontSize
  - New events for exporting without dataset : OnGotoFirstRecord, OnGotoNextRecord
Version 2.81
  - Created a package for Delphi5 and Delphi6 to make installation easier
  - Added new public method Connect. Can be used to make a connection to Excel before
    exporting data. When exporting more datasets at the same time, the Disconnect
    method should be used after using the ExportDataset method !
  - Added new read only property Connected.
  - Text property of field in stead of Value property is exported
    so OnGetText events can be used
Version 2.91
  - Improvements SetFormat (before exporting data)
  - Added support for fieldtype ftTimeStamp
  - Added fieldtype ftMemo, ftOraClob, ftFmtMemo, these kinds of fields are exported
    using AsVariant not the Text property like other fields
  - Improvement for regional settings of floats (thanks to Jorge Pinetta)
  - Improvement ShowTitles and BeginRowData properties (thanks to Jordi March i Nogu

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -