Einzelnen Beitrag anzeigen

khh

Registriert seit: 18. Apr 2008
Ort: Südbaden
1.903 Beiträge
 
FreePascal / Lazarus
 
#12

AW: xml file erstellen

  Alt 22. Jun 2015, 17:59
alsooo

mit TXMLDocument habe ich jetzt eine Datei erzeugt.

so
Delphi-Quellcode:
  pfad := 'C:\temp2\test2.xml';
    Doc := TXMLDocument.Create;
    Doc.XMLVersion:= '1.0';
    WriteXMLFile(Doc, pfad);
bekomme ich eine Zeile in das File:
<?xml version="1.0" encoding="UTF-8"?> immerhin etwas


aber wie bekomme ich meine Excelstruktur:

Delphi-Quellcode:
<?xml version="1.0"?>
<?mso-application progid="Excel.Sheet"?>
<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:html="http://www.w3.org/TR/REC-html40">
  <DocumentProperties xmlns="urn:schemas-microsoft-com:office:office">
    <Author>ich</Author>
    <LastAuthor>ich</LastAuthor>
    <Created>2012-02-01T12:31:29Z</Created>
    <Version>15.00</Version>
  </DocumentProperties>
  <OfficeDocumentSettings xmlns="urn:schemas-microsoft-com:office:office">
    <AllowPNG />
  </OfficeDocumentSettings>
  <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
    <WindowHeight>12435</WindowHeight>
    <WindowWidth>28800</WindowWidth>
    <WindowTopX>0</WindowTopX>
    <WindowTopY>0</WindowTopY>
    <ProtectStructure>False</ProtectStructure>
    <ProtectWindows>False</ProtectWindows>
  </ExcelWorkbook>
  <Styles>
...

...
....
Die Beispiele die ich gefunden habe, erzeugen mir so was:
Delphi-Quellcode:
<?xml version="1.0"?>
<Root>
  <Element id="1">
    <Item1 Attr1="1" Attr2="1">Item1Value is 1</Item1>
    <Item2 Attr1="1" Attr2="1">Item2Value is 1</Item2>
  </Element>
  <Element id="2">
    <Item1 Attr1="2" Attr2="2">Item1Value is 2</Item1>
    <Item2 Attr1="2" Attr2="2">Item2Value is 2</Item2>
  </Element>
  <Element id="3">
    <Item1 Attr1="3" Attr2="3">Item1Value is 3</Item1>
    <Item2 Attr1="3" Attr2="3">Item2Value is 3</Item2>
  </Element>
</Root>
das sieht zwar schon mal wie ein xml-File aus, aber noch lange nicht so, wie ich meine (Excel-) Datei haben möchte. Gibt es irgendwo brauchbare Beispiele ?

Ich danke euch
Karl-Heinz
  Mit Zitat antworten Zitat