print multipage ganttchart
Good evening ,
i have a gantt chart with a lot of task and i would like to print it. I'm trying to convert it in bmp image, split it, and place the images in a multi page pdf. I'm facing 2 mai problems: The chart is only partially rendered and the part with the bars is always cutted on the right...
Please help me.
Thank You and
Best regards
Marco Del Frate
Hi Marco Del Frate,
We have reviewed your query and tested the scenario on our end using the GanttControl. However, we were unable to reproduce the issue you reported.
For your
reference, please find the sample link and demonstration video.
https://github.com/syncfusion/wpf-demos/blob/master/gantt/Views/ExportToImage.xaml
Could you kindly verify whether the behavior you're experiencing is consistent with the sample provided? If the issue persists, to assist you further, please provide the following details:
The number of tasks currently used in your project.
The version of the GanttControl package you are using.
Whether your project is targeting .NET Core or .NET Framework.
We look
forward to your response to help resolve this issue efficiently.
Regards,
Tamilarasan.
Attachment: WPF_Gantt_demo_(2)_9e3e038d.zip
Good evening,
thank You for Your support.
I'm using Syncfusion.Gant.wof version 27.2462.5.0 on a Net Framework 4.8.1 project build with visual studio 2019.
I try to explain better my situation.
When i open my application, the gant contol load a lot of tak. About half of them is out of the visualizition.
1) If i ask to export an image i Obatin what You can see in image 1 (half of the gant grid rows not rendered).
2) If then i scroll to the bottom and ask to export the picture i obatin image 2 (all of the gant grid row are rendered but only the bottom half of the gant chart is rendered and morover is shifted to the top of the picture.
3) if now i scroll back to the top and ask to export the picture i obtain the image 3, the correct one
Please let me know if it's clear.
Thank You
Best regards
Attachment: gantt_847e6d9c.zip
Good morning,
could You please send me an answer?
I need to know ho to print the gantt diagram....
thank You
Best regards
Good morning,
could You please send me an answer?
I need to know ho to print the gantt diagram....
thank You
Best regards
Hi,
In WPF SfTreeGrid, rows and columns are created dynamically based on the visible area due to UI virtualization, so only the visible portion is rendered at any time to optimize performance.
As a result, when you attempt to export the grid view as a bitmap image without scrolling, only the visible portion is captured. When you scroll vertically and horizontally, additional rows and columns are brought into view and rendered, which is why the full grid appears after scrolling.
This is behavior by design. To ensure the entire grid is rendered before exporting, please scroll through the grid both vertically and horizontally to update the view. Once all parts of the grid have been brought into view, the export will capture the full content as expected.
We appreciate your understanding and cooperation.
Regards,
Priyadharshni M
Good morning,
and thank You for Your support. So , if i'm not wrong, You are telling me that for printing the whole diagram i have to scroll it before? to be honest, and with all respect, i would expect something more from syncfusion .
In my opinion this is something really close to a bug, something to fix... i hope You can understand.
Anyway, thank you again
Best regards
Hi marco del frate,
We
apologize for any inconvenience caused. We're addressing this issue with high
priority and will update you with further details on or before July 10, 2025,
in two business days. We appreciate your patience in the meantime.
Regards,
Tamilarasan G
Hi marco del frate,
We have reviewed your query. The TreeGrid of the Gantt control does not support this requirement directly. However, you can achieve this requirement as demonstrated in the following code snippet.
|
private void export_Click(object sender, RoutedEventArgs e) { // First render to trigger layout and data loading. This image is discarded; it just forces layout and data load. RenderToBitmap(true, gantt); // Delay and render again to capture fully loaded content Task.Delay(500).ContinueWith(Task => this.Dispatcher.Invoke(() => RenderToBitmap(false, gantt))); }
private void RenderToBitmap(bool discard, GanttControl _gantt) { _gantt.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity)); _gantt.Arrange(new Rect(new Size(_gantt.DesiredSize.Width, _gantt.DesiredSize.Height)));
var bmp = new RenderTargetBitmap( (int)_gantt.DesiredSize.Width, (int)_gantt.DesiredSize.Height, 96, 96, PixelFormats.Default);
bmp.Render(_gantt);
if (discard) return;
var cropped = new CroppedBitmap(bmp, new Int32Rect(0, 0, (int)_gantt.ActualWidth, (int)_gantt.ActualHeight));
var encoder = new PngBitmapEncoder(); encoder.Frames.Add(BitmapFrame.Create(cropped));
var dialog = new SaveFileDialog { FileName = "GanttImage", DefaultExt = "png", Filter = "PNG Files (*.png)|*.png|JPEG Files (*.jpg)|*.jpg|Bitmap Files (*.bmp)|*.bmp|All files (*.*)|*.*", FilterIndex = 1 };
if (dialog.ShowDialog() == true) { using var stream = dialog.OpenFile(); encoder.Save(stream); } } |
We have prepared an example sample and attached it below for your reference.
Please check the attached sample and let us know whether this meets your
requirement.
If you have
any further questions or require assistance with any other aspect, please do
not hesitate to let us know. We are here to help.
Regards,
Tamilarasan.
Attachment: WPFGanttSample_a43f7d16.zip
- 8 Replies
- 3 Participants
-
MD marco del frate
- Jun 25, 2025 03:58 PM UTC
- Jul 10, 2025 06:12 PM UTC