Problem with ExportCSV and two or more SelectedAreas

Questions and answers on how to use XLSReadWriteII 3/4/5.
Post Reply
Bigun
Posts: 3
Joined: Thu Sep 01, 2011 9:21 am

Problem with ExportCSV and two or more SelectedAreas

Post by Bigun »

I'm trying to export to CSV different columns (areas) of a XLS file using XLSReadWriteII v4 and C++ XE2.
What I do basically is:

Code: Select all

XLSReadWriteII41->Read();
TSheet *Pag0= XLSReadWriteII41->Sheets->Items[0];
// Select desired areas
Pag0->SelectedAreas->Add(2,0,2,999); // C1-C999 
Pag0->SelectedAreas->Add(5,0,5,999); // F1-F999 

TExportCSVOptions opciones= TExportCSVOptions() << ecoQuotedStrings <<[b] ecoSelection[/b];
const wchar_t SEPARADOR= L';';
const wchar_t COMILLAS= L'"'; 
Exportcsv4::ExportCSV(XLSReadWriteII41, 0, SEPARADOR, COMILLAS, opciones, outputFile);
What I get in the output file is only column C (the first selected area).
I've followed the Delphi code in ExportCSV.pas and it seems correct: it calls two times ExportRange function, once for each selected area and columns and rows are correctly indicated.

Code: Select all

    if ecoSelection in Options then begin
      for i := 0 to Sheet.SelectedAreas.Count - 1 do
        ExportRange(Sheet.SelectedAreas[i].Col1,Sheet.SelectedAreas[i].Row1,Sheet.SelectedAreas[i].Col2,Sheet.SelectedAreas[i].Row2);
    end
This is a sample of my test XLS.
Empresa Tipo IdOper Concepto Cantidad Importe
1 N 5268748U 95 1,23 1234,5678
1 E 25 96 333,44

Is there something I'm missing or is it related to a bug?
Thank in advance for your help.

Edorta
Post Reply