Is it possible to dynamically set the color of the returned values within a lookupset function in SSRS? Using the below snippet, I am attempting to include both a line break between results and color code the output on whether or not the result is designated "Active" or not.
iif(JOIN(Lookupset("Category A",Fields!curr_Category.Value,Fields!curr_Managed.Value,"Plan_Fees"), "<br />") = "Passive","<font color = 'blue'>", "<font color = 'green'>") +
JOIN(Lookupset("Category A",Fields!curr_Category.Value,Fields!curr_SecurityName.Value,"Plan_Fees"), "</font>" + "<br />")
Thanks!
Yes you can do this. First click inside the textbox and Right click > Placeholder properties > General > Markup type and select HTML - Interpret HTML tags as styles. Then add your styles in the textbox expression like this:;
="<font color = 'blue' size = '4'>" & Fields!'ThisIsaField.Value & "</font>"
or like this:
="<font color = 'blue' size = '4'>" & "hallo1" & "</font>" & " - " & "<font color = 'red' size = '2'>" & "hallo3" & "</font>"
Sure you can wrap this around your Lookupset() like you need it.
Related
I have an Excel macro that creates and sends emails. I want to set the background colour to match an inserted image. It is a dark blue shade so I will also look at changing the text to white.
Most searches show results for table background not the entire email body background. Is it possible to change the background of an Outlook email in VBA using HTML Body?
xHTMLBody = "<span LANG=EN>" _
& "<Body style = bgcolor=”#1b1c37”>" _
& "<p class=style2><span LANG=EN><font FACE=Calibri SIZE=3>"
_
& "<p>Dear " + Worksheets("SHeet2").Range("T3") + ",</p></p>
</p>" _
& "<p>The weekly results .</p></p>" _
& "<br>" _
& "<IMG align=baseline border=0 hspace=0 src=cid:myident>" +
",</p></p></p>" _
& "<br>If you have any questions feel free to give me a call
</font></Body></span>"
The code produces an email but "BGcolor" isn't changing anything.
Try the following instead:
"<Body style="bgcolor=#1b1c37">"
or
"<Body style="backgroundcolor=#1b1c37">"
Make sure that you create a well-formed HTML markup. I'd recommend testing your sample HTML markup in Word because Outlook uses it for rendering message bodies.
I have some data in a database which I am collection in a control function. I place the returned values in to a structure as below:
For I As Integer = 1 To Mygallery.Length - 1
With Mygallery(I)
Select Case True
Case Counter = 0
Line &= "<tr><td><img src=""" & .GalleryImage.ToString & """ alt=""" & .Customer_Name.ToString & """ height=""200"" width=""150""/> </td>"
Counter = 1
Case Counter = 1
Line &= "<td><img src=""" & .GalleryImage.ToString & """ alt=""" & .Customer_Name.ToString & """ height=""200"" width=""150""/> </td></tr>"
Counter = 0
Case Else
End Select
End With
Next
ViewBag.galleryLine = Line
As you can see I add this to a ViewBag.galleryLine item. In my html view page I then reference this table style="width:100%">#ViewData("Table") table
(Had to remove the html code as I could not get it to show)
Anyway the problem is it does not write it as a table but as text!
if I put the text that the viewbag returns straight in to the view it displays correctly. So it not a formatting issue!
Use the Html.Raw method, like this
#Html.Raw(ViewData("Table"))
I am running into a situation in which I am using VBA to generate HTML code that will go into an Outlook email. The HTML code has a bunch of images in it and I am storing the image path names in string variables. For Outlook to recognize the image, it needs quotes around it in the format:
<img src="filepath">
The problem is when I write the VBA code to contain the quotation marks, it doesn't realize the variable is a variable and instead inputs it as text. Here is the code I am using (this is just the snippet causing problems:
StageID = "C:\Users\xxxxx\Desktop\stage1.png"
Body = Body & "<TR><TD width=""100"" rowspan=""6"" align=""middle""><img src="""" & StageID & """" align=""middle"" width=""100"" height=""200""></td></tr>
You can use single quotes for HTML attribute values:
StageID = "C:\Users\xxxxx\Desktop\stage1.png"
Body = Body & "<TR><TD width='100' rowspan='6' align='middle'>" & _
"<img src='" & StageID & "' align='middle' width='100' " & _
" height='200'></td></tr>"
You have one too many inverted commas. try this:
body = body & "<TR><TD width=""100"" rowspan=""6"" align=""middle""><img src=""" & StageID & """ align=""middle"" width=""100"" height=""200""></td></tr>"
3 inverted commas either side of the & for the variable substitution works for me.
I have the following code written in VBA:
Dim StrBody As String
StrBody = "Text Line 1" & "<br>" & _
"Text Line 2" & _
How do I change the font to get a particular style (e.g. Arial), size, and color?
The text is used as the body of an e-mail. That's why some better looking style needs to be used. The default font is "Times New Roman".
I imagine you would have to use the font tag and its various attributes:
StrBody = "<font size=""10"" face=""Arial"" color=""red"">" & _
"Text Line 1" & "<br>" & _
"Text Line 2" & _
"</font>"
Make sure the " quotes used to surround HTML attribute values don't get interpreted as the end of the VBA string: escape them by writing "" instead, as in the example above.
color can also be specified as hexadecimal RGB codes. So color="red" could be replaced by the more general color="#FF0000".
I have a form that I want to search for anything containing what is entered into a textbox. Right now the search only picks up data that matches exactly (ie MDD), but I want it to capture anything containing the searched item automatically (ie *MDD*)
Ideally I would like a user to enter what they are searching for and get anything that contains that search.
The code I wrote (that partially works) is:
`
If Me.tbIni = "" Or IsNull(Me.tbIni) Then
stCriteria = ""
Else
If InStr(1, Me.tbIni, "LIKE ") Then
stCriteria = "CURQCDB.DT_ini '" & Me.tbIni & "'"
Else
stCriteria = "CURQCDB.DT_ini = '" & Me.tbIni & "'"
Help would be much appreciated.
Just search for *MDD* instead of MDD
Try the following instead. I also took the liberty of sanitizing the input a bit so that it properly handles double and single quotes:
If Me.tbIni = "" Or IsNull(Me.tbIni) Then
stCriteria = ""
Else
stCriteria = "CURQCDB.DT_ini LIKE ""*" & Replace(Me.tbIni, """", """""") & "*"""
End If