Hallo,
ich habe folgendes Problem:
Ich möchte PDF-Daten als XML exportieren. Das funktioniert auich soweit, sodass ich den Dateinamen manuell eingeben muss. Ich möchte aber nun, dass der Dateiname automatisch aus einem Textfeld erzeugt wird.
Dazu habe ich folgende Trusted-Funktion:
var myExportXML = app.trustedFunction(function(oDoc,cPath,cName)
{
app.beginPriv();
// Ensure path has trailing "/"
cPath = cPath.replace(/([^/])$/, "$1/");
// some debugging statements
console.println('oDoc: ' + oDoc); // object for debuggingg
console.println('cPath:' + cPath); // path for debugging
console.println('cName: ' + cName); // new file name for debugging
console.println('Full path name: ' + (cPath + cName)); // debugging
//try{
oDoc.exportXFAData({cPath: cPath + cName})
// }
//catch(e)
//{
// app.alert("Error während des Speicherns:" +e);
//}
app.endPriv();
});
Diese wird dann über folgendes Script aufgerufen:
[fontsize=2][fontsize=2]
var[/fontsize][/fontsize][fontsize=2] oDoc[/fontsize][fontsize=2][fontsize=2]=[/fontsize][/fontsize][fontsize=2]event.target
[/fontsize][fontsize=2][fontsize=2]
var[/fontsize][/fontsize][fontsize=2] cPath[/fontsize][fontsize=2][fontsize=2]=[/fontsize][/fontsize][fontsize=2]"/c/test/"
[/fontsize][fontsize=2][fontsize=2]
var[/fontsize][/fontsize][fontsize=2] cName[/fontsize][fontsize=2][fontsize=2]=[/fontsize][/fontsize][fontsize=2] Auftragsnummer.rawValue [/fontsize][fontsize=2][fontsize=2]+[/fontsize][/fontsize][fontsize=2] ".xml"
myExportXML(oDoc[/fontsize][fontsize=2][fontsize=2],[/fontsize][/fontsize][fontsize=2] cPath[/fontsize][fontsize=2][fontsize=2],[/fontsize][/fontsize][fontsize=2] cName);[/fontsize]
[fontsize=2]Dazu bekomme ich nun diese Fehlermeldung:[/fontsize]
[fontsize=2]myExportXML is not defined[/fontsize]
[fontsize=2]Hat jemand eine Ahnung, wie dieses Problem zu lösen ist?[/fontsize]
[fontsize=2]Vielen Dank im Voraus.[/fontsize]
[fontsize=2]
[/fontsize]
Dynamischer Dateiname
Dynamischer Dateiname
Hallo Dominik68,
Sie sollten bei dem Objekt "exportXFAData" mehr Parameter vorgeben. Siehe Skript:
Der Rest ist in Ordnung.
Die Meldung, dass "myExportXML" undefiniert ist kann von einer falschen oder fehlerhaften Referenzierung her rühren.
Gruß,
Walde
Sie sollten bei dem Objekt "exportXFAData" mehr Parameter vorgeben. Siehe Skript:
Code: Alles auswählen
var myExportXML = app.trustedFunction(function(oDoc,cPath,cName){
app.beginPriv();
try{
oDoc.exportXFAData({bXDP:false,cPath:cPath + cName});
}
catch(e){
app.alert("Error während des Speicherns:" + e);
}
app.endPriv();
});
Der Rest ist in Ordnung.
Die Meldung, dass "myExportXML" undefiniert ist kann von einer falschen oder fehlerhaften Referenzierung her rühren.
Gruß,
Walde
Dynamischer Dateiname
Vielen Dank. Das war der Fehler. Jetzt funktioniert alles, wie gewünscht.
Gruß Dominik68
Gruß Dominik68