Export Attribute Table

Plugin Introduction:

This sample is used to export the attribute table of a vector dataset or a tabular dataset into Excel.

Control/Object/Interface:

Control/Object/Interface Properties Methods
Plugin   Initialize(), ExitInstance()
CtrlAction   Run()
IDockBar DockStyle, Control, Visible  
Application ActiveApplication, MainForm, Workspace Output()
IFormMain DockBarManager  
Workspace Datasources  
Dataset Type  
Layer Dataset  
DatasetVector   Query()
Recordset RecordCount, FieldCount MoveFirst(), MoveNext(), GetFieldInfos(), GetFieldValue()

Basic Steps:

  1. Open ExportAttributeToExcel.sln in the SuperMap iDesktop 8C\SampleCode\ExportAttributeToExcel folder with Microsoft Visual Studio 2008 and compile it.
  2. When succeeded, you can find two files generated: SuperMap.Desktop.ExportAttributeToExcel.dll located in the SuperMap iDesktop 7C\Bin\Plugins\ExportAttributeToExcel folder and SuperMap.Desktop.ExportAttributeToExcel.config located in the SuperMap iDesktop 7C\WorkEnvironment\Default folder.
  3. Copy the SampleIcons folder from the SuperMap iDesktop 8C\SampleCode folder to SuperMap iDesktop 8C\SampleCode\Resources.
  4. Start SuperMap iDesktop 8C and you will find the Attribute Manager tab with the Export into Excel button.
  5. Open World.udb provided in the SuperMap iDesktop 7C\SampleData\World\World.udb folder.
  6. Click the Attribute Manager tab and click the Export into Excel button to display the Export Attributes into Excel dialog box.
  7. In the Export Attributes into Excel dialog box, set parameters for attribute export.:

    Datasource: the datasource where the dataset whose attribute table you want to export is located. Here we choose World.

    Dataset: the dataset whose attribute table you want to export into Excel. Here we choose Countries.

    Destination: click to specify where you want to place the result file and the name of the .xls file.

  8. When finished, click Export.
  9. When you see "Succeeded to export attributes into ...", it means exporting operation is finished. Now, you can open the result .xls file to view the results.

Data:

SuperMap iDesktop 7C\SampleData\World\World.udb.

Note:

When you successfully compile ExportAttributeToExcel.sln, SuperMap.Desktop.ExportAttributeToExcel.dll and SuperMap.Desktop.ExportAttributeToExcel.config will be generated and copied to SuperMap iDesktop 7C\Bin\Plugins\ExportAttributeToExcel and SuperMap iDesktop 7C\WorkEnvironment\Default respectively. Each time you start SuperMap iDesktop 7C, the ExportAttributeToExcel plugin will be loaded.

If you want to remove the ExportAttributeToExcel plugin from SuperMap iDesktop 7C, you only need to delete SuperMap.Desktop.ExportAttributeToExcel.config in the SuperMap iDesktop 7C\WorkEnvironment\Default folder.