Excel Export

Hi,

I need to export my data from my dataset into the excel file. Therefore I use the TfrxXLSExport component. The process is as following:
if myReport.LoadFromFile(Filename.xml) then
begin
  myXLSExport.FileName := Filename.XLS;
  if not myReport.PrepareReport() then
    Exit;
  myReport.Export(myXLSExport);
end;

The File was created with certain size. But if I open the file with Office there is no sheet and no data shown. What's wrong? I also tried to export the data with CSVExport or XLSBiffExport. Also the same.

Thanks in advance.

Greetings, Moony

Comments

  • edited 9:58PM
    Moony wrote: »
    if myReport.LoadFromFile(Filename.xml) then
    begin
      myXLSExport.FileName := Filename.XLS;
      if not myReport.PrepareReport() then
        Exit;
      myReport.Export(myXLSExport);
    end;
    

    Could it be as simple as:

    if myReport.LoadFromFile('Filename.xml') then
    begin
    myXLSExport.FileName := 'Filename.XLS';
    if not myReport.PrepareReport() then
    Exit;
    myReport.Export(myXLSExport);
    end;
  • edited 9:58PM
    No, the File was created. If I open it with a text viewer so I see some data in it. But if I open the XLS file with Office there is no sheet and no data.
  • edited 9:58PM
    Just speculating ...

    LoadReport destroys or resets any setup you may have done to a report.
    Maybe PrepareReport does the same thing to the export setup? If that is the case then it mean moving 1 line

    if not myReport.PrepareReport() then
    Exit;
    myXLSExport.FileName := 'Filename.XLS';
    myReport.Export(myXLSExport);
  • edited 9:58PM
    I can not Prepare Data without loading the file with the structure (xml). So you have to load the structure file - normally it is *.fr4 - and then you can prepare the data of your dataset for the report. After prepared the data the export can proceed.

    The file was created and open it with a texteditor there is data inside, but I cannot open this file with office.

Leave a Comment

Rich Text Editor. To edit a paragraph's style, hit tab to get to the paragraph menu. From there you will be able to pick one style. Nothing defaults to paragraph. An inline formatting menu will show up when you select text. Hit tab to get into that menu. Some elements, such as rich link embeds, images, loading indicators, and error messages may get inserted into the editor. You may navigate to these using the arrow keys inside of the editor and delete them with the delete or backspace key.