Page 1 of 1

how to print from a preview button

Posted: Thu Oct 20, 2011 3:53 pm
by miguels
hello .. I hope I can help

I need to print the contents of a control StiViewerControl already loaded with information, from a button outside the control and not the default button that brings the print ...

I need to do is give it a process of printing but if I put the code you need within the print control method Wiewer .. I printed ... the content. I do not want to reload the printed information to


I hope I is explained

how to print from a preview button

Posted: Fri Oct 21, 2011 4:24 am
by Alex K.
Hello,

Sorry, maybe we did not exactly understand your question. Could you explain your issue in more details?

As a way, you can use the following code:

Code: Select all

report.Render();
report.Print();
Thank you.

how to print from a preview button

Posted: Fri Oct 21, 2011 4:29 am
by Alex K.
Hello,

As a a way you can use the following code:

Code: Select all

    ...
    StiReport report = new StiReport();
    StiOptions.Engine.GlobalEvents.PreviewingReportInDesigner += new EventHandler(GlobalEvents_PreviewingReportInDesigner);
    ...

void GlobalEvents_PreviewingReportInDesigner(object sender, EventArgs e)
{
    ((StiDesignerControl)sender).Report.Print();
}
Thank you.