views:

489

answers:

6

I'm looking to export data to excel from Delphi without having to own a copy of excel, is this possible?

N.B. CSV will not do.

+2  A: 

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.

stackoverflow
A: 

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"&gt;
<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>
Matt Blaine
A: 

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

Rob McDonell
A: 

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/

Christian
A: 

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

rhazell