Breakline not working SSRS formula or calculated fields? - reporting-services

picture probleme breakline
, I have a problem with my breakline not working properly in my either caculated fields or my expression.
I would like to split by created date and title etc...
do you know why it is not working ?
= "<b>"+ "Created on: " + "</b>" & CDate(Fields!ticket_ticketSolutions_date_create.Value).ToString("dd/MM/yy HH:mm")
& Environment.NewLine & Environment.NewLine &
"<b>" + "Approval date: " + "</b>" & iif(IsNothing(Fields!date_approval.value),"Not Approved",CDate( Fields!date_approval.Value).ToString("dd/MM/yy HH:mm"))
& Environment.NewLine &
Environment.NewLine &
"<b>" + "Solutions: " +"</b>" & Fields!ticket_ticketSolutions_content_plainText.Value
=Join( LookupSet(Fields!ticket_tickets_sourceId.value, Fields!itemId.value, Fields!start_end_solution_data.value, "Ticket_ticket_ticket_Solutions"), vbcrlf)
calculated fields ,
expression

It looks like you are using HTML tags in your text box. When using HTML, line breaks do not work.
Replace the NewLine with the HTML break tag <br>.
= "<b>"+ "Created on: " + "</b>" & CDate(Fields!ticket_ticketSolutions_date_create.Value).ToString("dd/MM/yy HH:mm") &
"<br><br>" & "<b>" + "Approval date: " + "</b>" &
IIF(IsNothing(Fields!date_approval.value), "Not Approved", CDate( Fields!date_approval.Value).ToString("dd/MM/yy HH:mm")) &
"<br>" & "<br>" & "<b>" + "Solutions: " +"</b>" & Fields!ticket_ticketSolutions_content_plainText.Value

Related

Create an email body in HTML that includes information from an object

I have a VBA object, aPosition.
I am trying to display information aPosition.something in an email.
My code gives me a syntax error.
strBody = "<HTML>" strBody & "<BR> & <p style='font-family:Trebuchet MS,sans-serif;font-size:22'>Equity position in sell: " & aPosition.SEC_NAME & " (" & aPosition.ISIN & ")" & " now in "& aPosition._RANKING" </p> & _
" Target Price: " & aPosition.TARGET_PRICE & "<BR>" & _
"<b><span style=""color:#C00000"">We have downgraded</span style=""color:#C00000""></b>" & aPosition.SEC_NAME & "<BR>" & " <U>Clients Impacted:</U><BR>"
You have a few problems when building your string.
First of all, you can use single quotes in your styles to eliminate the possible double-double quotes confusion.
Secondly, you seem to have strBody mixed in there twice for some reason.
Also, whatever aPosition is, you cannot have a property that starts with an underscore (aPosition._Ranking not valid), so I removed just that underscore. (so double check that part)
Try it like this:
strBody = "<HTML>" & strBody & "<BR><p style='font-family:Trebuchet MS,sans-serif;font-size:22'>Equity position in sell: " & aPosition.SEC_NAME & " (" & aPosition.ISIN & ") now in " & aPosition.RANKING & "</p>" & _
" Target Price: " & aPosition.TARGET_PRICE & "<BR>" & _
"<b><span style='color:#C00000'>We have downgraded</span style='color:#C00000'></b>" & aPosition.SEC_NAME & "<BR><U>Clients Impacted:</U><BR>"
The rule of thumb is to make sure you set a well-formed HTML markup to the HTMLBody property, for example, I see the following:
strBody = "<HTML>" strBody & "<BR>
If you want to modify the existing email body you need to paste your HTML pieces after the <body> tag and before the closing </body> tag.

Add spaces to a string to be used in .HTMLBody

I've tried several ways including making another string that acts as a space, and also "    ".
StrBody2 = "<b>Downtime particulars</b>" & "<br>" & _
"Short description: " & space(10) & _
Range("External_Start_Description").Text & "<br>" & "<br>"
I want a space between "Short description" and Range("External_Start_Description").Text.
I expect this has to do with using the range function in the string.
Context: this string is later used in an email with other strings:
.HTMLBody = "<p><font color=""#112369"" face=""arial"" size=""10px"">" & StrBody & StrBody2 & RangetoHTML(rng) & StrBody3
HTML collapses runs of multiple spaces to a single space - you need to use the non-breaking space entity if you want a run of spaces.
Replace(space(10), " ", " ")
All you need to do is put quotes with a space in your concatenation like below:
StrBody2 = "<b>Downtime particulars</b>" & "<br>" & _
"Short description: " & " " & Range("External_Start_Description").Text & "<br>" & "<br>"

