JRIchmann Posted January 28, 2015 Posted January 28, 2015 Hi... I have a Query.... Query is shown in Grid... Now I want export this Grid to local machine (as CSV oder as XLS) have you a Tip for me Or a Demo ? I use: Delphi XE7 and latest Version of UniGui with UniDac from DevArt. bye and thanks www.JRichmann.de Quote
Administrators Farshad Mohajeri Posted January 28, 2015 Administrators Posted January 28, 2015 You need a 3rd party to achieve this. FleXecl from TMS is recommended. Quote
fcarvalho4 Posted January 28, 2015 Posted January 28, 2015 You can use the JvDBGridExcelExport from JEDI components, http://jvcl.delphi-jedi.org Quote
johnp Posted February 13, 2015 Posted February 13, 2015 Can you send a example JvDBGridExcelExport to set the properties. I cannot enter the name of the uniGUIgrid in the JvDBGridExcelExport grid property. Quote
mmurgas Posted February 18, 2015 Posted February 18, 2015 hello try this code... procedure ExportarCSV(Dataset: TDataset; Archivo: String); var iArchivo: TStringlist; Linea: String; i: Integer; begin iArchivo := TStringlist.Create; Linea := ''; for i := 0 to Dataset.FieldCount - 1 do begin if Dataset.Fields[i].Visible then begin if Linea <> '' then Linea := Linea + ';'; Linea := Linea + AnsiQuotedStr(Dataset.Fields[i].DisplayLabel, '"'); end; end; iArchivo.Add(Linea); Dataset.DisableControls; Dataset.First; while not Dataset.Eof do begin Linea := ''; for i := 0 to Dataset.FieldCount - 1 do begin if Dataset.Fields[i].Visible then begin if Linea <> '' then Linea := Linea + ';'; Linea := Linea + AnsiQuotedStr(Dataset.Fields[i].AsString, '"'); end; end; iArchivo.Add(Linea); Dataset.Next; end; Dataset.First; Dataset.EnableControls; iArchivo.SaveToFile(Archivo); end; Call fname := 'F' + FormatDateTime('hhmmss', Now()) + '.csv'; // Create a unique name for report. ExportarCSV(Dm.myQuery,UniServerModule.LocalCachePath + fname); unisession.SendFile(UniServerModule.LocalCachePath + fname); Quote
jahlxx Posted March 7, 2017 Posted March 7, 2017 Hi. I'm testing this solution and have a problem. When unisession.sendfile raises, it ask for save file or open with ... If select save, and I open it later, it works. But if I select Open with excel, it opens but unformatted. Any solution for this? Thanks. Quote
mehmet07 Posted March 8, 2017 Posted March 8, 2017 http://forums.unigui.com/index.php?/topic/5207-export-to-excel-without-excel/?hl=nativexlsexport&do=findComment&comment=26825 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.