简体   繁体   English

在没有excel的情况下从Delphi导出到excel

[英]Exporting to excel from Delphi without having excel

I'm looking to export data to excel from Delphi without having to own a copy of excel, is this possible? 我想要从Delphi导出数据到excel而不必拥有excel的副本,这可能吗?

NB CSV will not do. NB CSV不会这样做。

Try zexmlss . 试试zexmlss This library can create and load excel 2003 XML format files. 该库可以创建和加载excel 2003 XML格式文件。 Support merged cells, borders, vertical and horizontal alignment and other. 支持合并单元格,边框,垂直和水平对齐等。 Zlib license. Zlib许可证。 Work with delphi 6, 7, 9-14 and lazarus. 与delphi 6,7,9-14和lazarus合作。

FlexCel, earlier an Opensource now managed by TMS ( http://www.tmssoftware.com/site/flexcel.asp ) works great. FlexCel,早期由TMS管理的Opensource( http://www.tmssoftware.com/site/flexcel.asp )效果很好。

You can also check TmxNativeExcel at http://www.torry.net . 您还可以在http://www.torry.net上查看TmxNativeExcel。 Comes free and is uses native Biff format. 免费提供,使用原生Biff格式。 I've not tried this though. 我没试过这个。

I believe it's possible to create MS Office documents as HTML. 我相信可以将MS Office文档创建为HTML。 You don't need to open them in a web browser then or anything, the file can still have the extension .xls and open in Excel like normal. 你不需要在网络浏览器中打开它们,或者任何东西,文件仍然可以扩展.xls并在Excel中正常打开。

I just created a new spreadsheet and stuck the numbers 1-3 in the first three cells of column A, and saved it as HTML. 我刚刚创建了一个新的电子表格,并将数字1-3粘贴在A列的前三个单元格中,并将其保存为HTML。 There was a bunch of extra mess that probably isn't all necessary. 有一堆额外的混乱可能并非都是必要的。 I stripped out as much as I could, here's what looks to be the bare minimum to produce a working spreadsheet. 我尽可能地剥离了,这是制作工作电子表格的最低限度。

Try creating a new text file with this as its contents, and save it with a .xls extension. 尝试使用此内容创建一个新的文本文件,并使用.xls扩展名保存。

<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<!--[if gte mso 9]><xml>
 <x:ExcelWorkbook>
  <x:ExcelWorksheets>
   <x:ExcelWorksheet>
    <x:Name>Sheet1</x:Name>
    <x:WorksheetOptions>
     <x:Selected/>
     <x:Panes>
      <x:Pane>
       <x:Number>3</x:Number>
       <x:ActiveRow>3</x:ActiveRow>
      </x:Pane>
     </x:Panes>
     <x:ProtectContents>False</x:ProtectContents>
     <x:ProtectObjects>False</x:ProtectObjects>
     <x:ProtectScenarios>False</x:ProtectScenarios>
    </x:WorksheetOptions>
   </x:ExcelWorksheet>
  </x:ExcelWorksheets>
 </x:ExcelWorkbook>
</xml><![endif]-->
</head>
<body>

<table x:str>
    <tr>
        <td x:num width=64>1</td>
    </tr>
    <tr>
        <td x:num>2</td>
    </tr>
    <tr>
        <td x:num>3</td>
    </tr>
</table>
</body>
</html>

oExport - XLSX/ODS native Delphi import/export library oExport - XLSX / ODS本机Delphi导入/导出库

  • no external dll libraries are required 不需要外部DLL库
  • no dependency on Excel or Calc installation (no OLE) 不依赖于Excel或Calc安装(无OLE)
  • full unicode support even for D7, D2007 即使对于D7,D2007,也能获得完整的unicode支持
  • supported cell types: string, number, percent, formula, time, date, datetime 支持的单元格类型:字符串,数字,百分比,公式,时间,日期,日期时间
  • cell formatting: cell width+height, horizontal+vertical alignment, wrap text, font, background color, borders 单元格格式:单元格宽度+高度,水平+垂直对齐,换行文本,字体,背景颜色,边框
  • col/row span col / row span
  • tested and working under Delphi 2007 and XE2 32bit+64bit: should be compatible with all D7 to XE2 在Delphi 2007和XE2 32bit + 64bit下测试和工作:应与所有D7到XE2兼容
  • NEW OFiller: fill DOCX (Word 2007), ODT (OpenOffice Writer), XLSX (Excel 2007), ODS (OpenOffice Calc) templates 新OFiller:填写DOCX(Word 2007),ODT(OpenOffice Writer),XLSX(Excel 2007),ODS(OpenOffice Calc)模板

http://www.kluug.at/xlsx-ods-delphi.php http://www.kluug.at/xlsx-ods-delphi.php

licensed under a MPL/GPL/LGPL tri-license Version: MPL 1.1/GPL 2.0/LGPL 2.1 根据MPL / GPL / LGPL三许可证许可版本:MPL 1.1 / GPL 2.0 / LGPL 2.1

来自Scalabium的SMExport( scalabium.com )包含许多格式,包括安装或不安装Excel的Excel格式。

theree is a very simple way to achive this and is by use of a text file. theree是一种非常简单的方法,可以使用文本文件。 Simply output the data, each field followed by a comma, followed by a carriage return. 只需输出数据,每个字段后跟一个逗号,然后回车。 Save this file with a .CSV extension. 使用.CSV扩展名保存此文件。 This should still work on Excel; 这应该仍适用于Excel; I use Open Officw these days 这几天我使用Open Officw

NativeExcel mentioned earlier is from Nika-Soft. 前面提到的NativeExcel来自Nika-Soft。 Not free, but it works fine. 不是免费的,但它工作正常。 I am using it now for over one year without problems. 我现在使用它超过一年没有问题。 http://www.nika-soft.com/nativeexcel2/ http://www.nika-soft.com/nativeexcel2/

TXLSFile library v.4.0. TXLSFile库v.4.0。 and XLSExport components 和XLSExport组件

We've used successfully with D2007, D2009 & D2010 我们已成功使用D2007,D2009和D2010

What is TXLSFile 什么是TXLSFile

  TXLSFile is a Delphi library for reading and writing MS Excel 
  XLS files. It is based on direct reading and writing of files, 
  and works without OLE Automation with Microsoft Excel. 

  TXLSFile is  distributed  with  XLSExport  components  package. 
  XLSExport is a Delphi components package  for quick data 
  export  into  MS Excel file with  one line  of code.  

http://sm-software.com http://sm-software.com

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM