Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
1725
Using Infragistics.Documents.Report.ICondition
posted

In reading about ICondition it only talks about situations where something does not "fit on a page".

 I have a report where I'm trying to make sure that the contents of a container fits within a cell in a fixed height table. The cell allows me to add an ICondition interface item but ( as near as I can tell) the ICondition does now work ... or more likely I don't have a clue as to what I'm doing or how it should work in this case.

My expectation was that the  ICondition would use the "false" condition if the contents of the container would not fit in the space left in the fixed size cell.  If it does not work this way, is there any way within the documents engine where I can have a table, add a set of rows and then get the amount of space left in the table?  

The problem I'm trying to solve is that I have a fixed area into which I need to put some unknown amount of text. What I need to be able to do is figure out how much space is left in a table cell and scale the text font until it fits ... of is below some minimum readable limit.

Is there any way to accomplish this? 

Thanks
Neil

Parents
  • 37774
    posted

     Neil,

    I don't think that a condition will help you with this situation because it basically only gives you 2 options - one if the content fits and the other if the content doesn't fit - so there would be no guarantee that either solution would fit the size available to you.  I think that your best option here would be to measure the text yourself to see if it will fit the content of the area available to you and if it doesn't fit, resize the content accordingly.  You should be able to use the Graphics.MeasureString method; if you have access to an IGraphics object (i.e. a canvas), you could use the MeasureString as-is, otherwise when you create the .NET Graphics object, keep in mind that the Documents engine measures in Points, not Pixels.  There is a static method Infragistics.Documents.Utils.Converter.PixelsToPoints that should help you here, though you might be able to set the PageUnit to Point on the graphics object, but I'm unsure off the top of my head if this is the correct property; set whichever property has to do with units on the graphics object to Point Smile

     As for your question about figuring out how much space is left, this available while building the report because none of the objects are measured until the report is actually generated.

    -Matt 

Reply Children