AndersonSOS Posted April 4, 2017 Share Posted April 4, 2017 Hello friends I would like information if there is any way to export information in a query, grid or dataset to excel in unigui. I have a report generation screen that is viewed in Fast Report and the client wants to export to excel, but the native delphi options that work with error unit COMobj. If someone has an example I thank you very much Hello friends I would like information if there is any way to export information in a query, grid or dataset to excel in unigui. I have a report generation screen that is viewed in Fast Report and the client wants to export to excel, but the native delphi options that work with error unit COMobj. If someone has an example I thank you very much Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 5, 2017 Share Posted April 5, 2017 Hi, Can help: http://forums.unigui.com/index.php?/topic/5207-export-to-excel-without-excel/&do=findComment&comment=26719 Quote Link to comment Share on other sites More sharing options...
delagoutte Posted April 5, 2017 Share Posted April 5, 2017 i'm using scalabium export suite : http://www.scalabium.com/sme/ It work fine. i use it for excel, json, xml, csv,... Quote Link to comment Share on other sites More sharing options...
Harry Rogers Posted April 5, 2017 Share Posted April 5, 2017 I too use Scalabium and am very happy with it. Quote Link to comment Share on other sites More sharing options...
AndersonSOS Posted April 5, 2017 Author Share Posted April 5, 2017 I installed the SMSExport package and put the components SMEDatasetDataEngine1 and SMExportToXLS but when I enter the screen that includes these components it gives the message:Raised exception class EConvertError with message 'Can not assign a nil to TFont'Please any tips?Thank you Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 5, 2017 Share Posted April 5, 2017 Hi, Probably, there is a visual component on the form (not UniGUI), can you check it? Best regards. Quote Link to comment Share on other sites More sharing options...
AndersonSOS Posted April 5, 2017 Author Share Posted April 5, 2017 Possibly not, because if you remove the SMExportToXLS component from the form it normally opens Quote Link to comment Share on other sites More sharing options...
rencarnacion Posted April 5, 2017 Share Posted April 5, 2017 I user Flexcel from TMSSoftware , excellent tool Quote Link to comment Share on other sites More sharing options...
Harry Rogers Posted April 6, 2017 Share Posted April 6, 2017 This is how I have it set up. The user-visible form has a button, its click creates a filename and invokes the execute method of the SME Export which is on the MainModule. procedure TfrmSQLRes.btn2ExcelClick(Sender: TObject); var fname : string; begin fname := makeFilename('.XLS'); // construct an appropriate filename // NB this is the initial unigui-server copy before sending to users machine unimainmodule.SMExportToXLS1.filename := fname; unimainmodule.SMExportToXLS1.Execute; end; The properties of the export component are object SMExportToXLS1: TSMExportToXLS AnimatedStatus = False DataFormats.DateOrder = doDMY DataFormats.DateSeparator = '/' DataFormats.TimeSeparator = ':' DataFormats.FourDigitYear = True DataFormats.LeadingZerosInDate = True DataFormats.ThousandSeparator = ',' DataFormats.DecimalSeparator = '.' DataFormats.CurrencyString = #163 DataFormats.BooleanTrue = 'True' DataFormats.BooleanFalse = 'False' DataFormats.UseRegionalSettings = False KeyGenerator = 'Some String thast describes your app' Options = [soUseFieldNameAsCaption, soColLines, soRowLines, soAutoCloseStatistic] TitleStatus = 'Exporting...' Statistic.CurrentRowHeight = 0 OnAfterExecute = SMExportToXLS1AfterExecute Columns = <> Bands = <> DefaultFont.Charset = DEFAULT_CHARSET DefaultFont.Color = clWindowText DefaultFont.Height = -11 DefaultFont.Name = 'Arial' DefaultFont.Style = [] DataSet = QRYGen <<<<<<< This is the TDataSet we wish to export ColumnSource = csDataSet FileName = 'c:\exfiles\exp1.xls' << from memory I think it did not like an initial blank entry? AddTitle = True CharacterSet = csUnicode DetailSources = <> ExportStyle.Style = esNormal ExportStyle.OddColor = clBlack ExportStyle.EvenColor = clBlack UserName = 'Harry' Left = 168 Top = 72 end To allow the user to save the result to their own machine use the afterexecute method: procedure TUniMainModule.SMExportToXLS1AfterExecute(Sender: TObject); begin //offer the user the smExportToXLS1 Result UniSession.SendFile(smExportToXLS1.filename); end; All the best Quote Link to comment Share on other sites More sharing options...
delagoutte Posted April 6, 2017 Share Posted April 6, 2017 You could see this post for another exemple with smexport : http://forums.unigui.com/index.php?/topic/7570-unidbgrid-with-smexporttoexcel/?hl=smexport Quote Link to comment Share on other sites More sharing options...
AndersonSOS Posted April 6, 2017 Author Share Posted April 6, 2017 Thanks for the help, was using the visual component, when I used only via command, it worked perfectly. Quote Link to comment Share on other sites More sharing options...
Valdo_Souza Posted October 4, 2021 Share Posted October 4, 2021 Thanks for the help, it worked perfectly. Quote Link to comment Share on other sites More sharing options...
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.