ich habe hier eine LibreOffice Calc Datei gefunden, die eine XML Datei (für SEPA Lastschriften) generiert.
Die erstellte XML-Datei ist aber "Western (Windows 1252)" kodiert.
Was müsste im Makro der Datei verändert werden, damit diese xml Datei nicht mehr im Dateiformat "Western (Windows 1252)" erstellt wird, sondern mit UTF-8?
Das ist der relevante Teil für xml-Generierung (hoffe ich)?
Code: Alles auswählen
'------------------------------------------------------------------------------
' Write all xml snippets into xml file
'------------------------------------------------------------------------------
Sub WriteXmlFiles ()
Dim iFileNum As Integer
Dim sXmlBase As String
Dim sXmlFile As String
Dim sPathAndFile As String
Dim sFrstMsg As String
Dim sRcurMsg As String
Dim sFnalMsg As String
Dim sOoffMsg As String
Dim iNum As String
Dim sExportDay As String
Dim sExportMon As String
Dim sDS As String
Dim sFL As String
sExportDay = InterDate2(DateValue(sToday))
sExportMon = Left(sExportDay,Len(sExportDay)-3)
'number of all found data records
iNum = iFrstNum + iRcurNum + iFnalNum + iOoffNum
If sTabLang = "DE" Then
sDS = " Datensätze"
sFL = " in der Datei "
sXmlBase = sExportMon + "_SEPA-Lastschrift"
Else
sDS = " data records"
sFL = " in the file "
sXmlBase = sExportMon + "_SEPA-DirectDebit"
End If
'create URL of file for SeqType=FRST
If (iFrstNum > 0) Then
sXmlFile = sXmlBase & "_frst_" & sExportDay & ".xml"
sPathAndFile = sFullPath & "/" & sXmlFile
'delete file if exist
If FileExists (sPathAndFile) Then
Kill (sPathAndFile)
End If
'open binary file (without LF after each write access)
iFileNum = Freefile
Open sPathAndFile For Binary As #iFileNum
'write all data into binary file
Put #iFileNum,,SEPA_A_Header
Put #iFileNum,,SEPA_B_FRST_Group + SEPA_C_FRST_Header
Put #iFileNum,,SEPA_D_FRST_Collect + SEPA_E_FRST_Footer
Put #iFileNum,,SEPA_F_Footer
'close binary file
Close #iFileNum
sFrstMsg = iFrstNum & sDS & sFL & sXmlFile & sLineEnd
End If
'create URL of file for SeqType=RCUR
If (iRcurNum > 0) Then
sXmlFile = sXmlBase & "_rcur_" & sExportDay & ".xml"
sPathAndFile = sFullPath & "/" & sXmlFile
'delete file if exist
If FileExists (sPathAndFile) Then
Kill (sPathAndFile)
End If
'open binary file (without LF after each write access)
iFileNum = Freefile
Open sPathAndFile For Binary As #iFileNum
'write all data into binary file
Put #iFileNum,,SEPA_A_Header
Put #iFileNum,,SEPA_B_RCUR_Group + SEPA_C_RCUR_Header
Put #iFileNum,,SEPA_D_RCUR_Collect + SEPA_E_RCUR_Footer
Put #iFileNum,,SEPA_F_Footer
'close binary file
Close #iFileNum
sRcurMsg = iRcurNum & sDS & sFL & sXmlFile & sLineEnd
End If
'create URL of file for SeqType=FNAL
If (iFnalNum > 0) Then
sXmlFile = sXmlBase & "_fnal_" & sExportDay & ".xml"
sPathAndFile = sFullPath & "/" & sXmlFile
'delete file if exist
If FileExists (sPathAndFile) Then
Kill (sPathAndFile)
End If
'open binary file (without LF after each write access)
iFileNum = Freefile
Open sPathAndFile For Binary As #iFileNum
'write all data into binary file
Put #iFileNum,,SEPA_A_Header
Put #iFileNum,,SEPA_B_FNAL_Group + SEPA_C_FNAL_Header
Put #iFileNum,,SEPA_D_FNAL_Collect + SEPA_E_FNAL_Footer
Put #iFileNum,,SEPA_F_Footer
'close binary file
Close #iFileNum
sFnalMsg = iFnalNum & sDS & sFL & sXmlFile & sLineEnd
End If
'create file for SeqType=OOFF
If (iOoffNum > 0) Then
sXmlFile = sXmlBase & "_ooff_" & sExportDay & ".xml"
sPathAndFile = sFullPath & "/" & sXmlFile
'delete file if exist
If FileExists (sPathAndFile) Then
Kill (sPathAndFile)
End If
'open binary file (without LF after each write access)
iFileNum = Freefile
Open sPathAndFile For Binary As #iFileNum
'write all data into binary file
Put #iFileNum,,SEPA_A_Header
Put #iFileNum,,SEPA_B_OOFF_Group + SEPA_C_OOFF_Header
Put #iFileNum,,SEPA_D_OOFF_Collect + SEPA_E_OOFF_Footer
Put #iFileNum,,SEPA_F_Footer
'close binary file
Close #iFileNum
sOoffMsg = iOoffNum & sDS & sFL & sXmlFile & sLineEnd
End If
If iNum > 0 Then
If sTabLang = "DE" Then
sMsgString = "Verarbeitete Datensaetze wurden " &_
"in den folgenden Dateien" & sLineEnd & "gespeichert: " & sLineEnd
sMsgHeader = "Hinweis"
Else
sMsgString = "Processed data records were " &_
"stored in the following" & sLineEnd & "files: " & sLineEnd
sMsgHeader = "Info"
End If
MsgBox (sMsgString & sFrstMsg & sRcurMsg & sFnalMsg & sOoffMsg, 0, sMsgHeader)
End If
End Sub