Hello Sir,
In SfDataGrid PrintPreview Window,the default page orientation is portrait.
I would like to change it from code behind.Means Once when the preview window opened then i selected orientation as landscape and i closed it.Again i opened preview window,but the orientation changed to portrait.How can i make it as landscape.
Thanks & Regards
Venkat.
Hi Venkat,
Thank you for contacting Syncfusion Support.
We have analyzed your query, by default the SfDataGrid print preview is set as portrait. You can also modify the print preview page orientation in code behind, please find the following code example.
Code Example [C#]:
dataGrid.PrintSettings.PrintPageOrientation = PrintOrientation.Landscape; |
You can download the sample from the following location:
http://www.syncfusion.com/downloads/support/forum/120718/ze/PrintingDemo1520448467
Please let us know if you have any query.
Regards,
Elangovan S
Hi Venkat,
We have analyzed your query, it is not possible to set the PrintPageOrientation property value directly from the PrintManagerBase. We need to override the InitializeProperties method from the GridPrintManager and from that only you can set the PrintPageOrientation with in that. Please refer the following code example.
internal class CustomPrintManager : GridPrintManager { public CustomPrintManager(SfDataGrid grid) : base(grid) { }
protected override void InitializeProperties() { base.InitializeProperties(); this.PrintPageOrientation = PrintOrientation.Landscape; } } |
You can also download the sample from the following location:
http://www.syncfusion.com/downloads/support/forum/120718/ze/SfDataGrid1524788208
Note: In the 13.2 version only we have introduced the sfdataGrid.PrintSettings.PrintPageOrientation property, so could you please update your version you have using. It will help us to analyze more on this.
Please let us know if you have any query.
Regards,
Elangovan S
Hi Venkat,
We have analyzed your query, it is not possible to set the PrintPageOrientation property value directly from the PrintManagerBase. We need to override the InitializeProperties method from the GridPrintManager and from that only you can set the PrintPageOrientation with in that. Please refer the following code example.
internal class CustomPrintManager : GridPrintManager
{
public CustomPrintManager(SfDataGrid grid)
: base(grid)
{
}
protected override void InitializeProperties()
{
base.InitializeProperties();
this.PrintPageOrientation = PrintOrientation.Landscape;
}
}
You can also download the sample from the following location:
http://www.syncfusion.com/downloads/support/forum/120718/ze/SfDataGrid1524788208
Note: In the 13.2 version only we have introduced the sfdataGrid.PrintSettings.PrintPageOrientation property, so could you please update your version you have using. It will help us to analyze more on this.
Please let us know if you have any query.
Regards,
Elangovan S
Hi,
How can i get SfDataGrid that can be converted into PrintDocument.So that i can assign that printdocument to printpreview control.
Thanks & Regards,
Venkat
Hi Venkat,
We have analyzed your query, as per your requirement you can refer our Custom Printing sample which is available in our Dashboard samples or you can download the sample from the following location.
Sample Link:
http://www.syncfusion.com/downloads/support/forum/120718/ze/CustomPrintingDemo-2017024061
Could you update the version detail which you are using, it will help us to give appropriate solution for your query.
Regards,
Elangovan S
<Style TargetType="syncfusion:PrintPageControl"> <Setter Property="Background" Value="White" /> <Setter Property="BorderBrush" Value="Gray" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="syncfusion:PrintPageControl"> <Viewbox x:Name="PART_Viewbox"> <Border Width="{Binding PrintPageWidth}" Height="{Binding PrintPageHeight}" Background="{TemplateBinding Background}" BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" SnapsToDevicePixels="True"> <Border Margin="30" BorderThickness="4" BorderBrush="Blue" > <Border Margin="{Binding PrintPageMargin}"> <Grid > <Grid.RowDefinitions> <RowDefinition Height="Auto" /> <RowDefinition Height="*" /> <RowDefinition Height="Auto" /> </Grid.RowDefinitions> <ContentControl x:Name="Part_PageHeader" Height="{Binding PrintPageHeaderHeight}" ContentTemplate="{Binding PrintPageHeaderTemplate}" /> <Border x:Name="PartScalingBorder" Grid.Row="1"> <ContentPresenter x:Name="Part_Panel" /> </Border> <ContentControl x:Name="Part_PageFooter" Grid.Row="2" Height="{Binding PrintPageFooterHeight}" ContentTemplate="{Binding PrintPageFooterTemplate}" /> </Grid> </Border> </Border> </Border> </Viewbox> </ControlTemplate> </Setter.Value> </Setter> |