?
Solved

Powershell HTML Table

Posted on 2014-04-08
6
Medium Priority
?
473 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
  • 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 1000 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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

Creating Active Directory Users from a Text File

If your organization has a need to mass-create AD user accounts, watch this video to see how its done without the need for scripting or other unnecessary complexities.

Question has a verified solution.

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

In previous parts of this Nano Server deployment series, we learned how to create, deploy and configure Nano Server as a Hyper-V host. In this part, we will look for a clustering option. We will create a Hyper-V cluster of 3 Nano Server host nodes w…
In this post we will be converting StringData saved within a text file into a hash table. This can be further used in a PowerShell script for replacing settings that are dynamic in nature from environment to environment.
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

864 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