Solved

Powershell HTML Table

Posted on 2014-04-08
6
426 Views
Last Modified: 2014-04-16
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

0
Comment
Question by:patelbg2001
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 2
6 Comments
 
LVL 19

Expert Comment

by:Raheman M. Abdul
ID: 39985598
Best way is to use dreamweaver or any HTML generating software, then view source and then use the contents in powershell script.
0
 
LVL 6

Author Comment

by:patelbg2001
ID: 39985727
I dont have access to those applications. whats an alternative method?
0
 
LVL 53

Accepted Solution

by:
COBOLdinosaur earned 500 total points
ID: 39987253
Just use <th rowspan="2">  on each of the cell that you want to be two rows.  

If that is not what you are trying to do, the perhaps an image of what you expect the table to look like would help,

Cd&
0
Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

 
LVL 6

Author Closing Comment

by:patelbg2001
ID: 39996492
I just created my table in excel and saved it in html format .
0
 
LVL 53

Expert Comment

by:COBOLdinosaur
ID: 39997457
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&
0
 
LVL 6

Author Comment

by:patelbg2001
ID: 40003748
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.
0

Featured Post

Has Powershell sent you back into the Stone Age?

If managing Active Directory using Windows Powershell® is making you feel like you stepped back in time, you are not alone.  For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This script can help you clean up your user profile database by comparing profiles to Active Directory users in a particular OU, and removing the profiles that don't match.
When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…

749 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question