Autor Beitrag
PreMarT
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 57

Work: Win XP ; Home: Win Vista 64-Bit

BeitragVerfasst: Di 27.10.09 11:01 
Hallo Leutz,

steh vor nem kleinen Problem. Wie die überschrift schn sagt muss ich ein Excel-File überprüfen.

Und zwar muss ichs chauen ob es wirklich ein Excel-File ist, dass heisst nicht einfach ein *.jpg in *.xls umgewandelte Datei.

Gibt es da funtionen die sowas wie fileexist machen? Dann quasi filerealxls oder sowas?

Ich hab da was mit BIFF8 und BIFF8x gefunden was wohl standarte für Excel sind aber schlau bin ich net geworden.

Man müsste ja dann irgendwie den Header einer Datei überprüfen, aber leider weis ich net wie.

Bin für jede Hilfe dankbar, häng nämlich schon sehr lang an dem Problem.

MFG

PMT
Lannes
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 2352
Erhaltene Danke: 4

Win XP, 95, 3.11, IE6
D3 Prof, D4 Standard, D2005 PE, TurboDelphi, Lazarus, D2010
BeitragVerfasst: Di 27.10.09 13:47 
Hallo,

eine Differenzierung zwischen xls und jpg wird relativ einfach sein:
xls file-extension.net/s...r/file_extension_xls :arrow: Header Hexdump: D0 CF 11 E0 A1 B1 1A E1 00
jpg file-extension.net/s...r/file_extension_jpg :arrow: Header Hexdump: FF D8 FF

aber u.A. auch
doc file-extension.net/s...r/file_extension_doc :arrow: Header Hexdump: D0 CF 11 E0 A1 B1 1A E1 00

Da wirst Du dann tiefer in das Dateiformat einsteigen müssen, vielmehr in alle Formate um eine eindeutige Stelle zu finden, die in keinem der anderen Formate enthalten sein kann. :roll:

Schau auch mal dort: Link
Zitat:
D0 CF 11 E0 A1 B1 1A E1 -> ÐÏ.ࡱ.á
DOC, DOT, PPS, PPT, XLA, XLS, WIZ Microsoft Office applications (Word, Powerpoint, Excel, Wizard)
[See also Word, Powerpoint, and Excel "subheaders" at byte offset 512]
[Note the similarity between D0 CF 11 E0 and the word "docfile"!]
AC_ CaseWare Working Papers compressed client file
ADP Access project file
APR Lotus/IBM Approach 97 file
DB MSWorks database file
MSC Microsoft Common Console Document
MSI Microsoft Installer package
MTW Minitab data file
OPT Developer Studio File Workspace Options file
PUB MS Publisher file
SOU Visual Studio Solution User Options file
SPO SPSS output file
VSD Visio file
WPS MSWorks text document


Das wird eine Lebensaufgabe, denke das Du mit dem Abfangen von Fehlern beim Laden einer "falschen" xls-Datei eher zum Ziel kommst.

_________________
MfG Lannes
(Nichts ist nicht Nichts) and ('' <> nil ) and (Pointer('') = nil ) and (@('') <> nil )