Hi, i have a problem with the html to pdf conversion. I have a powerautomate flow that converts to onedrive, then the pdf is sent to sharepoint. I have the flow and html linked to a submit button (see below) and data from powerapps gallery is pulled into the html. The conversion works however, i have two sections that needs multiple line text (Work Instruction and Work Details). I have theses sections in tables and it looks fine in html but once it goes to pdf, text is on the same line. Because its pulling the data in from the gallery, i cant see a way to put <br> that will work. Any ideas?
This what its doing: aaaaaaaabbbbbbbbbbbbbbbbbbccccccccccccccccccc
This is what i want it to do: aaaaaaaaa
bbbbbbbb
cccccccccc
PDFconvert-2'.Run("<!DOCTYPE html>
<html>
<p><strong>KBX</strong> <em>Mechanical</em></p>
<hr />
<p><strong>Date:</strong> "& (CollectGallery.Selected.Date) &"</p>
<p> </p>
<table style='height: 59px; width: 564px;' border='1px solid black'>
<tbody>
<tr>
<td style='width: 104px;'><strong>Customer:</strong></td>
<td style='width: 186.4px;'>"& (CollectGallery.Selected.Customer) &"</td>
<td style='width: 81.6px;'><strong>Site:</strong></td>
<td style='width: 166.4px;'>"& (CollectGallery.Selected.Site) &"</td>
</tr>
<tr>
<td style='width: 104px;'><strong>Machine ID:</strong></td>
<td style='width: 186.4px;'>"& (CollectGallery.Selected.MachineID) &"</td>
<td style='width: 81.6px;'><strong>KBX Staff:</strong></td>
<td style='width: 166.4px;'>"& (CollectGallery.Selected.Title) &"</td>
</tr>
</tbody>
</table>
<p> </p>
<table style='height: 54px;' border='1px solid black' width='560'>
<tbody>
<tr>
<td style='width: 272.8px;'><strong>Work Instruction</strong></td>
<td style='width: 272.8px;'><strong>Details of work carried out</strong></td>
</tr>
<tr>
<td style='width: 272.8px;'> "& (CollectGallery.Selected.WorkInstruction) &"</td>
<td style='width: 272.8px;'> "& (CollectGallery.Selected.WorkDetails) &"</td>
</tr>
</tbody>
</table>
<p> </p>
<table style='height: 27px; width: 565px;' border='1px solid black'>
<tbody>
<tr>
<td style='width: 120.8px;'><strong>Company Rep:</strong></td>
<td style='width: 429.2px;'>"& (CollectGallery.Selected.CompanyRep) &"</td>
</tr>
</tbody>
</table>
<p><img src="&JSON(CollectGallery.Selected.Signature1, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:120px'></p>
<table style='height: 22px; width: 564px;' border='1px solid black'>
<tbody>
<tr>
<td style='width: 97.4px;'><strong>Start Time:</strong></td>
<td style='width: 77.6px;'>"& (CollectGallery.Selected.StartTime) &"</td>
<td style='width: 100px;'><strong>Finish Time:</strong></td>
<td style='width: 75px;'>"& (CollectGallery.Selected.FinishTime) &"</td>
<td style='width: 103px;'><strong>Total Hours:</strong></td>
<td style='width: 72px;'>"& (CollectGallery.Selected.TotalHours) &"</td>
</tr>
</tbody>
</table>
<p><strong>Parts:</strong></p>
<table style='height: 76px;' border='1px solid black' width='564'>
<tbody>
<tr>
<td style='width: 555.2px;'>"& (CollectGallery.Selected.Part1) &"</td>
</tr>
<tr>
<td style='width: 555.2px;'>"& (CollectGallery.Selected.Part2) &"</td>
</tr>
<tr>
<td style='width: 555.2px;'>"& (CollectGallery.Selected.Parts3) &"</td>
</tr>
</tbody>
</table>
<p><strong> </strong></p>
<p><strong>Images of work conducted:</strong></p>
<p><img src="&JSON(CollectGallery.Selected.Image1, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'><img src="&JSON(CollectGallery.Selected.Image2, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'><img src="&JSON(CollectGallery.Selected.Image3, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'><img src="&JSON(CollectGallery.Selected.Image4, JSONFormat.IgnoreBinaryData)&" type='image/png' style='width:75px;height:75px'></p>
</body>
</html>")
Thanks for getting back to me, I found this from NetlogixBI to be effective,
Substitute(CollectGallery.Selected.WorkInstruction,Char(10),"<br/>")
Hi @Matt383 :
Please try this fromula:
"<td style='width: 575.2px;'>"& Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)-171),59),Result)&"<br>"&
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)-145),26),Result)&"<br>"&
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)-122),23),Result)&"<br>"&
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)-109),13),Result)&"<br>"&
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)-77),32),Result)&"<br>"&
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)-57),20),Result)&"<br>"&
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)),57),Result)&"<br>"&
"</td>"
Best Regards,
Bof
Hi Bof, Thanks again for your solution. I just noticed when i type in (this is all from one textinput)
Picked up flat tyre on rim and replacement tyre from camp 6
Travel to Labona workshop
Strip old tyre off rim
Clean up rim
Fit new tyre to rim and inflate
Dispose of old tyre
Put new wheel assembly on Tue to be dropped off next day
It does not include all the text. It misses the beginning, then duplicates (see below)
Clean up rim Fit new tyre to rim and inflate Dispose of old tyre Put new wheel assembly on Tue to be dr
Clean up rim Fit new tyre to rim and inflate Dispose of old tyre Put new wheel assembly on Tue to be dr
and inflate Dispose of old tyre Put new wheel assembly on Tue to be dropped off next day
This how i currently have the syntax
<td style='width: 575.2px;'>"& Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)-18),105),Result)&"<br>"&
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)-18),105),Result)&"<br>"&
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)),90),Result)&"</td>
Can you please assist
Thank you, works just fine 😉
Hi @Matt383 :
I get it.I suppose to use 9 characters as a line,the code should be:
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)-18),9),Result)&"<br>"&
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)-9),9),Result)&"<br>"&
Concat(LastN(FirstN(Split(CollectGallery.Selected.WorkInstruction,""),Len(CollectGallery.Selected.WorkInstruction)),9),Result)
Best Regards,
Bof
Thanks Bof,
I am grabbing the data from a text input in powerapps gallery into html (see below highlighted in red) Where could i place the <b> to achieve multiline?
<td style='width: 272.8px;'> "& (CollectGallery.Selected.WorkInstruction) &"</td>
Kind regards,
Matt383
Hi @Matt383 :
Do you want a paragraph of text fo be displayed in sepparate lines?
If so,just insert <br> into the place where you need to wrap.For example:
"aaaaaaaaa<br>bbbbbbbb<br>cccccccccc"
Best Regards,
Bof