开发者

Exporting to excel from Delphi without having excel

开发者 https://www.devze.com 2022-12-23 23:29 出处:网络
I\'m looking to export data to excel from Delphi withou开发者_JS百科t having to own a copy of excel, is this possible?

I'm looking to export data to excel from Delphi withou开发者_JS百科t having to own a copy of excel, is this possible?

N.B. CSV will not do.


Try zexmlss. This library can create and load excel 2003 XML format files. Support merged cells, borders, vertical and horizontal alignment and other. Zlib license. Work with delphi 6, 7, 9-14 and lazarus.


FlexCel, earlier an Opensource now managed by TMS (http://www.tmssoftware.com/site/flexcel.asp) works great.

You can also check TmxNativeExcel at http://www.torry.net. Comes free and is uses native Biff format. I've not tried this though.


I believe it's possible to create MS Office documents as 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.

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. 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.

<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

  • no external dll libraries are required
  • no dependency on Excel or Calc installation (no OLE)
  • full unicode support even for D7, D2007
  • 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
  • tested and working under Delphi 2007 and XE2 32bit+64bit: should be compatible with all D7 to XE2
  • NEW OFiller: fill DOCX (Word 2007), ODT (OpenOffice Writer), XLSX (Excel 2007), ODS (OpenOffice Calc) templates

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


SMExport from Scalabium (scalabium.com) includes lots of formats, including Excel format with or without having Excel installed.


NativeExcel mentioned earlier is from 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/


TXLSFile library v.4.0. and XLSExport components

We've used successfully with D2007, D2009 & D2010

What is 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


theree is a very simple way to achive this and is by use of a text file. Simply output the data, each field followed by a comma, followed by a carriage return. Save this file with a .CSV extension. This should still work on Excel; I use Open Officw these days

0

精彩评论

暂无评论...
验证码 换一张
取 消