SMExport/SMImport suite

SMExport suite: FAQ

Q1 How can I export into html the hyperlinks from table field?
Q2 I don't want to use a BDE. How can I disable it?
Q3 Which third-party components (grids and databases) are supported by SMExport?
Q4 I want to use SMExport in application server. Any hints for me?
Q5 How can I create an XML-file which will be compartible with TClientDataset/ADO?
Q6 During data exporting into Excel file, MS Word or MS Access I have some warning dialogs inside Delphi/C++Builder IDE. What can I do?
Q7 Can I save the export settings in some file and use it in SMImport as default?
Q8 Can you describe a difference between TSMExportToXLS and TSMExportToExcel components?
Q9 Can I create own progressbar and update it during export process?
Q10 How can I export a TStringGrid to MS Excel?
Q11 What is the xsl-file for exporting into XML?
Q12 How can I use TSMExpoprtToXML component?
Q13 How can I activate a possibility to work with some direct database engine?
Q14 How can I apply the updated version?
Q15 How can I exclude a Paradox format for wizard dialog?
Q16 I want to save export settings and reuse in future. How can I do it?
Q17 How can I use translated resources (non-english)?
Q18 How can I request update for new version?
Q19 How can I control the position for wizard dialog?

 

 

Question:
In table field I store the hyperlinks (web url) and I want to export these urls as active links which user could open. How can I do it?

Answer:
The any export component (TSMExportToHTML including) have an OnGetCellParams event. there you can modify any value which which will be exported. There you can add to value the html-code for hyperlink "activation":

procedure TForm1.SMExportToHTML1GetCellParams(Sender: TObject;
  Field: TField; var Text: String; AFont: TFont; var Alignment: TAlignment;
  var Background: TColor);
begin
  if Assigned(Field) and

   (UpperCase(Field.FieldName) = 'WWW_LINK') then
    Text := '<a href="' + Text + '">' + Text + '</a>';
end;

The same example you can find in the topic for OnGetCellParams event of help file.

go top

 

Question:
In own application I not use a BDE and don't want to deploy it. Can I disbale a BDE using for SMExport? If yes, then how?

Answer:
Yes, of course, you can disable a BDE using for SMExport.

The SMExport allow to work with any database engine (BDE, ADO, DAO, IBX etc). SMExport use a BDE for exporting into Paradox/dBase only.

So if you'll not use the TSMExportToBDE component in own application or disable the Paradox and dBase formats from Formats property of TSMEWizardDlg/TSMExportMonitor components, your application will not require a BDE at all.

go top


Question:
Where can I find a list of grids and databases which are compartible with SMExport suite?

Answer:
The SMExport suite allow to export a data from any rowset type which is inherited from standard TDataset type. For example,

  • BDE: TTable, TQuery
  • ADO: TADODataset, TADOTable, TADOQuery
  • IBX: TIBTable, TIBQuery
  • MIDAS: TClientDataset
  • dbExpress
  • DOA from Allround Automations
  • IBObjects from Jason Wharton
  • Advantage
  • DBISAM
  • Apollo
  • Halcyon
  • FlashFiler from TurboPower
  • Diamond Access, Diamond dbExpress
  • RxMemoryDataset from RxLib
  • mODBC
  • kaDAO and kaADO
  • and others

Also any grid which have a Datasource property and Columns collection is supported by SMExport as well. For example:

  • standard TDBGrid
  • standard TDecisionGrid, TStringGrid, TListView, TStrings, TMemo etc
  • wwDBGrid from InfoPower
  • TdxDBGrid, dxTreeList and dxDBTreeList from DevExpress (QT v3)
  • any TcxCustomGridTableView (TcxGridDBTableView, for example) from DevExpress (QT v4/5)
  • TMSDBGrid from TMS Software
  • freeware TSMDBGrid from SMComponent library
  • listview from Raize
  • freeware TRxDBGrid from RxLib
  • TDBGridEH from EHLib
  • TVolgaDBGrid from VolgaDB
  • and others

If you have some extended type of third-party grid and/or database engine and want to export it, contact us.

go top


Question:
I want to use SMExport on server side of own multi-tier application. Can I use it?

Answer:
Yes, of course, you can export the data on server-application's side by client request.

A few important notes:

  • you must disable any visual notifications during exporting. So you must disable an animated status dialog (AnimatedStatus := False), to disable any warnings (exclude thesoShowMessage flag from Options property)
  • you can export a data directly in stream instead file on disk. For this task you can call theSaveToStream method instead Execute method. This method is very useful especially for web-services, CGI, ISAPI/NSAPI etc

go top


Question:
I want to create an XML-file which will be succesfully loaded by TClientDataset and/or ADO components.

Answer:
The SMExport suite support such feature. All what you need is to change a Format property of TSMExportToXML component to xmlClientDataset.

The default value is xmlIE.

go top


Question:
During data exporting into Excel file, MS Word or MS Access I have some warning dialogs inside Delphi/C++Builder IDE. What can I do?

