[Lazarus] StringGrid SaveToCSV should consider column visibility

Alexsander Rosa alexsander.rosa at gmail.com
Mon Oct 15 19:12:06 CEST 2012


Ok, the second "for" is about the Rows, not the Columns (duh).
And the "Rows[i]" does not know about visibility.
Maybe a hand-made FOR to create the line is needed?

2012/10/15 Alexsander Rosa <alexsander.rosa at gmail.com>

> I've managed to modify Grids.pas (SaveToCSVStream, line 10452) for the
> headers:
>
> *            for i := 0 to ColCount-1 do begin*
> *              c := ColumnFromGridColumn(i);*
> *              if c=nil then*
> *                HeaderL.Add(Cells[i, 0])*
> *              else*
> *                if c.Visible then*
> *                  HeaderL.Add(c.Title.Caption);*
> *            end;*
>
> But the other "IF" for the data did not work:
>
> *    for i:=StartRow to RowCount-1 do begin*
> *      c := ColumnFromGridColumn(i);*
> *      if c <> nil then*
> *        if not c.Visible then Continue;*
> *      Rows[i].StrictDelimiter := False; //force quoting of strings that
> contain whitespace or Delimiter*
> *      Rows[i].Delimiter:=ADelimiter;*
> *      Lines.Add(Rows[i].DelimitedText);*
> *    end;*
>
> Any ideas?
>
> --
> Atenciosamente,
> Alexsander da Rosa
>
>
>


-- 
Atenciosamente,
Alexsander da Rosa
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20121015/76082fe0/attachment-0003.html>


More information about the Lazarus mailing list