Generate an XLS without using Excel (BIFF)

Asked

Viewed 1,416 times

0

How to generate a file .xls without using Excel?
I don’t wish to use the OLE, before entering the information in binary format, using the structure BIFF8 or something similar.
The problem is I can’t find any documentation, not even on MSDN!

Does anyone know how the BIFF8?
Or have any idea how to export a report to Excel without using Excel?

Details:

  • Delphi XE7
  • pReport (Report generator)
  • the cxGrid component of Devexpress, has an interesting export technique, however complex. If you’re willing to use this component, I could give you a hand.

  • @Victorzanella always helping kkk. Thanks but I need to solve natively even without third party components.. even more paid.

  • Dude, it seems like a tricky task. There are some free frameworks that do that, don’t you want to take a look? http://stackoverflow.com/questions/2493071/exporting-to-excel-from-delphi-without-having-excel

1 answer

1


This may be a solution to your problem, just create a table in html and export as Xls, example:

procedure TForm1.Button1Click(Sender: TObject);
var XlsFile: TextFile;
    i: integer;
begin
  AssignFile(XlsFile, 'C:\report.xls');
  Rewrite(XlsFile);
  writeln(XlsFile, '<HTML><BODY><table>');
  writeln(XlsFile, '<tr><td>Test</td></tr>');
  writeln(XlsFile, '<tr><td>Test</td><td>Test2</td></tr>');
  writeln(XlsFile, '<tr><td>Test</td></tr>');
  writeln(XlsFile, '</table></body></html>');
  CloseFile(XlsFile);
end;

Any questions or questions ask, I hope I’ve helped.

  • your suggestion is valid, but the export of the report to HTML is very complicated. That’s because I will have to generate numerous <tr><td> because the data is not structured as a table, but is a graphic report. Thanks for the help.

  • how to find your data?

  • We can compare the report to a PDF, and every visible information in that report I can work as if it were a Label, where I have only the content and position (TRect). So I make a loop and according to the position, I am playing in specific Excel cells (currently usingOLE).

  • okay, if I can think of anything else that might help

  • @Andrey take a look at the documentation on the excel BIFF standard here at https://msdn.microsoft.com/en-us/library/office/cc3154(v=office.14). aspx

Browser other questions tagged

You are not signed in. Login or sign up in order to post.