I have a dashboardviewer in a windows form. I try to specify the scalemode and autofitpagecount before showing the Print Preview Window but my changes are not taken into account.
PrintingOptions.PageLayout and PrintingOptions.PaperKind both work though.
here is a code sample:
private void button1_Click(object sender, EventArgs e)
{
using (MemoryStream xmlStream = new MemoryStream())
{
XDocument.Parse("<?xml version='1.0' encoding='utf-8'?><Dashboard><Title Visible='false' Text='Dashboard' /><Items><Grid ComponentName='gridDashboardItem1' Name='Grid 1'><GridOptions /></Grid></Items><LayoutTree><LayoutGroup Orientation='Vertical'><LayoutItem DashboardItem='gridDashboardItem1' /></LayoutGroup></LayoutTree></Dashboard>").Save(xmlStream);
xmlStream.Position = 0;
dasboardview.LoadDashboard(xmlStream);
}
dasboardview.PrintingOptions.AutoFitPageCount = 2;
dasboardview.PrintingOptions.ScaleMode = DashboardPrintingScaleMode.AutoFitToPageWidth;
dasboardview.ShowRibbonPrintPreview();
}
Am i missing something?
Hi Alain,
I have prepared a small sample project based on your code and, as you can see in the attached video, the PrintingOptions settings are correctly applied in this sample. Would you please describe the problem in greater detail? Provide several images to illustrate the current and desired behavior.
Hi John and thank you for your answer.
With your sample project, i found the cause of the problem. The printoptions parameters are only taken into account when the dashboard property "dock" is set to "fill".
In your sample, if you set the "dock" parameter of the dashboardview objet to "none" and set a size to it, you"ll find that the printing parameters no longer work.
That's a problem for me because i use the dashboardviewer inside a windowsformhost in a WPF project: I tried to set the property "dock" of the instance of dashboardviewer but it does not have any effect.
Hi Alain,
I have tested this behavior without docking and received the same results in my sample. Would you please provide your sample project to illustrate this issue?
John,
i've modified your sample to achieve the same behavior as my project. Please tell me if you still have the same behavior on your end.
Thanks
Hi Alain,
Thank you for the provided sample project. It helped me reproduce the problem. I have passed this ticket to our developers for further research.