I'm trying to use Documents Reports and seem to be having some basic problems (or just things that I don't understand yet.
For example. I'm trying to set the height of the report header. I've got a header with an image and then n-lines of text. The text can be variable in length and number of lines. What I'd like to be able to do is to use the various "Addxxx" methods and either have the height calculated based on the content or give me some method of getting the resulting height. This does not seem to be available or I'm missing something basic.
I've also got a grid with multiple columns. I want to set the width of the first column based on the widest text in the column cells. Again, I'd like to have the grid figure that out for me similar to what I can have the UltraGrid do for me with autoresize. Instead, I tried the following
Infragistics.Documents.Report.Text.Style boldStyle = new Infragistics.Documents.Report.Text.Style( new Infragistics.Documents.Graphics.Font("Verdana", 8, Infragistics.Documents.Graphics.FontStyle.Normal), Infragistics.Documents.Graphics.Brushes.Black);
//* Since I don't seem to be able to get to the base font from the style I did
Font textFont = new Font(normalStyle.Font.Name, normalStyle.Font.Size, FontStyle.Regular);
//Then, loop over the text and try to get the width
Int32 maxColumnWidth = 0;
Size cellSize;Size proposedSize = new Size(int.MaxValue, int.MaxValue);TextFormatFlags flags = TextFormatFlags.NoPadding | TextFormatFlags.NoPrefix; //TextFormatFlags.GlyphOverhangPadding | TextFormatFlags.Left | TextFormatFlags.ExternalLeading | TextFormatFlags.WordBreak; foreach ( String thing in _myListOfThings )
{
String newThing = thing.Replace("<br/>", System.Environment.NewLine); cellSize = TextRenderer.MeasureText(newThing, textFont, proposedSize, flags); maxColumnWidth = Math.Max(tastableColumnWidth, cellSize.Width);
}
textFont.Dispose();
gridColumn = grid.AddColumn();gridColumn.Width = new Infragistics.Documents.Report.FixedWidth((float) maxColumnWidth);
This does calculate something that looks reasonable but when I get the exported PDF result the first column is about 40% wider than what I think I calculated in the above.
In any case, is there something I'm missing here that would make Reports more usable?
Thanks
Have you tried using the AutoWidth width type for the columns?
http://help.infragistics.com/Help/NetAdvantage/NET/2007.3/CLR2.0/html/Infragistics2.Documents.v7.3~Infragistics.Documents.Report.Grid.IGridColumn~Width.html
-Tony
Tony,
Thanks for the reply. Yes, I did actually try that without getting the results I expected.
The real answer seemed to be converting my measurements to units points or inches or pixels depending.
The system does not seem to be consistent in what size units are required in various places but I continue to struggle with reports..but making slow, learn as you go, progress.
Neil
Thanks for the feedback Neil, I'll be sure to pass this on to both the product team and the docs team.