Format (make bold or italics) a portion of a Textbox or Formula object in Crystal Reports

前端 未结 3 357
我寻月下人不归
我寻月下人不归 2021-01-18 08:50

I am trying to format (bold or italics) only a portion of a textbox or Formula object (IFieldObject) in Crystal Reports for Visual Studio 2008.

I know how to make th

相关标签:
3条回答
  • 2021-01-18 08:58

    I don't know, if it is doable.

    You could create a separate formula field for the value that you want to make bold & insert the formula field between other formula field, which will make it look like single sentence.

    0 讨论(0)
  • 2021-01-18 09:13

    Create a formula for the date part, then embed it into a text box, then you can format any way you like

    0 讨论(0)
  • 2021-01-18 09:20

    You can do this by inserting HTML markup in the field (using a formula) and then displaying the new formula as a HTML field.

    e.g. Here's a basic Syntax formula that takes a field and adds the bold tag around the text before the colon.

    dim sTmp as string 
    dim sLeft as string 
    dim sRight as string 
    dim sAll as string 
    
    sTmp = {yourtable.yourfield}
    
    sLeft = (split(sTmp,":"))(1)
    sRight = (split(sTmp,":"))(2)
    
    sAll = "<b>"+sLeft+":</b>"+sRight
    formula = sAll
    

    If you place this new formula into the report and then ...

    • Right Click the field and choose "Format Field"
    • Change Text Interpretation to HTML Text
    • Click 'OK'

    There are Gotchas here. The original text is not HTML encoded, and I'm sure my example code does a simple one-line thing in about ten lines. Also, if your field has no colons in it, you'll force an error. However, it should give you the right idea.

    0 讨论(0)
提交回复
热议问题