Printdefinition ausführen (Optimizer)
Raphael Strotz
Hallo zusammen,Ich weiss langsam nicht mehr weiter. Ich habe nun schon auf verschiedene Arten versucht ein eigenes Layout, bzw. eine eigene Printdefinition zu öffnen.
Letztendlich soll ein PDF erstellt werden. Aber nicht einmal ein "Preview" funktioniert.
Hier für das Layout
[CODE]LayoutOpener.OpenLayout("U0000368", new string[] {"ClgCode", "2061"});
LayoutOpener.OpenLayout("U0000368", "ClgCode", "2061");[/CODE]
Hier für die Printdefinition
[CODE]LayoutOpener.ExecutePrintDef("USR00079", LayoutHelper.LayoutOpener.OpenLayoutModes.Preview, new string[] {"ClgCode", "2061"});
LayoutOpener.ExecutePrintDef("USR00079", LayoutHelper.LayoutOpener.OpenLayoutModes.Preview, "ClgCode", "2061");[/CODE]
Weiss jemand was ich falsch mache?
Friederike Mundt
Hi Raphael,The second code line looks OK from here.
I have a few points you could check:
[*]Do you have the LayoutHelper referenced in the Extended code?
If not you need to add the LayoutHelper at the beginning.
[*]Catch any exceptions to see if there are any errors there
[*]Use the Name ID instead of the code Printdefinition. The reason is that the code of a Printdefinition changes when exporting and importing the printdefinition to another database.
[*]Make sure all parameters required for the Layoutdefinition are provided.
Here is an example that works for the standard coresuite layout for Activity:
[CODE]
try
{
// Option 1: Execute PrintDefinition (standard coresuite print definition for activity)
LayoutHelper.LayoutOpener.ExecutePrintDef("ActivityBPLetter", true, LayoutHelper.LayoutOpener.OpenLayoutModes.Preview, "ClgCode", "2");
// Option 2: Open LayoutDefinition (standard coresuite layout for activity)
LayoutHelper.LayoutOpener.OpenLayout("T0000100", "ClgCode", "2");
}
catch(System.Runtime.InteropServices.COMException comEx)
{
//SwissAddonFramework.Messaging.StatusBar.WriteError(comEx.Message);
MessageBox.Show(comEx.Message, "OK");
}
catch(Exception ex)
{
//SwissAddonFramework.Messaging.StatusBar.WriteError(ex.Message);
MessageBox.Show(ex.Message, "OK");
}
[/CODE]
Hope this helps.
Kind Regards,
Friederike
Raphael Strotz
Hello Friederike,Hmm.. I don't know what i've done wrong. Now it works perfectly
The LayoutHelper is referenzed and i used this
[CODE]
LayoutOpener.ExecutePrintDef("DAU_Activity", true, LayoutHelper.LayoutOpener.OpenLayoutModes.Preview, "ClgCode", "2061");
[/CODE]
Thank you anyway!
[color=#282828][font=helvetica, arial, sans-serif]Best Regards,[/font][/color]
[color=#282828][font=helvetica, arial, sans-serif]Raphael[/font][/color]
Raphael Strotz
NEW QUESTIONIs it possible to execute a print def this way but without opening the PDF at the end
[CODE]
LayoutOpener.ExecutePrintDef("ActivityBPLetter", true, LayoutOpener.OpenLayoutModes.PDF, "ClgCode", "2061");
[/CODE]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
NEUE FRAGE
Ist es möglich die Printdefinition auf diesem Weg auszuführen ohne das am Ende das PDF aufgeht ?
[CODE]
LayoutOpener.ExecutePrintDef("ActivityBPLetter", true, LayoutOpener.OpenLayoutModes.PDF, "ClgCode", "2061");
[/CODE]
Philipp Knecht
Hi RaphaelJa du musst einfach bei der Printdef unter "Erweitere Definition" den Haken "Öffnen..." rausnehmen.
hth
Raphael Strotz
Und ich suche und suche ... Besten Dank für deine Hilfe!
0
Please sign in to leave a comment.
Comments
0 comments