Email VBA and HTML

I would like to send a complex Email using VBA and HTLM, but I cant achieve this.
I am used to sending simple Email, with some links and some variables, but what I need to do here is more complex.
I need to send an Email that looks like the one in this tutorial, but cant manage to deal with the HTML and HMTLbody.
https://webdesign.tutsplus.com/articles/build-an-html-email-template-from-scratch--webdesign-12770
I've been researching, but cant find a way to properly code it.
Usually, my code looks something like this :
.HTMLBody = "Bonjour, les résultas d'essais sur :" & "<br>" & "<br>" & "<b>" & "Produit : " & "</b>" & produit & "<br>" & "<b>" & "Projet : " & "</b>" & codeproj & "<br>" & "<b>" & "Formule : " & "</b>" & formule & "<br>" & "<br>" & "sont disponibles !" & "<br>" & "Ceux-ci se trouvent dans le répertoire suivant : " & "<a href=""" & Chemin & lien & """>Lien</a > " & "<br>" & "<br>" & "Merci."
What I need is just some help to get started and the rest should be fine.
Thank you very much!

Structuring HTML so text displays in one paragraph

I'm working on a VBA code in Excel to get input from reports and send emails.
I'm trying to avoid line breaks in my email body.
With olMail
.To = rep
.Subject = title & " - " & EndTitle
'.Recipients.Add rep
.Attachments.Add filePath & "\" & title & " - " & EndTitle & ".pdf"
.htmlBody = "<BODY style=font-size:12pt;font-family:Arial><b><u>Here is an email</u></b></BODY>" & "<BODY style=font-size:12pt;font-family:Arial><b><u>Here is an email</u></b></BODY>" _
& "<br>" & "<b>HK</b>" & "<b>" & amt & "</b>" _
& "<br>" & "Value date" & "<b>" & Trans & "</b>" & "<br>" &
initial
.Display
'.Send
End With
My email looked like this
Here is the email
Here is the email
What I want the email body to look like
Here is the email Here is the email
(on the same line)
Use this instead:
.htmlBody = "<BODY style=font-size:12pt;font-family:Arial><b><u>Here is an emailHere is an email</u></b>" _
& "<br>" & "<b>HK" & amt & "</b>" _
& "<br>" & "Value date" & "<b>" & Trans & "</b>" & "<br>" & initial & "</BODY>"
Or this, depending on which line breaks you want gone:
.htmlBody = "<BODY style=font-size:12pt;font-family:Arial><b><u>Here is an emailHere is an email</u></b>" _
& "<b>HK" & amt & "</b>" _
& "Value date" & "<b>" & Trans & "</b>" & initial & "</BODY>"
See how I encapsulated all the HTML between the opening and closing BODY tags?

Apply Bold to Cell Value inside the text string of a HTMLbody

I am having trouble with applying Bold on a part of a sentence for an automatically generated email.
In my VBA script:
Public strBody As String
.HtmlBody = strBody
Dim FormulaCell As Range
Dim FormulaRange As Range
For Each FormulaCell In FormulaRange.Cells
With FormulaCell
I am able to Bold a whole sentence using "< b >" & "**Text Here**" & "< /b >" &
But it seems impossible to apply the same logic to a more complex sentence, or a referenced value.
strBody = "Hello, " & vbNewLine & vbNewLine & _
"Your task : " & Cells(FormulaCell.Row, "B").Value & " with the mention: " & Cells(FormulaCell.Row, "C").Value & " is nearing its Due Date: "
What I would like to Bold in the above sentence is the value of the FormulaCells.
strBody = "Hello, " & vbNewLine & vbNewLine & _
"Your task : " & **Cells(FormulaCell.Row, "B").Value** & " with the mention: " & **Cells(FormulaCell.Row, "C")**.Value & " is nearing its Due Date: "
So it would look something like that in my email:
Hello
Your task : Eat Potatoes with the mention: Potatoes are Delicious is nearing its Due Date:
Is this something that can be done?
edited
strBody = "<p>Hello</p>, " & vbNewLine & vbNewLine & _
"<p>Your task : <b>" & Cells(FormulaCell.Row, "B").Value & _
"</b> with the mention: <b>" & Cells(FormulaCell.Row, "C").Value & _
"</b> is nearing its Due Date: </p>"