Excel export

Hallo,
ich habe einige Tools ausprobiert um Tabellen nach Excel zu exportieren. Bei allen Tools habe ich das gleiche Problem: Meine Exceltabellen bleiben ohne Eintrag. Wo liegt das Problem?

roland
Um Arcview Tabellen in Excel einzulesen ist keinerelei Extension notwendig. Excel importiert dbase IV .
Dieses Script aus den Xtools funktioniert eigentlich hervorragend. Man muss nur einmal angeben, wo sich die Excel.exe befindet.
Bei DBF-Export mit ArcView hat man zu viele Probleme, insbesondere mit Umlauten


'Script entnommen den "XTOOLS"
'Eingedeutscht und angepasst von Jürgen Evert


' Get the active document, which should be a Table. Bail if not a table:
theTable = av.GetActiveDoc
if (theTable.Is(Table).Not) then
MsgBox.Error("Starten Sie das Script von einer Tabelle aus!","Error")
return nil
end

'===========================================================

' Check $Home for a text file named exelpath.txt containing the path to Excel. If not there,
' ask the user where Excel is located, then make and store a file named exelpath.txt

' Check for the existence of the file named exelpath.txt:
thePathFileName = Filename.Make("$HOME\exelpath.txt")
thePathFileExists = File.Exists(thePathFileName)

' If exelpath.txt exists, open it, and read the path to excel:
if (thePathFileExists = true) then
thePathFile = LineFile.Make(thePathFileName, #FILE_PERM_MODIFY)
theRecord = thePathFile.ReadElt
if(theRecord.Contains("excel.exe")) then
theExcelFile = Filename.Make(theRecord)
theExcelFileExists = File.Exists(theExcelFile)
else
theExcelFileExists = false
end
thePathFile.Close
end

' If either file is missing or in the wrong location, get the correct location and make a new path file:
if ((thePathFileExists = false) or (theExcelFileExists = false)) then
theExcelFile = FileDialog.Show("excel.exe","Excel Programm", "Suche Datei EXCEL.EXE.")
if(theExcelFile = nil) then exit end
theExcelFileExists = File.Exists(theExcelFile)
thePathFile2 = LineFile.Make(thePathFileName, #FILE_PERM_CLEARMODIFY)
thePathFile2.WriteElt(theExcelFile.GetName)
thePathFile2.Close
end

av.PurgeObjects

' Start the Microsoft Excel Program
if (theExcelFileExists = true) then
system.Execute(theExcelFile.AsString)
else
exit
end

' Create the ArcView DDEClient. This initiates the Excel conversation. Verify that there are no errors.
systemClient = DDEClient.Make( "Excel", "System")
if (systemClient.HasError) then
MsgBox.error( systemClient.GetErrorMsg, "")
return nil
end

' Create the new Excel worksheet
systemClient.Execute( "[NEW(1,0,FALSE)]")


' Get the name of the new worksheet. Selection is an Excel item supported for the System topic.
selection = systemClient.Request( "Selection" )
spreadsheet = selection.Left( selection.IndexOf("!"))

' Ensure R1C1 format
systemClient.Execute( "[Workspace(,,TRUE)]" )
systemClient.Close

' Open a new conversation with the Excel spreadsheet as the topic
ssClient = ddeClient.Make( "Excel", spreadsheet )

' Get table information for later use
tableName = theTable.GetName
theVTab = theTable.GetVTab
theFields = theVTab.GetFields

' Write the table name to the spreadsheet
row = 1
column = 1
ssClient.Poke( "Z"+row.AsString+"S"+column.AsString, tableName )


' END OF THE INITIAL SETUP

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Ask for User input:
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

' Save the current selection
oldSelRecs = theVtab.GetSelection.Clone

' Set the selection. Use selected records if there are any, otherwise iterate through the entire FTab...
if (theVtab.GetSelection.Count > 0) then
SelRecs = theVtab.GetSelection
else
SelRecs = theVtab.GetSelection
SelRecs.SetAll
end
SelRecNum = SelRecs.Count

' Ask the user which fields to include:
fieldlist = Msgbox.MultiList(theFields,"Wählen Sie die zu exportierenden Felder","Exportiere "+SelRecNum.AsString+" Datensätze nach EXCEL")
if (fieldlist= nil) then exit end


' END OF USER INPUT.

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Begin the export process
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
av.ShowMsg("Exportiere nach Excel ...")

' Write chosen field names to the spreadsheet
row = 2
column = 0
for each f in fieldList
column = column + 1
ssClient.Poke( "Z"+row.AsString+"S"+column.AsString, f.GetName )
end


' Write the values for selected features to spreadsheet
currentrec = 0
av.ShowStopButton
totalrec = SelRecs.Count

for each rec in SelRecs

' Show Progress routine:
currentrec = currentrec + 1
progress = (currentrec / totalrec) * 100
proceed = av.SetStatus( progress )
if (proceed.Not) then
av.ShowMsg( "Stopped" )
av.ClearStatus
theVtab.setselection(oldSelRecs)
theVtab.updateselection
av.PurgeObjects
exit
end

row = row + 1
column = 0
for each f in fieldList
column = column + 1

if (f.IsTypeShape) then
dataString = "Shape"
elseif(f.gettype= #FIELD_DECIMAL ) then
dataString = theVTab.ReturnValuestring( f, rec).asstring
datastring=datastring.substitute(".",",")
else
dataString = theVTab.ReturnValuestring( f, rec)
end

ssClient.Poke( "Z"+row.AsString+"S"+column.AsString, dataString )
end
end


' END OF THE EXPORT TO EXCEL PROCESS

'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Begin the post-export cleanup.
'''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''

theVtab.setselection(oldSelRecs)
theVtab.updateselection
av.PurgeObjects
av.ClearStatus
av.ShowMsg("Export nach Excel beendet !")

ssClient.Close





http://www.juergenevert.de
Die X-Tools habe ich auch schon versucht. Den Pfad zu Excel gebe ich jedes mal an. Das Programm
fragt was für Attribute übernommen werden sollen, auch das funktioniert noch. Dann wird ein wenig rumgerechnet und das Ergebnis ist ein Excel Datein mit einem Blatt wo nicht drin steht??????????????????