Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Convert to HTML - Help with formatting

$
0
0

Hello, I have a txt file which list Windows services, and when opened in notepad, word etc all the columns line up correctly.  I would like to add this txt file to an HTML report.  I'm aware ConvertTo-Html is not appropriate function for this, but anyway I did try :

$textfile = "C:\services.txt"
$htm = "c:\services.htm"
$import = import-csv  $textfile -delimiter "`t"
$import |  ConvertTo-Html | Out-File $htm,

I've also tried adding <br> tags at the end of each line and whilst the data is readable it's not alligned (same as the convertto-html).  Can anyone assist with any Powershell methods for retaining some basic table formating when moving data from a txt file to html?  The input data has to be the txt file.  Hoping I do not need to specify each table row, table data references on each element and that someone has a trick!


Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>