Hello,
the UltraGridPrintDocument should print WYSIWYG by default, that's what I thought. But printing a Grid, where all the columns are displayed correctly on screen, takes away 1 character from the values in almost every column when printed (or in the PrintPreview). Now, the values are shortened and an ellipsis is shown.
That's all I coded:ultraGridPrintDocument.Grid = this.gridReport;ultraGridPrintDocument .Print();
Is there an easy way to get WYSIWYG, instead of working around in InitializePrint or InitializePrintPreview with column.PerformAutoResize?
Thanks for your help!
Geting things working properly is always more important than speed, but the solution is taking ages!
eg The form with the grid loads in under 10 seconds without the autosizing and nearly 2 minutes with it.There are about 50 columns.
Is there anything that can be done to speed the following up?
column.PerformAutoResize(PerformAutoSizeType.AllRowsInBand, true);
or
int
columnWidth = column.CalculateAutoResizeWidth(PerformAutoSizeType.AllRowsInBand, true);
if (column.Width < columnWidth){ column.Width = columnWidth;}
It's happening in the form Load event and I've tried using BeginUpdate/EndUpdate which make no difference.
Is it just slow, or are there a load of events happening as I suspect?
First I loop through bands and columns calling PerformAutoResize.
Then I recursively go through all the childbands of every row in order to get all the SummaryValues.I build a dictionary of each column together with the widest summary found.
I then go through the dictionary and set the column widths to the max found summary width +2 where this is larger than the current columns width.
It worries me whenever I have to do anything that goes through all the rows in all the bands.It also worries me that I’m hard coding +2 for the padding.
At the stage I’m doing this there are no SummaryValueUIElement UIElements.The RowColRegionIntersectionUIElement has no Children.These don’t appear to be created until the grid is visible well after InitializeLayout.The difference between the SummaryValueUIElement Rect and RectInsideBorders would give me the padding, I think.It would also be an easier way of getting at all the summaryvalues with SummaryValueUIElement.SummaryValue.
I've gone down the route of measuring the size of the summary value.
I can measure the text size with Infragistics.Win.DrawUtility.MeasureString, but how do I get the size of the left/right margins to add to this?
jaa said:Is there a way to tell which columns have been autosized and which the user has sized?
No.
jaa said:If not can you tell what the autosize width will be without actually performing one?
Yes. There's a method on the column called CalculateAutoSizeWidth (or something like that).
Also, it doesn't appear to take summaries into account.The total of the column could easily be a character wider than the biggest individual number.Therefore maybe a more manual stategy is needed :(