This is a migrated thread and some comments may be shown as answers.

Printing a RadCalendar

5 Answers 144 Views
Calendar, DateTimePicker, TimePicker and Clock
This is a migrated thread and some comments may be shown as answers.
Taylor
Top achievements
Rank 1
Taylor asked on 06 Jul 2010, 08:53 PM
What would be the best way to print a RadCalendar?  Ideally, I could throw a read-only version of the calendar I created on a report.

The function of my current sub-project is to print out an on-call schedule each month (to be passed around to various departments, etc.).  The entry form allows the user to double click a day in the calendar and add an assignment ... and that form looks good.  Now I go to print it, and I can't find anything on RadCalendar that allows for printing or easy export to PDF/DOC/image, and I go to Reporting and there is nothing that is easily time-based.

I could create a report kludge of generic textboxes for each possible permutation of the calendar, then do the computations to figure out which box goes in which, then fill it out, but ... geez.  Surely there is a built-in way to do this that I'm missing.

Thoughts?

5 Answers, 1 is accepted

Sort by
0
Accepted
Martin Vasilev
Telerik team
answered on 10 Jul 2010, 08:51 AM
Hi Brandon Beam,

Thank you for the question.

RadCalendar does not support printing out of the box. However, you can implement this on your own by using the DrawToBitmap method. Please consider the following code snippet:
private Bitmap _bitmap;
private void printDocument1_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
    if (_bitmap != null)
    {
        e.Graphics.DrawImage(_bitmap, new Point(0));
    }
}
private void radButton1_Click(object sender, EventArgs e)
{
    SetBitmapForPrint();
    this.printPreviewDialog1.Document = this.printDocument1;
    this.printPreviewDialog1.Show();
}
private void SetBitmapForPrint()
{
    _bitmap = new Bitmap(this.radCalendar1.Size.Width, this.radCalendar1.Size.Height);
    this.radCalendar1.DrawToBitmap(_bitmap, new Rectangle(new Point(0), this.radCalendar1.Size));
}

Let me know if you have any other questions.

Greetings,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Taylor
Top achievements
Rank 1
answered on 10 Aug 2010, 06:16 PM
This worked.  Thanks!

Btw, it seems like a possibly cleaner solution would be to have an export feature on the calendar into something that would retain the look and feel but would be editable.  The obvious candidate for that would be html.  That way, it could be embedded in other things, yet still be editable via text parsing.

That level was not needed for my project, though.  Your solution, with minor tweaking, worked perfectly.

Thanks again!
0
Martin Vasilev
Telerik team
answered on 13 Aug 2010, 03:43 PM
Hello Brandon Beam,

Thank you for getting back to me.

Currently, we do not have plans to include export capabilities for the RadCalendar control. Still, I have to admit that the described feature looks interesting. In case we have requests for the same functionality from other customers, we will consider including it in a future release. 

Do not hesitate to contact us again if you have any other questions.

Regards,
Martin Vasilev
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
0
Brian
Top achievements
Rank 1
answered on 16 Apr 2012, 02:22 PM
I am using the RadScheduler, instead of the calendar. I see that the scheduler has the same DrawToBitmap() method when it is used in a WinForm. I would like to know if there is a similar method for the ASP.NET Ajax scheduler control.

The RowHeight property of the scheduler defaults to 25px. I am setting my RowHeight to 50px, and the 50px height to rendered fine when I view my web page that has the scheduler control. On the same web page, however, I have included the ability to export the scheduler to a PDF file. When exported, the RowHeight is lost, and in the PDF file, the RowHeight appears to be back to its default of 25px. According to Telerik, this is by design, and the export to PDF process is not intended to retain the row height, so there is nothing that I can do to resolve the issue when exporting to PDF. So I am curious as to whether I can work-around the PDF limitation by using DrawToBitmap(), but I cannot find DrawToBitmap equivalent for the scheduler Ajax control.

Any suggestions?

Thanks,
Steven
0
Peter
Telerik team
answered on 17 Apr 2012, 02:45 PM
Hello Steven,

I understand your concern and reasoning, but unfortunately, I don't know of a way to workaround this limitation of RadScheduler.

Kind regards,
Peter
the Telerik team
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to their blog feed now.
Tags
Calendar, DateTimePicker, TimePicker and Clock
Asked by
Taylor
Top achievements
Rank 1
Answers by
Martin Vasilev
Telerik team
Taylor
Top achievements
Rank 1
Brian
Top achievements
Rank 1
Peter
Telerik team
Share this question
or