Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

html to pdf text on one line

(0) ShareShare
ReportReport
Posted on by 395

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>&nbsp;</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>&nbsp;</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;'>&nbsp;"& (CollectGallery.Selected.WorkInstruction) &"</td>
<td style='width: 272.8px;'>&nbsp;"& (CollectGallery.Selected.WorkDetails) &"</td>
</tr>
</tbody>
</table>
<p>&nbsp;</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>&nbsp;</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>")

Categories:
  • Matt383 Profile Picture
    Matt383 395 on at
    Re: html to pdf text on one line

    Thanks for getting back to me, I found this from NetlogixBI to be effective,  
    Substitute(CollectGallery.Selected.WorkInstruction,Char(10),"<br/>")

  • Re: html to pdf text on one line

    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

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: html to pdf text on one line

    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

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: html to pdf text on one line

    Thank you, works just fine 😉

  • Verified answer
    Re: html to pdf text on one line

    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)

    1.JPG

    Best Regards,

    Bof

  • Matt383 Profile Picture
    Matt383 395 on at
    Re: html to pdf text on one line

    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;'>&nbsp;"& (CollectGallery.Selected.WorkInstruction) &"</td>

     

    Kind regards,

    Matt383

  • Re: html to pdf text on one line

    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"

    1.JPG

    Best Regards,

    Bof

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard