Report Design
 Crystal Reports Forum : Crystal Reports 9 through 2022 : Report Design
Message Icon Topic: Dynamic underlining of text Post Reply Post New Topic
Author Message
Ancient1
Newbie
Newbie


Joined: 22 Sep 2011
Location: United States
Online Status: Offline
Posts: 2
Quote Ancient1 Replybullet Topic: Dynamic underlining of text
    Posted: 22 Sep 2011 at 3:06am
Does anyone know of a way to dynamically underline text during report execution??  I have a database field that contains a text string where I need to underline some of the text when a specific string occurs in the text string.  I found constants for color, font and so on but nothing to start/stop underlining.  Anyone got a clever trick??
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 22 Sep 2011 at 3:11am
in CR XI on the format object/Font tab there is a button for setting the underline dynamically...but it will affect the entire field, not just a part.
 
unfortunately, while you can type into a textbox and bold or underline a portion of the text, when done dynamically it is all or nothing.
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Sep 2011 at 4:02am
i have split a string into multiple parts using formulas and then dropped the formulas into a text field to recreate the original text. Each formula (string part) can then be conditionally formatted within the text box. This only works if you can logically split your field consitently.


Edited by DBlank - 22 Sep 2011 at 4:03am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 22 Sep 2011 at 5:03am
never thought of that, what a nice solution
IP IP Logged
Ancient1
Newbie
Newbie


Joined: 22 Sep 2011
Location: United States
Online Status: Offline
Posts: 2
Quote Ancient1 Replybullet Posted: 22 Sep 2011 at 5:33am
Appreciate the reply.  Unfortunately the text string is a series of values separated by commas and I need to underline one of the values if it occurs in the string.  The location within the string is not consistent.  I guess I was looking for a solution that would act like underlining a portion of text in a Word document (one word, a phrase).  Thanks....
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Sep 2011 at 5:55am
you can do it based on phrase(s).
what is some sample data and what do you want it to do?


Edited by DBlank - 22 Sep 2011 at 5:56am
IP IP Logged
lockwelle
Moderator
Moderator


Joined: 21 Dec 2007
Online Status: Offline
Posts: 4372
Quote lockwelle Replybullet Posted: 22 Sep 2011 at 6:35am
DBlank is correct (it's his solution afterall)
but you could easily have 1 formula like:
shared stringvar sLeft;
shared stringvar sMid;
shared stringvar sRight;
local numbervar i = instr({table.field}, "text desired");
local numbervar ii;
 
if i= 0 then( //not found
  sLeft := {table.field};
  sMid := "";
 sRight := "";
)
else(
  sLeft := LEFT({table.field}, i -1);
  ii = INSTR(i+1, {table.field}, ',");
  if ii = 0 then ii := LEN({table.field}) + 1;
  sMid := MID({table.field}, i, ii - i);
  sRight := MID({table.field}, ii);
)
 
"" //hides the output
 
then you would need 3 access formulas to print each of the shared variables in the textbox with the one accessing sMid to be underlined.
 
I did get this correct DBlank, didn't I? Or do you have another method.
 
If there are multiple sections of the code that will be underlined, well that would make for a much more complex formula.  In addition, if you want to back up to the comma prior to the selected text, you would need call to instrrev. 
 
I am pretty sure that I covered a basic scenario
 
HTH
IP IP Logged
DBlank
Moderator
Moderator


Joined: 19 Dec 2008
Online Status: Offline
Posts: 9053
Quote DBlank Replybullet Posted: 22 Sep 2011 at 7:05am
the premise is the same but as you know I ususally don't use the shared variables Embarrassed
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

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



This page was generated in 0.014 seconds.