Link to home
Start Free TrialLog in
Avatar of patelbg2001
patelbg2001

asked on

Powershell HTML Table

Hi, I'm trying to creating table headers spanned across two rows.

The first header row - <tr><th>Heading1</th><th colspan="5">Heading2</th><th colspan="5">Heading3</th></tr>

The second header row <tr><th>&nbsp;</th><TH>H2Sub1</TH><TH>H2Sub2</TH><TH>H2Sub3</TH>..........

so then I can start to add rows of data underneath.

Thanks

Set-Content $rep "<HTML>"
Add-Content $rep "<Head>"

Add-Content $rep "<theader>"
Add-Content $rep "<tr>"
Add-Content $rep "<TH colspan="1">H1</TH>"
Add-Content $rep "<TH colspan="5">H2</TH>"
Add-Content $rep "<TH colspan="5">H3</TH>"
Add-Content $rep "</tr>"
Add-Content $rep "<tr>"
Add-Content $rep "<th>&nbsp;</th>"
Add-Content $rep "<TH>H2SubH1</TH>"
Add-Content $rep "<TH>H2SubH2</TH>"
Add-Content $rep "<TH>H2SubH3</TH>"
Add-Content $rep "<TH>H2SubH4</TH>"
Add-Content $rep "<TH>H2SubH5</TH>"
Add-Content $rep "<TH>H3SubH1</TH>"
Add-Content $rep "<TH>H3SubH2</TH>"
Add-Content $rep "<TH>H3SubH3</TH>"
Add-Content $rep "<TH>H3SubH4</TH>"
Add-Content $rep "<TH>H3SubH5</TH>"
Add-Content $rep "</tr>"
Add-Content $rep "<Body>"

Add-Content $rep "</Body>"
add-content $rep "</HTML>"
invoke-item $rep 

Open in new window

Avatar of Raheman M. Abdul
Raheman M. Abdul
Flag of United Kingdom of Great Britain and Northern Ireland image

Best way is to use dreamweaver or any HTML generating software, then view source and then use the contents in powershell script.
Avatar of patelbg2001
patelbg2001

ASKER

I dont have access to those applications. whats an alternative method?
ASKER CERTIFIED SOLUTION
Avatar of COBOLdinosaur
COBOLdinosaur
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I just created my table in excel and saved it in html format .
Probably alright if it is for your own use, but if others use it expect complaints about the bloated slow thing you are giving them.  About the only worse HTML you can generate is using Word to generate.  

HTML coming out of Office is totally non-stand and will have compatibility issues even with MS browsers and other products.

Lots of luck.

I assume the C is because I was not prepared to write your code for you and you were not prepared to act/ually do anything to learn how to do things right.  It reflects more on you than on me.

Cd&
I'm not asking any one to write code for me, this is a learning a re-growth process. All I wanted was to work out structure, not content. So saving a table via excel in html format, and stripping out all the xml conversion junk left me with exactly what I needed to build a report to store data, which is emailed to Mr.X

Thanks to all that helped guide me.
B.