CreateDocFromXML

Methode (Function) · gibt Boolean zurück

CreateDocFromXML ist eine Methode der Klasse Aloaha_ZUGFeRD.XML im Aloaha ZUGFeRD SDK.

Beschreibung (Originaltext der englischen SDK-Dokumentation): Creates a visual invoice (DOCX or PDF) from a ZUGFeRD / Factur-X / XRechnung XML file using a DOCX template. If the output is a PDF, the XML is also embedded into it (PDF/A-3 hybrid invoice) via MergeXMLIntoPDF.

Rückgabe: True if the output file was created; False otherwise (see Last_Error).

Hinweis: Sends a licence ping.

Deklaration

Public Function CreateDocFromXML(ByVal XMLPath As String, ByVal OutputDocPath As String, Optional ByRef DocxTemplatePath As String = "", Optional ByVal Licensekey As String = "", Optional ByVal DoOverWrite As Boolean = True, Optional ByVal AdditionalAttachment As String = "", Optional ByVal ConverDecimalDot2Comma As Boolean = False) As Boolean

Parameter

NameTypPflichtBeschreibung
XMLPathStringerforderlichPath of the invoice XML file
OutputDocPathStringerforderlichPath of the output file; extension must be .docx or .pdf
DocxTemplatePathStringoptional (Standard: "")DOCX template (input/output). If empty or not existing, the DocXTemplate_Path property is used; if that is empty too, the built-in template is written to the temp folder. The path actually used is returned here
LicensekeyStringoptional (Standard: "")Licence key; if empty the key already set on the object or the global key is used
DoOverWriteBooleanoptional (Standard: True)True allows overwriting an existing output file (default True)
AdditionalAttachmentStringoptional (Standard: "")Optional path of an additional file to embed (PDF output only)
ConverDecimalDot2CommaBooleanoptional (Standard: False)True writes decimal numbers with comma as decimal separator

Aufruf (VB.NET)

Dim alo As New Aloaha_ZUGFeRD.XML(Aloaha_ZUGFeRD.iXML.ZUGFeRDProfile.comfort, False, "IHR-LIZENZSCHLUESSEL")
Dim XMLPath As String = ""
Dim OutputDocPath As String = ""
If Not alo.CreateDocFromXML(XMLPath, OutputDocPath) Then
    Console.WriteLine("Fehler: " & alo.Last_Error)
End If

Aufruf (C#)

var zfStandard = Aloaha_ZUGFeRD.iXML.ZUGFeRDVersion.xInvoice;   // Optional ByRef im Konstruktor: in C# mit ref übergeben
var alo = new Aloaha_ZUGFeRD.XML(Aloaha_ZUGFeRD.iXML.ZUGFeRDProfile.comfort, false, "IHR-LIZENZSCHLUESSEL", ref zfStandard);
string xmlPath = "";
string outputDocPath = "";
string docxTemplatePath = "";
if (!alo.CreateDocFromXML(xmlPath, outputDocPath, ref docxTemplatePath))
{
    Console.WriteLine("Fehler: " + alo.Last_Error);
}

Artikel mit CreateDocFromXML

COM-Schnittstelle

CreateDocFromXML ist Mitglied der Schnittstelle Aloaha_ZUGFeRD.iXML (Position 118 von 343) und damit auch aus VB6, VBA/Access und anderen COM-Clients über CreateObject("Aloaha_ZUGFeRD.XML") aufrufbar. Neue Mitglieder werden immer am Ende von iXML angefügt, damit bestehende COM-Clients unverändert weiterlaufen; nach einem Update die Typbibliothek neu registrieren.

Quelle: XML-Dokumentationskommentare des Aloaha ZUGFeRD SDK (xml.vb). Gleiche Signatur in VB6/VBA über COM. In C# werden ByRef-Parameter mit ref übergeben, VB-Eigenschaften mit Parametern heißen get_…/set_…, optionale Parameter können entfallen.