An important task for my customers is printing. I’ve seen in the knowledge base in the website that there’s a simple example on how to print but it prints only the current graph situation on screen. Usually i’d need to print from date to date, or print from the beginning of the graph page to page all in a time, without scrolling myself avery page and print many times. If it possible to do it can you add a simple example of that in the examples of the component package?
Printing is very important, we could not agree more. But printing is also very solution oriented, there must be a way to control every aspect of printing, like paging and size and integration of the pages of the Gantt into a slot on a printout filled with other data.
The developer needs to be free to break pages along the Y-Axis as well as the X-Axis.
The developer needs to be free to control Start and Stop in time (X-Axis) and control what nodes that should print (Y-Axis).
The printing functionality of GTP.NET allows for all of this since it is very flexible. The flexibility comes with the price of complexity.
To minimize the complexity we strictly print what is set to show in the Gantt. This does not mean that you cannot print from Date1 to Date2, but it means that you need to set the viewed area in the PrintPage method (Gantt.DateScaler.TimeSpanSet(Date1,Date2)), and if you change it back in the EndPrint to the original value, no one will be the wiser…
Below a sample of a print page event. Read the comment, it does a pretty good job to examplify the complexity involved…
private void pd_PrintPage(object sender, PrintPageEventArgs ev)
// In this print I choose to divide the time axel into two pages.
// Then I must call PrintPage once with SuppressGrid=false and doNotStepGridWillPrintTheSameRowsOneMoreTime=true
// and once with SuppressGrid=true and doNotStepGridWillPrintTheSameRowsOneMoreTime=false
// In the second call I change the DateScaler intervall to reflect another area in time, then I set it back
// after the print to prepare for the first page in time (x) direction