Answer:
If you defined a UseCurrentInstance property of export component in True, then SMExport will try to find a current running instance of MS Excel/Word/etc. Inside of code I used try-except statement for activation of current instance (if exist) and if the instance is not available I'll create a new (in except clause).

If you ran a project from Delphi IDE, you received a warning. But if you'll run a same project from Explorer (not from Delphi IDE), application will work without any warnings.

PS: as alternative you can uncheck the "Stop on exception" option (or "Debug on exception" - it depends from Delphi version) in the Debugger Options item of Tools menu. You'll find this option on Language Exceptions page.

But anyway if UseCurrentInstance = False, then you'll receive an error message only if MS Office is not installed on computer. No other reason.

go top


Question:
Can I save the export settings in some file and use it in SMImport as default?

Answer:
Yes, of course. Any export and import component have the SaveSpecification and LoadSpecification methods. The specification is the smi-file which contains any required information - export format, delimiters/qualifiers/separators, field mapping etc

Also don't forget that you can give a same functionality for your end-users by default - in wizard components (both in SMExport and in SMImport) your user can save/load the own specifications

go top


Question:
Can you describe a difference between TSMExportToXLS and TSMExportToExcel component?

Answer:
The both components generates the Excel spreadsheet as result but these components use differents methods for xls producing.

  • TSMExportToXLS generate xls-spreadsheet on low level - byte-by-byte. This component is very-very fast and generate Excel file of v4.0 which can be opened in any version of MS Excel application. This component will work without any problem on any computer (even where MS Excel is not installed) but have a few limitations:

    - soMergeData flag of Options property is not supported
    - number of different fonts/colors is limited. The max count is 4
    - the max length of exported text in each cell is 255. So any long MEMO-fields will be truncated

  • TSMExportToExcel use MS Excel application as OLE-object so the MS Excel must be installed on client computers for correct work. The export process is not so fast as for TSMExportToXLS but haven't any limitations as described above

go top


Question:
Can I create own progressbar for export process?

Answer:
Yes, of course, you can create an alternative progressbar instead default animated status dialog.

For this task you may in OnGetCellParams to check a ExportedRecordCount property and update own Progressbar component

go top


Question:
How can I export a TStringGrid into MS Excel?

Answer:
Basic idea of exporting og VCL controls is the next:

  1. you must create a SMEStringGridDataEngine component from SMExport+ page
  2. define StringGrid property of this component (just select a desired control which you want to export)
  3. any export component (from SMExport page of palette) have a new DataEngine property - select in the ObjectInspector your created SMEStringGridDataEngine component
  4. switch a ColumnSource property of export component to csDataEngine (default value is csDBGrid)
  5. customize proprties of export and just call Execute method

It's all.

The same method is available for any other control (not a StringGrid) - just create another dataengine (TSMEListViewDataEngine, TSMEwwDBGridDataEngine, TSMEStringsDataEngine etc)

If you haven't any VCL control and want to "prepare" a data in events, you can use TSMEVirtualDataEngine and "navigate" thru your "data" in the events of this component (OnFirst/OnNext/OnGetValue etc)

I developed small demo which can be downloaded at http://www.scalabium.com/download/sme/sme_sg2xls.zip (200Kb)

go top


Question:
What is the xsl-file for exporting into XML?

Answer:
Starting from SMExport 4, the TSMExportToXML component support the xsl-scheme generation with implemented "presentation" of xml-file.

By standard, XML file contain a pure data without any visualization (colors/fonts/alignments etc) and by default any browser (MS Internet Explorer, for example) will display xml-file as tree where every source row is your exported record.

Of course, better to show your xml-file as table, for example. The xsl-scheme is a such "rule".

TSMExportToXML support a few different formats of xml-file (see Format property) and for every format SMExport will generate a correct xsl-scheme.

If you don't want to generate xsl-scheme, just set GenerateXSL property in False.

go top


Question:
How can I use TSMExportToXML component?

Answer:
For correct work you must:
1. define a source of data which you want to export:

  • if this is DBGrid, define a DBGrid property and set ColumnSource = csDBGrid
  • if this is Dataset, define a Dataset property and set ColumnSource = csDataset
  • else define a DataEngine property and set ColumnSource = csDataEngine (of course, you must turn your dataengine from SMExport+ page of component palette)

2. define a FileName property with full file name which will be created with exported data (like c:\archive\xml\data.xml)
3. you can select desired Format property.

  • by default will be generated a file which is more readable with tree of records (you can easy read it in any text editor) - Format=xmlIE
  • if you'll select xmlCompactIE, you'll receive a similar as xmlIE but file size will be less (without added spaces)
  • if you'll select xmlClientDataset, then exported file will be compartible with TClientDataset format (you could load it using LoadFromFile method!)
  • if you'll select xmlElement, then xml will be exported in more popular format which can be loaded in any db-server

