Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Printing problems

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Andrew Rowley



Joined: 24 Dec 2005
Posts: 63

PostPosted: Thu Jul 19, 2007 5:15 am    Post subject: Printing problems Reply with quote

I am implementing printing for my application which uses Virtual Trees (version 2.7.0) and have run into a couple of problems.

1) If I use the same VirtualTreePrintDocument to print different trees (changing the Tree property) it doesn't work properly. It seems to retain various information from the previous tree. I was trying to use the same printdocument to retain any change that the user might make to the print settings.

2) Printing an empty tree seems to be different to displaying an empty tree.
The tree has an ArrayList as the root row, and ShowRootRow set to false.
I have a GetCellData event to selectively hide information in some rows.
When printing, if the ArrayList has no data GetCellData is called for the root row, and GetCellBinding for the row returns null. If the ArrayList contains data, GetCellData is not called for the root row.
Also, if the ArrayList is empty, 2 pages are printed with identical headers and footers, except for the page number. If there is data, only a single page is printed.

The problems occur for both print and print preview.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Jul 19, 2007 10:16 pm    Post subject: Reply with quote

Quote:
1) If I use the same VirtualTreePrintDocument to print different trees (changing the Tree property) it doesn't work properly. It seems to retain various information from the previous tree. I was trying to use the same printdocument to retain any change that the user might make to the print settings.


VirtualTreePrintDocument wasn't designed to be used for more than a single print job. If you want to preserve the any settings (eg columns printed) then you will need to copy them to a new PrintDocument each time you print.

Quote:
2) Printing an empty tree seems to be different to displaying an empty tree.
The tree has an ArrayList as the root row, and ShowRootRow set to false.
I have a GetCellData event to selectively hide information in some rows.
When printing, if the ArrayList has no data GetCellData is called for the root row, and GetCellBinding for the row returns null. If the ArrayList contains data, GetCellData is not called for the root row.
Also, if the ArrayList is empty, 2 pages are printed with identical headers and footers, except for the page number. If there is data, only a single page is printed.


If you could put together a simple sample project that illustrates the problem and email it to us (support@infralution.com) that would help us to take a look at the problem.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Andrew Rowley



Joined: 24 Dec 2005
Posts: 63

PostPosted: Fri Jul 20, 2007 2:23 am    Post subject: Reply with quote

According to the .NET documentation, a PrintDocument is reusable. I have seen recommendations to reuse the PrintDocument each time you print, to maintain any settings the user may have changed.

Trying to save the settings is a bit difficult as it seems to be a hall of mirrors - PrintDocument.DefaultPagesettings.PrinterSettings, PrintDocument.PrinterSettings.DefaultPageSettings etc. - hence the recommendation to reuse the PrintDocument.

It is a bit of a limitation if the VirtualTreePrintDocument doesn't support it. Even if you could just save the base PrintDocument and use it to construct a new VirtualTreePrintDocument it would be helpful.

I have created a project that demonstrates the double page problem and sent it to you.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Fri Jul 20, 2007 7:38 am    Post subject: Reply with quote

We'll have a look at the sample project and get back to you sometime next week.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sun Jul 22, 2007 11:55 pm    Post subject: Reply with quote

Thanks for the sample project - it helped to track down the issues.

There is indeed a bug when ShowRootRows is false and the tree being printed is empty that causes two pages to be printed (the second with the root row displayed). We will fix this with a release in the next day or two.

We also took a look at the issue of reusing VirtualTreePrintDocument for multiple prints. This seems to be OK as long as you are printing the same tree object. If you print a different tree object then the VirtualTreePrintDocument retains the columns from the previous tree. You can work around this by setting the VirtualTreePrintDocument.Columns = null when you set the Tree property. This forces the print document to get the visible columns from the tree again. We will also change this in the next release so that changing the tree object does this automatically.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Wed Jul 25, 2007 4:12 am    Post subject: Reply with quote

We have now released versions 2.7.1 and 3.5.1 of Virtual Tree which fixes these issues.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
Andrew Rowley



Joined: 24 Dec 2005
Posts: 63

PostPosted: Wed Jul 25, 2007 7:40 am    Post subject: Reply with quote

Thanks.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group