Friday, October 12, 2012

Data grid is not properly printing

Data grid is not properly printing

Hi Experts,

Thanks for your support.

I am facing a problem while try to print the data grid.

It is printing only the record am able to see. and not printing the records below the scrolling part.

I have written the code like this :

#region PrintDoc
private void btnPrintDoc_Click(object sender, RoutedEventArgs e)
{
PrintDocument doc = new PrintDocument();
doc.BeginPrint += new EventHandler<BeginPrintEventArgs>(doc_StartPrint);
doc.PrintPage += new EventHandler<PrintPageEventArgs>(doc_PrintPage);
doc.Print("Sample Print");
}
void doc_PrintPage(object sender, PrintPageEventArgs e)
{
e.PageVisual =dataGrid1;
// Specify whether to call again for another page
e.HasMorePages = false;
}
void doc_StartPrint(object sender, BeginPrintEventArgs e)
{
// NOOP
}

No comments:

Post a Comment

Send us your comment related to the topic mentioned on the blog