سؤال

Is there a cxGrid and a ReportBuilder report, linked to the same DataSource. When I am printing the report, it show error: "canvas does not allow drawing".

This is my code to solve.

  Screen.Cursor := crHourGlass;
  cxGridModeloDBTableView1.DataController.DataSource := nil;
  try
    pprReportBuilder.Print;
  finally
    cxGridModeloDBTableView1.DataController.DataSource := dsModeloView;
    Screen.Cursor := crDefault;
  end;

Anyone can help me to solve this problem by another way? Thanks!

هل كانت مفيدة؟

المحلول

My guess is that ReportBuilder is navigating the dataset to create the report, but the cxGrid does not expect that.

Instead of decoupling the datasource, try using cxGrid.BeginUpdate and cxGrid.EndUpdatebefore and after pprReportBuilder.Print like this:

  Screen.Cursor := crHourGlass;
  cxGridModeloDBTableView1.BeginUpdate;
  try
    pprReportBuilder.Print;
  finally
    cxGridModeloDBTableView1.EndUpdate;
    Screen.Cursor := crDefault;
  end;

HTH

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top