Zusammenfassung
Provides the ability to add a table to a data frame within a map document (.mxd).
Auswertung
AddTableView provides a way to add a table into a map document. A reference to a TableView object must exist first. It can be a reference to a table in another map document by using the ListTableViews function, or it can be a reference to a table in a workspace by using the TableView function.
Syntax
AddTableView (data_frame, add_table)
Parameter | Erklärung | Datentyp |
data_frame | A reference to a DataFrame object within a map document. | DataFrame |
add_table | A reference to a TableView object representing the table to be added. This reference can point to a table within an existing map document or it can reference a table in a workspace via the TableView function. | TableView |
Codebeispiel
AddTableView example
The following script will add three tables from three different workspaces to a single data frame in a map document. The different workspaces are shapefile/dBASE, file geodatabase, and SDE.
import arcpy
mxd = arcpy.mapping.MapDocument(r"C:\Project\Project.mxd")
df = arcpy.mapping.ListDataFrames(mxd, "New Data Frame")[0]
dbf_Table = arcpy.mapping.TableView(r"C:\Project\Data\customers.dbf")
fGDB_Table = arcpy.mapping.TableView(r"C:\Project\Data\fGBD.gdb\customers")
SDE_Table = arcpy.mapping.TableView(r"C:\PathToSDEConnectionfile.sde\customers")
arcpy.mapping.AddTableView(df, dbf_Table)
arcpy.mapping.AddTableView(df, fGDB_Table)
arcpy.mapping.AddTableView(df, SDE_Table)
mxd.saveACopy(r"C:\Project\Project2.mxd")
del mxd