SSRS expression change text color - ssrs-2012

I have text box with expression (see image).
All text will get 'lightcoaral' color.
I would like to change '|' become black color.
Can you shoe me how to modify the expression.
Thank you.

You don't give a ton of details about the issue at hand, but to do this, you need to create a placeholder and change the markup type to "Interpret HTML tags as style". It's possible you've already done this, considering the use of HTML tags. From there the expression should be:
= "<font color = 'black' size = '1'>" & " | "
& "</font><font color = 'lightcoral' size = '1'>"
& IIF(Trim(First(Fields!ID.Value, "DataSet2")) = "", "None", First(Fields!ID.Value, "DataSet2"))
& "</font>"
It isn't clear if there is meant to be other text before the " | " but you simply need an additional <font> tag for each segment of text you'd like to color.
So based on the comments, you need another block in front of the " | " like this:
= "<font color = 'lightcoral' size = '1'>"
& IIF(Trim(First(Fields!ID.Value, "DataSet2")) = "", "None", First(Fields!ID.Value, "DataSet2"))
& "</font><font color = 'black' size = '1'>" & " | "
& "</font><font color = 'lightcoral' size = '1'>"
& IIF(Trim(First(Fields!ID.Value, "DataSet2")) = "", "None", First(Fields!ID.Value, "DataSet2"))
& "</font>"
And you'll just need to modify the field from the first statement to what you'll need before the " | ".
For reference, the above expressions show as this image in my environment(Left textbox is first expression, right is second):
Another alternative would be to set the entire textbox font color property to lightcoral and simply use the expression:
"<font color = 'black' size = '1'>" & " | " & "</font>"
& IIF(Trim(First(Fields!ID.Value, "DataSet2")) = "", "None", First(Fields!ID.Value, "DataSet2"))

Related

Outlook VBScript Signature Change Color and Font w/o Line Break

I have a very particular client who wants all employee email signatures formatted in a very specific way. The issue I am having is the client would like it to be formatted as w: where the "w:" is formatted in blue and the hyperlink in black, both Arial 9pt.
I am not able to get this to work without either adding in unwanted line breaks or without the entire signature being formatted to black.
'Website
objSelection.Font.Name = "Arial"
objSelection.Font.Size = 9
objSelection.Font.Color = RGB(27,161,226)
objSelection.Font.Bold = False
objSelection.Font.Italic = False
objSelection.TypeText strSymbol_W
objSelection.Font.Bold = False
objSelection.Font.Italic = False
Set objLink = objSelection.Hyperlinks.Add (objSelection.Range, strWebsite, , ,strWebsite)
Set objSelection = objLink()
objSelection.Font.name = "Arial"
objSelection.Font.Color = RGB(0,0,0)
objSelection.Font.Size = 9
Your code should look a little more like this:
Set objLink = objSelection.Hyperlinks.Add(objSelection.Range, strWebsite, "", "", strWebsite)
objLink.Range.Font.name = "Arial"
objLink.Range.Font.Color = RGB(0,0,0)
objLink.Range.Font.Size = 9

How to decode special character in Xamarin forms?

How to decode spacial character in xamairn forms
Inside my label text = "Sample & Text"
instead of showing original text, its showing "Sample & Text"
so how to solve this?
& is used for displaying & in XAML. If you want to display Sample & Text on code behind, there's no need to encode it to Sample & Text. You could set the value directly. i.e. here is a list view's items source:
var list = new List<string>();
for (int i=0; i<10; i++)
{
var str = "Sample & Text";
list.Add(str);
}
listView.ItemsSource = list;
It shows correctly:
However, if your original text from the server is Sample & Text and you want to display the decoded format, you can try System.Net.WebUtility.HtmlDecode():
var str = System.Net.WebUtility.HtmlDecode("Sample & Text");
Try this:
<Label Text="Sample &Text"/>
This will display "Sample & Text"

How do I put the width or height of an object in to a variable?

