we are using TeeChart pro v 2.0.2489.20960 and code is like this...
Code: Select all
Steema.TeeChart.Printer pcPrinter = new Steema.TeeChart.Printer(new Steema.TeeChart.Chart());
pcPrinter=profileTeeChart.Printer;
pcPrinter.BeginPrint();
profileTeeChart.Header.Visible = true;
String templateName="";
if(CurrentTemplateOID!=null && CurrentTemplateOID!="")
{
BusinessReference brt = new BusinessReference(context,CurrentTemplateOID);
templateName=brt["Name"].ToString();
}
else
{
templateName="New Template";
logger.Debug("Template name set to: New Template");
}
profileTeeChart.Header.Text = templateName+"-"+displayWindowID;
pcPrinter.Print(profileTeeChart.Chart,new Rectangle(20,30,770,400));
pcPrinter.Preview();
Details of exception is as follows--
************** Exception Text **************
System.ComponentModel.Win32Exception: The operation was canceled by the user
at System.Drawing.Printing.StandardPrintController.OnStartPrint(PrintDocument document, PrintEventArgs e)
at System.Drawing.Printing.PrintController.Print(PrintDocument document)
at System.Drawing.Printing.PrintDocument.Print()
at Steema.TeeChart.Editors.PrintPreview.button2_Click(Object sender, EventArgs e)
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
Can you tell what is the problem...
Thanks.