SaveAttachment
Methode (Function) · gibt Boolean zurück
SaveAttachment ist eine Methode der Klasse Aloaha_ZUGFeRD.XML im Aloaha ZUGFeRD SDK.
Beschreibung (Originaltext der englischen SDK-Dokumentation): Saves an attachment of the PDF loaded with LoadPDF2Mem to a file. AttachmentCount must have been read before so that the attachments are loaded.
Rückgabe: True if the file was written; False otherwise (also when the target file already exists and DoOverWrite = False, in which case nothing is written).
Deklaration
Public Function SaveAttachment(ByVal TargetPath As String, ByVal Index As Integer, Optional ByVal DoOverWrite As Boolean = False) As Boolean
Parameter
| Name | Typ | Pflicht | Beschreibung |
|---|---|---|---|
TargetPath | String | erforderlich | Target file path; if it ends with \ the attachment name is appended |
Index | Integer | erforderlich | Zero-based index of the attachment |
DoOverWrite | Boolean | optional (Standard: False) | True deletes an existing target file first and writes the attachment. False (default): an existing target file is never overwritten; nothing is written and False is returned |
Aufruf (VB.NET)
Dim alo As New Aloaha_ZUGFeRD.XML(Aloaha_ZUGFeRD.iXML.ZUGFeRDProfile.comfort, False, "IHR-LIZENZSCHLUESSEL")
Dim TargetPath As String = ""
Dim Index As Integer = 0
If Not alo.SaveAttachment(TargetPath, Index) 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 targetPath = "";
int index = 0;
if (!alo.SaveAttachment(targetPath, index))
{
Console.WriteLine("Fehler: " + alo.Last_Error);
}
COM-Schnittstelle
SaveAttachment ist Mitglied der Schnittstelle Aloaha_ZUGFeRD.iXML (Position 127 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.