Home > Back-end >  Delphi2010 ListView export data to Execl problem
Delphi2010 ListView export data to Execl problem

Time:09-26

Original location http://bbs.csdn.net/topics/380148387
Don't let back, so the new post.

Met and hug the original problem, then after a search, found the solution.

Classic ListView data online rapid export EXECL method is provided by the DELPHI7 version of the source code, after using, found in DELPHI2010, data export gibberish, following a modified version of the code can solve the problem.

Procedure WriteStringCell (AValue: String);//write string data
Var
L: Word;
StrAnsi: AnsiString;//the new is used to switch to the ANSI format
The begin
StrAnsi:=PAnsiChar (AnsiString (AValue));//convert raw data into the ANSI format, other use all it is ok to replace the AValue.
L:=Length (strAnsi);
ArXlsString [1] :=8 + L;
ArXlsString [2] :=Row;
ArXlsString [3] :=Col;
ArXlsString [5] :=L;
AFileStream. WriteBuffer (arXlsString, Sizeof (arXlsString));
AFileStream. WriteBuffer (Pointer (strAnsi) ^, L);
IncColRow;
end;
StrAnsi:=PAnsiChar (AnsiString (STR));

If anyone is there a good export code, please also post. Thank you.
  • Related