I am currently using VBScript in Qlikview and I ran into a problem. My code currently looks like this:
sub resize
set obj = ActiveDocument.GetSheetObject("TX05")
set fr = obj.GetFrameDef
set pos = fr.Rect
set WidthUser = ActiveDocument.Variables("vWidth")
' set OriginalWidth = pos.Width
' set OriginalHeight = pos.Height
' Ratio is 2.5
pos.Width = Cint(WidthUser.GetContent.String) * 2.5
' pos.Height = vPreferredWidth/vOriginalWidth * vOriginalHeight
pos.Height = 200 * 2.5
obj.SetFrame fr,true,dummy
msgbox("Changed Width to: " & pos.Width/2.5 & " " & Chr(13) & "Changed Height to: " & pos.Height/2.5)
End sub
vWidth is a variable where the user can input his desired width.
So what am I trying to achieve? I want the user to be able to type in his desired width of an object and then press a button called "resize". When the button is pressed, the object width should change to the desired width and the object height should also change in relation to the change in width.
For example, we start with an object that has a Width of 120 and a height of 200. The user then puts in his desired Width of 60 and then presses the button "resize". The object width should change to 60 and the object height should change to 100 (60/120*200=100). So in the end result the ratio width/height is still the same (120/200 vs 60/100).
The problem I am having is trying to capture the original width and height of my object. I tried using:
set OriginalWidth = pos.Width
set OriginalHeight = pos.Height
But that doesn't work at all. I tried all kinds of variations but nothing worked so far. What I don't understand is that when I type:
msgbox(pos.Width)
I do get a result, but when I use:
set OriginalWidth = pos.Width
msgbox(OriginalWidth)
I get nothing at all (I get thrown back into my script).
Can anyone help me figure this out? Would also love some feedback on the rest of the code, because I just started learning this.
Thanks in advance!
EDIT after help I changed my code to:
sub resize
' Ratio is 2.5
set obj = ActiveDocument.GetSheetObject("TX05")
set fr = obj.GetFrameDef
set pos = fr.Rect
set WidthUser = ActiveDocument.Variables("vWidth")
set HeightUser = ActiveDocument.Variables("vHeight")
OriginalWidth = pos.Width
OriginalHeight = pos.Height
DesiredUserWidth = Cint(WidthUser.GetContent.String)
pos.Width = DesiredUserWidth * 2.5
pos.Height = DesiredUserWidth / OriginalWidth * OriginalHeight * 2.5
obj.SetFrame fr,true,dummy
msgbox("Changed Width to: " & pos.Width/2.5 & " " & Chr(13) & "Changed Height to: " & pos.Height/2.5)
End sub
Read the docs for Set and from now on use it only when you assign an object to a variable.
set OriginalWidth = pos.Width
==>
OriginalWidth = pos.Width

2 different color text in one cell

We are putting together a new standard signature using vbs for Outlook.
Everything looks great but design would like the phone numbers to look like the attached image. The "O" for office # in Orange and then the number in blue, the "C" for cell # in Orange and then the number in blue.
I can get the entire cell to be one color, but I don't see how to do 2 colors.
The signature is in a table with the logo in one cell that has 5 rows merged and then the other side has 5 rows.
Here is some of my code:
strName = objUser.FullName
strTitle = objUser.Title
strPhone = objUser.telephoneNumber
strMobile = objUser.mobile
strOffice = "O "
strCell = "C "
objTable.Cell(3,2).Range.Font.Name = "Lato"
objTable.Cell(3,2).Range.Font.Size = "12"
objTable.Cell(3,2).Range.Text = strOffice & strPhone & " " & strCell & strMobile
Start recording a macro do it manually by editing the in the cell or the formula bar. Stop the macro and step into it to get all the colors. I stuck to the main colors on the bottom of the pallet. You'll may have to track ThemeColor, TintAndShade and ThemeFont depending on the colors you choose.
This should get you started
Public Sub AddLogo(r As Range)
Dim i As Integer
Dim ColorArray
ColorArray = Array(-16777024, -16776961, -16727809, -16711681, -11480942, -11489280, -1003520, -4165632, -10477568, -6279056)
r = "Excel Magic"
For i = 0 To UBound(ColorArray)
With r.Characters(Start:=(i + 1), Length:=1).Font
.Color = ColorArray(i)
End With
Next
End Sub
Usage:
AddLogo objTable.Cell(3,2)

Column width of a DataGrid in a Windows Mobile

I'm having a problem in editing the width of my datagridview. It doesn't changed the width. Here's my source code.
oDotNet.SqlDb.strCommand = "SELECT TOP 1 ItemCode, ItemName FROM [" & oAPP.oSQLDatabase & "]..OITM"
dgMain.DataSource = oDotNet.SqlDb.Ds.Tables(0).DefaultView
Dim oTableStyle As New DataGridTableStyle
oTableStyle.MappingName = oDotNet.SqlDb.Ds.Tables(0).DefaultView.GetType().Name
Dim oTextBoxColumn As New DataGridTextBoxColumn
oTextBoxColumn.Width = 400
oTextBoxColumn.MappingName = "ItemName"
oTextBoxColumn.HeaderText = "ItemName"
oTableStyle.GridColumnStyles.Add(oTextBoxColumn)
dgMain.TableStyles.Clear()
dgMain.TableStyles.Add(oTableStyle)
Regards
Remove below line and execute it works:
oTableStyle.MappingName = oDotNet.SqlDb.Ds.Tables(0).DefaultView.GetType().Name

Resources