4. if you want, you can generate the xsl-scheme for created xml - just set GenerateXSL=True
5. it's all - just call Execute method

go top


Question:
How can I activate a possibility to work with some direct database engine?

Answer:
You may open in any editor the sme.inc file. There you'll find the similar strings:

//{$DEFINE ADO_SUPPORT}
//{$DEFINE IBX_SUPPORT}
//{$DEFINE DOA_SUPPORT}
//{$DEFINE INFOPOWER_SUPPORT}
//{$DEFINE DEVEXP_SUPPORT}
//{$DEFINE DEVEXP_CX_SUPPORT}
//{$DEFINE DECISIONCUBE_SUPPORT}
//{$DEFINE DBGRIDEH_SUPPORT}
//{$DEFINE VOLGAGRID_SUPPORT}
//{$DEFINE RAIZE_SUPPORT}
//{$DEFINE FXCUBE_SUPPORT}

You can uncomment desired engine and recompile a project. After recompilation you'll see new components on SMExport and SMExport+ pages of component palette.

For example, if you have a DOA installed (direct access to Oracle), uncomment the DOA_SUPPORT line (just remove first two slash-chars.

If you have installed Delphi 5 or 6 or 7 Enterprise edition, you can uncomment the ADO_SUPPORT and IBX_SUPPORT lines.

go top


Question:
How can I apply the updated version?

Answer:
You must apply it in two steps:

1. uninstall a previous version

  • run a Delphi IDE
  • select Close All from File menu
  • select Install Packages item from Component menu
  • select a package in listbox which you want to uninstall
  • press Remove button

2. install a new version from sources

  • select Open item from File menu
  • change the FileType to package source (*.dpk/*.bpk)
  • select the package file from folder where you unzipped files
  • in the package window press the Install button
  • after compile in the palette on SMExport and SMExport+ pages you can find the components

IMPORTANT:
you must check that folder name with previous version is removed from search path of Delphi/C++Builder IDE and your project. To check it you can in:

  • Tools\Environment Options\Library\Library path
  • Project\Options\Directories and Conditionals\Search path

There you must have a folder with new version but not with previous.

go top


Question:
How can I exclude a Paradox type for wizard component?

Answer:
Do you want to show/hide some formats in wizard? If yes, then:

  1. to exclude Paradox and DBase from list of formats which will see the end-user:
    SMEWizardDlg1.Formats := SMEWizardDlg1.Formats - [teParadox, teDBase]
  2. to include Excel into list of formats:
    SMEWizardDlg1.Formats := SMEWizardDlg1.Formats + [teXLS]

go top


Question:
I want to save export settings and reuse in future. How can I do it?

Answer:
Any export component have a SaveSpecification method which allow to save current settings and LoadSpecification method allow to load saved settings.

Also user can save and load specifications in wizard component. It's very useful because allow to save some predefined "templates" with more used settings which user can load and include some minor changes for succesful exporting.

go top


Question:
IHow can I use translated resources (non-english)?

Answer:
If your application is non-english (german or french, for example), just copy the ExCnst.pas unit from SOURCES\RESOURCES\* folder (just override unit with default english resources).
In this folder you'll find a lot of sub-folders for existing translations (one sub-folder per one language). For example, GER contain german resources, ITA contains italian resources etc

The OnGetLanguageString event is required if your application is a multi-lingual (for example, user can switch a language without any recompilation). The sample of using you can see in help file - there I placed an example.

go top


Question:
How can I request the update for new version?

Answer:
For update you may send an email message to update@scalabium.com
Please include in message body any registration information - order number or tracking id or password etc. Without this information you will not find your record in our database.

When we'll recieve your message, we'll send you the confirmation that your request added in queue and will be processed soon.

Most requests are processed during one-two business days and archive with registration version will be sent to you by email. Only delay is possible after new release when we recieve a lot of requests for update.

IMPORTANT:
if your mail server have some limiations (limited max message size or password-protected files are not allowed), please include a note in body of your request. In this case we'll provide you a direct link where you could download a file with registration version.

Note that minor updates are free-of-charge. But all major releases are not free but available for discount. If you want to upgrade your licence for new major version, please contact sales@scalabium.com and we'll provide your a direct link for online order with discount.

go top


Question:
How can I control the position for wizard dialog?

Answer:
By default wizard will be displayed in center of screen. But you may use OnShow event for wizard component and change the position as you like.

For example:

procedure TForm1.SMEWizardDlg1Show(Sender: TObject);
begin
  with (Sender as TForm) do
  begin
    Position := poDesigned;
    Left := 5;
    Top := 5
  end;
end;

Note that in this event you may also change another properties too - for example, to change the BorderStyle property.

go top


 

Borland Software Code Gear Scalabium Delphi tips Scalabium Delphi tips

Copyrightc 1998-2017, Scalabium Software. All rights reserved.
webmaster@scalabium.com

January 10, 2005

SMExport advertising