<?xml version="1.0" encoding="utf-8" ?>
<?xml-stylesheet type="text/xsl" href="RSS_xslt_style.asp" version="1.0" ?>
<rss version="2.0" xmlns:WebWizForums="https://syndication.webwiz.net/rss_namespace/">
 <channel>
  <title>Codejock Developer Community : Text Overflow</title>
  <link>http://forum.codejock.com/</link>
  <description><![CDATA[This is an XML content feed of; Codejock Developer Community : Report Control : Text Overflow]]></description>
  <copyright>Copyright (c) 2006-2013 Web Wiz Forums - All Rights Reserved.</copyright>
  <pubDate>Thu, 14 May 2026 23:36:19 +0000</pubDate>
  <lastBuildDate>Wed, 22 Dec 2010 10:16:55 +0000</lastBuildDate>
  <docs>http://blogs.law.harvard.edu/tech/rss</docs>
  <generator>Web Wiz Forums 12.04</generator>
  <ttl>360</ttl>
  <WebWizForums:feedURL>forum.codejock.com/RSS_post_feed.asp?TID=17693</WebWizForums:feedURL>
  <image>
   <title><![CDATA[Codejock Developer Community]]></title>
   <url>http://forum.codejock.com/forum_images/codejock-logo.gif</url>
   <link>http://forum.codejock.com/</link>
  </image>
  <item>
   <title><![CDATA[Text Overflow :  Turns out that the ReportControl...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17693&amp;PID=61950&amp;title=text-overflow#61950</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2676">jpbro</a><br /><strong>Subject:</strong> 17693<br /><strong>Posted:</strong> 22 December 2010 at 10:16am<br /><br />Turns out that the ReportControl font was different than the Form font, which accounts for most of the difference - however, I still have to use a 5px magic number when the fonts are matched.<br><br>If I enclose the modified path in a XAML TextBlock tag, I get this down to a 3px magic number (still a magic number, but getting closer!).<br><br><br>To anyone at Codejock - is this a problem with my code, or does the GetItemRect method return values too large (not accounting for some kind of internal margin). If this is a GetItemRect issue, maybe we need a GetItemRectClient method that returns the values accounting for the internal margin?<br><br>Anyway, here's the updated code:<br><br><table width="99%"><tr><td><pre class="BBcode"><br>Option Explicit<br><br>Private Type RECT<br>&nbsp;&nbsp; Left As Long<br>&nbsp;&nbsp; Top As Long<br>&nbsp;&nbsp; Right As Long<br>&nbsp;&nbsp; Bottom As Long<br>End Type<br><br>Private Const DT_PATH_ELLIPSIS As Long = &amp;H4000<br>Private Const DT_MODIFYSTRING As Long = &amp;H10000<br>Private Const DT_CALCRECT As Long = &amp;H400<br>Private Const DT_NOPREFIX As Long = &amp;H800<br><br>Private Declare Function DrawText Lib "user32.dll" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, ByRef lpRect As RECT, ByVal wFormat As Long) As Long<br><br>Private Sub Form_Load()<br>&nbsp;&nbsp; With Me.ReportControl1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .SetCustomDraw xtpCustomBeforeDrawRow<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .EnableMarkup = True ' Enable Markup<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .PaintManager.ForceDynamicMarkupForCell = True&nbsp; ' Make Metrics.Text render markup<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Columns.Add .Columns.Count, "Test", 100, True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Columns.Add .Columns.Count, "Test", 100, True<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; With .Records.Add<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .AddItem "C:\Program Files\Program Something or other\SomeProgram.exe"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .AddItem ""<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End With<br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Populate<br>&nbsp;&nbsp; End With<br>End Sub<br><br>Private Sub ReportControl1_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)<br>&nbsp;&nbsp; Dim lt_Rect As RECT<br>&nbsp;&nbsp; Dim l_Left As Long<br>&nbsp;&nbsp; Dim l_Top As Long<br>&nbsp;&nbsp; Dim l_Text As String<br>&nbsp;&nbsp; Dim l_Null As Long<br>&nbsp;&nbsp; Dim lo_OldFont As StdFont<br>&nbsp; <br>&nbsp;&nbsp; Select Case Item.Index<br>&nbsp;&nbsp; Case 0&nbsp;&nbsp; ' First Column<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Row.GetItemRect Item, lt_Rect.Left, lt_Rect.Top, lt_Rect.Right, lt_Rect.Bottom<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lt_Rect.Right = lt_Rect.Right - 3 ' Why this magic number?? Prevents ReportControl from adding its own end ellipsis<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_Text = Item.Value<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set lo_OldFont = Me.Font<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set Me.Font = Me.ReportControl1.PaintManager.TextFont<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DrawText Me.hdc, l_Text, -1, lt_Rect, DT_PATH_ELLIPSIS + DT_MODIFYSTRING + DT_CALCRECT + DT_NOPREFIX<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Set Me.Font = lo_OldFont<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_Null = InStr(1, l_Text, vbNullChar) - 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If l_Null &gt;= 0 Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_Text = Left$(l_Text, l_Null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Metrics.Text = "&lt;TextBlock TextTrimming='None'&gt;" &amp; EncodePlainTextForXaml(l_Text) &amp; "&lt;/TextBlock&gt;"<br>&nbsp;&nbsp; End Select<br>End Sub<br><br><br>Private Function EncodePlainTextForXaml(ByVal p_PlainText As String) As String<br>&nbsp;&nbsp; ' Convert illegal characters to XAML entities<br>&nbsp;&nbsp; p_PlainText = Replace$(p_PlainText, "&amp;", "&amp;amp;")<br>&nbsp;&nbsp; p_PlainText = Replace$(p_PlainText, "&lt;", "&amp;lt;")<br>&nbsp;&nbsp; p_PlainText = Replace$(p_PlainText, "&gt;", "&amp;gt;")<br>&nbsp;&nbsp; p_PlainText = Replace$(p_PlainText, "'", "&amp;apos;")<br>&nbsp;&nbsp; p_PlainText = Replace$(p_PlainText, """", "&amp;quot;")<br>&nbsp;&nbsp; ' Normalize CRLF and CR to LF, then expand LF characters to XAML &lt;LineBreak/&gt; tags<br>&nbsp;&nbsp; p_PlainText = Replace$(p_PlainText, vbNewLine, vbLf)<br>&nbsp;&nbsp; p_PlainText = Replace$(p_PlainText, vbCr, vbLf)<br>&nbsp;&nbsp; p_PlainText = Replace$(p_PlainText, vbLf, "&lt;LineBreak/&gt;")<br>&nbsp; <br>&nbsp;&nbsp; EncodePlainTextForXaml = p_PlainText<br>End Function<br></pre></td></tr></table><br><br>Choochy - maybe you could open a support ticket at <a href="http://support.codejock.com" target="_blank">http://support.codejock.com</a> to get to the bottom of this issue?<br>]]>
   </description>
   <pubDate>Wed, 22 Dec 2010 10:16:55 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17693&amp;PID=61950&amp;title=text-overflow#61950</guid>
  </item> 
  <item>
   <title><![CDATA[Text Overflow :   Thanks guys for the replies!jpbro&amp;#039;s...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17693&amp;PID=61911&amp;title=text-overflow#61911</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2459">choochy</a><br /><strong>Subject:</strong> 17693<br /><strong>Posted:</strong> 19 December 2010 at 8:47pm<br /><br />Thanks guys for the replies!<DIV>&nbsp;</DIV><DIV>jpbro's solution is definitly what I was after. Its strange though the magic number on my system is actually bigger for me, I needed to put in 20 and even then occasionally it is still out.</DIV><DIV>&nbsp;</DIV><DIV>Anyone know why this is, or how to calculate this value properly?</DIV>]]>
   </description>
   <pubDate>Sun, 19 Dec 2010 20:47:30 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17693&amp;PID=61911&amp;title=text-overflow#61911</guid>
  </item> 
  <item>
   <title><![CDATA[Text Overflow : You could also use the DrawText...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17693&amp;PID=61893&amp;title=text-overflow#61893</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2676">jpbro</a><br /><strong>Subject:</strong> 17693<br /><strong>Posted:</strong> 17 December 2010 at 12:51pm<br /><br />You could also use the DrawText API with the DT_PATH_ELLIPSIS flag to get internal ellipsis if you don't want any wrapping.<br><br>It would be better if CJ added a PathEllipsis value for the TextTrimming attribute, then we wouldn't need the API.<br><br>Put a ReportControl (ReportControl1) on a form and try this:<br><br><table width="99%"><tr><td><pre class="BBcode"><br>Option Explicit<br><br>Private Type RECT<br>&nbsp;&nbsp; Left As Long<br>&nbsp;&nbsp; Top As Long<br>&nbsp;&nbsp; Right As Long<br>&nbsp;&nbsp; Bottom As Long<br>End Type<br><br>Private Const DT_PATH_ELLIPSIS As Long = &amp;H4000<br>Private Const DT_MODIFYSTRING As Long = &amp;H10000<br>Private Const DT_CALCRECT As Long = &amp;H400<br>Private Const DT_NOPREFIX As Long = &amp;H800<br><br>Private Declare Function DrawText Lib "user32.dll" Alias "DrawTextA" (ByVal hdc As Long, ByVal lpStr As String, ByVal nCount As Long, ByRef lpRect As RECT, ByVal wFormat As Long) As Long<br><br>Private Sub Form_Load()<br>&nbsp;&nbsp; With Me.ReportControl1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .SetCustomDraw xtpCustomBeforeDrawRow<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Columns.Add .Columns.Count, "Test", 100, True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Columns.Add .Columns.Count, "Test", 100, True<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; With .Records.Add<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .AddItem "C:\Program Files\Program Something or other\SomeProgram.exe"<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .AddItem ""<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End With<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Populate<br>&nbsp;&nbsp; End With<br>End Sub<br><br>Private Sub ReportControl1_BeforeDrawRow(ByVal Row As XtremeReportControl.IReportRow, ByVal Item As XtremeReportControl.IReportRecordItem, ByVal Metrics As XtremeReportControl.IReportRecordItemMetrics)<br>&nbsp;&nbsp; Dim lt_Rect As RECT<br>&nbsp;&nbsp; Dim l_Left As Long<br>&nbsp;&nbsp; Dim l_Top As Long<br>&nbsp;&nbsp; Dim l_Text As String<br>&nbsp;&nbsp; Dim l_Null As Long<br>&nbsp;&nbsp; <br>&nbsp;&nbsp; Select Case Item.Index<br>&nbsp;&nbsp; Case 0&nbsp;&nbsp; ' First Column<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Row.GetItemRect Item, lt_Rect.Left, lt_Rect.Top, lt_Rect.Right, lt_Rect.Bottom<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lt_Rect.Right = lt_Rect.Right - 8&nbsp;&nbsp; ' Why this magic number?? Prevents ReportControl from adding its own end ellipsis<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_Text = Item.Value<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; DrawText Me.hdc, l_Text, -1, lt_Rect, DT_PATH_ELLIPSIS + DT_MODIFYSTRING + DT_CALCRECT + DT_NOPREFIX<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_Null = InStr(1, l_Text, vbNullChar) - 1<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; If l_Null &gt;= 0 Then<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; l_Text = Left$(l_Text, l_Null)<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End If<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Metrics.Text = l_Text<br>&nbsp;&nbsp; End Select<br>End Sub<br></pre></td></tr></table><br><br>Output:<br><br><img src="uploads/2676/pathellipsis.jpg" height="308" width="549" border="0" /><br><br>Questions for CJ:<br><br>1) Why do I need to use the magic number 8 to subtract from the Right value for the cell width in order to prevent your end ellipsis from showing?<br>2) Can we get a PathEllipsis value for the TextTrimming attribute in Markup? <br><br><br>]]>
   </description>
   <pubDate>Fri, 17 Dec 2010 12:51:57 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17693&amp;PID=61893&amp;title=text-overflow#61893</guid>
  </item> 
  <item>
   <title><![CDATA[Text Overflow : Hi, I know this a problem and...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17693&amp;PID=61891&amp;title=text-overflow#61891</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=3701">Aaron</a><br /><strong>Subject:</strong> 17693<br /><strong>Posted:</strong> 17 December 2010 at 11:19am<br /><br /><P>Hi,</P><P>I know this a problem and always will be... But there is hope at least in your case <img src="http://forum.codejock.com/smileys/smiley2.gif" height="17" width="17" border="0" alt="Wink" title="Wink" /></P><DIV>&nbsp;</DIV><DIV>Add the Record items that need to be wrapped with Markup (and set wndReportControl.PaintManager.FixedRowHeight = False):</DIV><DIV>&nbsp;</DIV><DIV>With .Records.Add<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; With .AddItem("")<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; .Caption = "&lt;StackPanel Margin = '10'&gt;&lt;TextBlock Padding='30,10,0,15'&nbsp;&nbsp;&nbsp;&nbsp; TextWrapping='Wrap' FontWeight='Bold'&gt;C:\Program Files\Codejock Software\ActiveX\XtremeSuiteProActiveXv13.4.0\Help&lt;/TextBlock&gt;&lt;/StackPanel&gt;"<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; End With<BR>End With</DIV><DIV>&nbsp;</DIV><DIV>&nbsp;</DIV><DIV>Output:</DIV><DIV>&nbsp;</DIV><DIV><img src="http://forum.codejock.com/uploads/3701/MarkupWrap.bmp" height="234" width="264" border="0" /></DIV>]]>
   </description>
   <pubDate>Fri, 17 Dec 2010 11:19:31 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17693&amp;PID=61891&amp;title=text-overflow#61891</guid>
  </item> 
  <item>
   <title><![CDATA[Text Overflow :   I have setup a Report Control...]]></title>
   <link>http://forum.codejock.com/forum_posts.asp?TID=17693&amp;PID=61878&amp;title=text-overflow#61878</link>
   <description>
    <![CDATA[<strong>Author:</strong> <a href="http://forum.codejock.com/member_profile.asp?PF=2459">choochy</a><br /><strong>Subject:</strong> 17693<br /><strong>Posted:</strong> 17 December 2010 at 2:45am<br /><br />I have setup a Report Control with a number of columns. 3 of the columns contain text that is much larger then there is room for. A Fully Qualified Process Name is one of the example. <DIV>&nbsp;</DIV><DIV>Currently the data overflow is handled by the ReportControl&nbsp;displaying the&nbsp;first (left)&nbsp;part of the text and adding&nbsp;... to signify overflow. </DIV><DIV>&nbsp;</DIV><DIV>Is there a way I can control how this is done? In this case&nbsp;I want to start the colum with the ... and then have the right hand side of the text displayed instead. As the most meaniful data is at the end.</DIV><DIV>&nbsp;</DIV><DIV>So it will go from C:\Windows\Sys.... to ...System32\some.dll</DIV><DIV>&nbsp;</DIV><DIV>Thanks</DIV>]]>
   </description>
   <pubDate>Fri, 17 Dec 2010 02:45:09 +0000</pubDate>
   <guid isPermaLink="true">http://forum.codejock.com/forum_posts.asp?TID=17693&amp;PID=61878&amp;title=text-overflow#61878</guid>
  </item> 
 </channel>
</rss>