How to print the Landscape orientation in MultiColumnTreeView - From 179379

Hi.

the issue is fixed. many thanks!

would like to know if print preview can be opened in landscape mode, because right now, the print preview shows one column in one page and other 2 columns in another page. also, can the window size be changed.

additionally, the text appears to be slightly blurred in PDF from print preview. is there any reason for this?

I would also like to know if its possible to add a header to the print preview.


5 Replies

VS Vijayarasan Sivanandham Syncfusion Team August 22, 2023 03:06 PM UTC

Hi Farzin Hameed,

Find the responses to your queries below.

Queries

Responses

would like to know if print preview can be opened in landscape mode, because right now, the print preview shows one column in one page and other 2 columns in another page.

We have checked the reported scenario from our end. The print preview shows properly all columns on one page. We are unable to reproduce the reported problem from our end.

However, your requirement to print the data in Landscape in MultiColumnTreeView can be achieved by enabling the Landscape property in MultiColumnTreeView.PrintDocument.DefaultPageSettings. Refer to the below code snippet,

// Print the MultiColumnTreeView in Landscape mode.

this.multiColumnTreeView1.PrintDocument.DefaultPageSettings.Landscape = true;



also, can the window size be changed.

MultiColumnTreeView does not contain direct support to change the window size. However, your requirement to change the print window of MultiColumnTreeView can be achieved by setting the Width and Height of PrintPreviewDialog. Refer to the below code snippet,

// Create the Print Preview Dialog object and set the size.

PrintPreviewDialog dialog = new PrintPreviewDialog();

// Set the Window size by assigning the Width and Height properties of PrintPreviewDialog.

dialog.Width = 800;

dialog.Height = 700;



the text appears to be slightly blurred in PDF from print preview. is there any reason for this?

The reported problem is not an issue. It occurs due to the minimum zoom value applied at initial loading in PrintPreviewDialog based on the AutoZoom property.

However, you can overcome this by setting the Zoom property in PrintPreviewControl.PrintPreviewControl. Refer to the below code snippet,

//Avoid the text blur by assigning the Zoom property to 1.0

dialog.PrintPreviewControl.Zoom = 1.0;

I would also like to know if its possible to add a header to the print preview.

We have checked the possibility to achieve your requirement. We regret to inform you that there is no way to display the columns header when print preview in MultiColumnTreeView.


Find the sample demo in the attachment.

Regards,
Vijayarasan S

If this post is helpful, please consider Accepting it as the solution so that other members can locate it more quickly.


Attachment: Sample_8d92a782.zip



FH Farzin Hameed August 23, 2023 05:42 AM UTC

Thank you for the reply!

The above code snippet shows print preview of the print document and not the full contents of the treeview. I want to change window size of the print preview in the following :


multiColumnTreeView1.PrintPriview();


Also, is there a way to center-align just a single node?


TIA



SP Sreemon Premkumar Muthukrishnan Syncfusion Team August 24, 2023 04:55 PM UTC

Hi Farzin Hameed,


We are currently checking the feasibility of achieve your requirement. We require some time to perform this evaluation and will provide you with further details on August 28, 2023.


Regards,
Sreemon Premkumar M.



VS Vijayarasan Sivanandham Syncfusion Team August 28, 2023 06:32 PM UTC

Farzin Hameed,

Find the responses to your queries below.

Queries

Responses


The above code snippet shows print preview of the print document and not the full contents of the treeview. I want to change window size of the print preview in the following :

 

As we mentioned earlier, MultiColumnTreeView does not contain direct support to change the window size while using the PrintPreview method. Your requirement to show the full contents of the MultiColumnTreeView can be achieved by getting the image and get the print document using reflection. Refer to the below code snippet,

private void button1_Click(object sender, EventArgs e)

 {           

     // Convert the MultiColumnTreeView to Image.

     multiColumnTreeView1.ToImage();           

 

     // Create the Print Preview Dialog object and set the size.

     PrintPreviewDialog dialog = new PrintPreviewDialog();

 

     // Set the Window size by assigning the Width and Height properties of PrintPreviewDialog.

     dialog.Width = 800;

     dialog.Height = 700;

 

     // Get the PrintDocument of MultiColumnTreeView using Reflection.

     var document = (PrintDocument)this.multiColumnTreeView1.GetType().GetField("m_pdDocument", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(this.multiColumnTreeView1);

 

     // Print the MultiColumnTreeView in Landscape mode.

     document.DefaultPageSettings.Landscape = true;

 

     // Set the Document to be previewed by assigning the PrintDocument property of MultiColumnTreeView.

     dialog.Document = document;           

 

     // Show the dialog to PrintPreview.

     dialog.ShowDialog();

 }      

 

is there a way to center-align just a single node?

 

 

Your requirement to center-align in single node in MultiColumnTreeView can be achieved by setting the Alignment as Center for TreeNodeAdvSubItem. Refer to the below code snippet,

// Set the Alignment of the first SubItems.

 this.multiColumnTreeView1.Nodes[0].Nodes[0].SubItems[0].Alignment = StringAlignment.Center;

 // Set the Alignment of the Second SubItems.

 this.multiColumnTreeView1.Nodes[0].Nodes[0].SubItems[1].Alignment = StringAlignment.Center;


Note: The Expander contains a TreeNodeAdv (First Column) that does not have alignment support.


Find the modified sample in the attachment.


Attachment: Modified_Sample_9f8ab140.zip


FH Farzin Hameed August 30, 2023 01:08 PM UTC

Thanks for the kind reply!


Loader.
Up arrow icon