In PrimeNG, Frozen Headers also scrolling along with unfrozen columns and missing alignment of headers - primeng-table

I have tried to show pResizableColumn pFrozenColumn into a single table.But after integrate both into single table Frozen Headers also scrolling along with unfrozen columns.
<p-table
[value]="customers"
scrollDirection="both"
[scrollable]="true"
scrollHeight="400px"
styleClass="p-datatable-gridlines"
[resizableColumns]="true"
>
<ng-template pTemplate="header">
<tr>
<th style="width:200px" pResizableColumn pFrozenColumn>Name</th>
<th style="width:100px" pResizableColumn pFrozenColumn>Id</th>
<th style="width:200px" pResizableColumn pFrozenColumn>Country</th>
<th style="width:200px" pResizableColumn>Date</th>
<th style="width:200px" pResizableColumn>Company</th>
<th style="width:200px" pResizableColumn>Status</th>
<th style="width:200px" pResizableColumn>Activity</th>
<th style="width:200px" pResizableColumn>Status</th>
<th style="width:200px" pResizableColumn>Activity</th>
<th style="width:200px" pResizableColumn>Representative</th>
</tr>
</ng-template>
<ng-template pTemplate="body" let-customer>
<tr>
<td style="width:200px" pFrozenColumn>{{ customer.name }}</td>
<td style="width:100px" pFrozenColumn>{{ customer.id }}</td>
<td style="width:200px" pFrozenColumn>{{ customer.country.name }}</td>
<td style="width:200px">{{ customer.date }}</td>
<td style="width:200px">{{ customer.company }}</td>
<td style="width:200px">{{ customer.status }}</td>
<td style="width:200px">{{ customer.activity }}</td>
<td style="width:200px">{{ customer.status }}</td>
<td style="width:200px">{{ customer.activity }}</td>
<td style="width:200px">{{ customer.representative.name }}</td>
</tr>
</ng-template>
</p-table>

Related

Table number iterator

I want to create a table in twig. The rows in the table are added dynamically, depending on what the user configures in the admin. I'm almost there, but each tr needs to be prefixed with a number.
How do I make the number (1, 2, 3) dynamic, as I don't know how many rows will be in the table beforehand? I have looked at the batch and for explanations in the twig documentation but it doesn't explain what to do when you don't know the max number.
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">1</th>
<td>Mark</td>
<td>Otto</td>
<td>#mdo</td>
</tr>
<tr>
<th scope="row">2</th>
<td>Jacob</td>
<td>Thornton</td>
<td>#fat</td>
</tr>
<tr>
<th scope="row">3</th>
<td>Larry</td>
<td>the Bird</td>
<td>#twitter</td>
</tr>
</tbody>
</table>
As you didn't provide the twig code in your question I'm assuming you are building the table with a for
<table class="table">
<thead>
<tr>
<th scope="col">#</th>
<th scope="col">First</th>
<th scope="col">Last</th>
<th scope="col">Handle</th>
</tr>
</thead>
<tbody>
{% for item in items %}
<tr>
<th scope="row">{{ loop.index }}</th>
<td>{{ item.first_name }}</td>
<td>{{ item.last_name }}</td>
<td>{{ item.handle }}</td>
</tr>
{% endfor %}
</tbody>
</table>
demo

How to make an item always appear last on list (Netsuite Advanced PDF)

I am trying to make an item appear last on the list if it appears on an in the invoice (Advanced PDF,NetSuite).
I was thinking bout trying to sort by and adding some ZZZs to the item name, but thats because I dont really know much outside of basic HTML.
Any Help would be appreciated.
Below is the table code I am dealing with.
<table class="itemtable" style="width: 100%; margin-top: 10px;"><!-- start items --><#list record.item as item><#if item_index==0>
<thead>
<tr>
<th align="center" colspan="3">${item.quantity#label}</th>
<th colspan="12">${item.item#label}</th>
<th colspan="3">${item.options#label}</th>
<th align="right" colspan="4">${item.rate#label}</th>
<th align="right" colspan="4">${item.amount#label}</th>
</tr>
</thead>
</#if><tr>
<td align="center" colspan="3" line-height="150%">${item.quantity}</td>
<td colspan="12"><span class="itemname">${item.item}</span><br />${item.description}</td>
<td colspan="3">${item.options}</td>
<td align="right" colspan="4">${item.rate}</td>
<td align="right" colspan="4">${item.amount}</td>
</tr>
</#list>
I need the to be able to choose a specific itemname to always show at the bottom.
You can use the assign tag to hold the values for your bottom item.
<#assign bottomItemName = 'Bottom Item Name'>
<#assign bottomItem = {}>
<#list record.item as item>
<#if item_index==0>
<thead>
<tr>
<th align="center" colspan="3">${item.quantity#label}</th>
<th colspan="12">${item.item#label}</th>
<th colspan="3">${item.options#label}</th>
<th align="right" colspan="4">${item.rate#label}</th>
<th align="right" colspan="4">${item.amount#label}</th>
</tr>
</thead>
</#if>
<#if item.item == bottomItemName>
<#assign bottomItem = bottomItem + item>
<#else>
<tr>
<td align="center" colspan="3" line-height="150%">${item.quantity}</td>
<td colspan="12"><span class="itemname">${item.item}</span><br />${item.description}</td>
<td colspan="3">${item.options}</td>
<td align="right" colspan="4">${item.rate}</td>
<td align="right" colspan="4">${item.amount}</td>
</tr>
</#if>
</#list>
<#if bottomItem.item??>
<tr>
<td align="center" colspan="3" line-height="150%">${bottomItem.quantity}</td>
<td colspan="12"><span class="itemname">${bottomItem.item}</span><br />${bottomItem.description}</td>
<td colspan="3">${bottomItem.options}</td>
<td align="right" colspan="4">${bottomItem.rate}</td>
<td align="right" colspan="4">${bottomItem.amount}</td>
</tr>
</#if>
You could try looping 2x.
<table class="itemtable" style="width: 100%; margin-top: 10px;"><!-- start items --><#list record.item as item><#if item_index==0>
<thead>
<tr>
<th align="center" colspan="3">${item.quantity#label}</th>
<th colspan="12">${item.item#label}</th>
<th colspan="3">${item.options#label}</th>
<th align="right" colspan="4">${item.rate#label}</th>
<th align="right" colspan="4">${item.amount#label}</th>
</tr>
</thead>
</#if><#if ${item.item}!="Your Item"><tr>
<td align="center" colspan="3" line-height="150%">${item.quantity}</td>
<td colspan="12"><span class="itemname">${item.item}</span><br />${item.description}</td>
<td colspan="3">${item.options}</td>
<td align="right" colspan="4">${item.rate}</td>
<td align="right" colspan="4">${item.amount}</td>
</tr>
</#list>
<#list record.item as item><#if ${item.item}=="Your Item"><tr>
<td align="center" colspan="3" line-height="150%">${item.quantity}</td>
<td colspan="12"><span class="itemname">${item.item}</span><br />${item.description}</td>
<td colspan="3">${item.options}</td>
<td align="right" colspan="4">${item.rate}</td>
<td align="right" colspan="4">${item.amount}</td>
</tr>
</#list>
I haven't tested the if statement, so good luck

How to you print one Result on the Advanced PDF Template from a Saved Search vs a list?

I have an Inbound Shipment saved search of items coming in listed by container. I have no problem printing the list of the items with quantities, description, etc. but when I add in the "vessel Number" or "shipment number" I don't need it to repeat on every line. I would prefer to show the information that I would normally "group" at the top of the PDF vs. on each line.
I should note that when I print the saved search, I would have already filtered the search down to one container, meaning only one "shipment number" and one "vessel number".
<table align="center" border=".5" cellpadding=".5" cellspacing=".5" class="NATIVE-TABLE" style="width:100%;"><#list results as result><#if result_index == 0>
<thead>
<tr>
<th align="center" scope="col" style="width: 107px;">
<div><big>Shipment #</big></div>
</th>
<th align="center" scope="col" style="width: 103px;">
<div><big>Status</big></div>
</th>
<th align="center" scope="col" style="width: 156px;">
<div><big>Destination</big></div>
</th>
<th align="center" scope="col" style="width: 150px;">
<div><big>Actual Ship Date</big></div>
</th>
<th align="center" scope="col" style="width: 154px;">
<div><big>Expected Delivery Date</big></div>
</th>
<th align="center" scope="col">
<div><big>Carrier</big></div>
</th>
<th align="center" scope="col">
<div><big>Vessel #</big></div>
</th>
</tr>
</thead>
</#if><tr>
<td align="center" style="width: 107px;">${result.shipmentnumber}</td>
<td align="center" style="width: 103px;">${result.status}</td>
<td align="center" style="width: 156px;">${result.custrecord142}</td>
<td align="center" style="width: 150px;">${result.actualshippingdate}</td>
<td align="center" style="width: 154px;">${result.expecteddeliverydate}</td>
<td align="center" style="width: 154px;">${result.custrecord_htd_shipper_info}</td>
<td align="center" style="width: 154px;">${result.vesselnumber}</td>
</tr>
</#list></table>
First: please post your code so we can see where you're up to and respond accordingly - it helps us to help you!
Second: The general pattern would be that you simply use values from the first result to make up your header, and then iterate through all results to give your lines. It would look something like:
<#list results as result>
<#if result_index == 0>
*header information goes here*
</#if>
*line information goes here*
</#list>
Edited to add code
<table align="center" border=".5" cellpadding=".5" cellspacing=".5" class="NATIVE-TABLE" style="width:100%;"><#list results as result><#if result_index == 0>
<thead>
<tr>
<th align="center" scope="col" style="width: 107px;">
<div><big>Shipment #</big></div>
</th>
<th align="center" scope="col" style="width: 103px;">
<div><big>Status</big></div>
</th>
<th align="center" scope="col" style="width: 156px;">
<div><big>Destination</big></div>
</th>
<th align="center" scope="col" style="width: 150px;">
<div><big>Actual Ship Date</big></div>
</th>
<th align="center" scope="col" style="width: 154px;">
<div><big>Expected Delivery Date</big></div>
</th>
<th align="center" scope="col">
<div><big>Carrier</big></div>
</th>
<th align="center" scope="col">
<div><big>Vessel #</big></div>
</th>
</tr>
</thead>
<tr>
<td align="center" style="width: 107px;">${result.shipmentnumber}</td>
<td align="center" style="width: 103px;">${result.status}</td>
<td align="center" style="width: 156px;">${result.custrecord142}</td>
<td align="center" style="width: 150px;">${result.actualshippingdate}</td>
<td align="center" style="width: 154px;">${result.expecteddeliverydate}</td>
<td align="center" style="width: 154px;">${result.custrecord_htd_shipper_info}</td>
<td align="center" style="width: 154px;">${result.vesselnumber}</td>
</tr>
</#if>
<tr>
<td align="center" style="width: 107px;"></td>
<td align="center" style="width: 103px;">${result.status}</td>
<td align="center" style="width: 156px;">${result.custrecord142}</td>
<td align="center" style="width: 150px;">${result.actualshippingdate}</td>
<td align="center" style="width: 154px;">${result.expecteddeliverydate}</td>
<td align="center" style="width: 154px;">${result.custrecord_htd_shipper_info}</td>
<td align="center" style="width: 154px;"></td>
</tr>
</#list>
</table>

How to pass product TVs to SimpleCart's scGetCart snippet?

I need some TVs (weight, dimensions, etc) I've associated with my products to appear in the Cart page of my SimpleCart site.
Problem is I have no idea how to do this. I don't understand how the SimpleCart cart is built and there isn't documentation for this.
Would anyone know how I can show TVs associated with each product in the cart output chunk?
The cart snippet has the following code which gets data from the cart and puts it into Chunks:
$sc = $modx->getService('simplecart','SimpleCart',$modx->getOption('simplecart.core_path',null,$modx->getOption('core_path').'components/simplecart/').'model/simplecart/',$scriptProperties);
if (!($sc instanceof SimpleCart)) return '';
 
$controller = $sc->loadController('Cart');
$output = $controller->run($scriptProperties);
The output Chunk looks like:
<div id="simplecart">
<form action="[[~[[*id]]]]" method="post" id="form_cartoverview">
<input type="hidden" name="updatecart" value="true" />
<table>
<tr>
<th class="desc">[[%simplecart.cart.description]]</th>
<th class="price">[[%simplecart.cart.price]]</th>
<th class="quantity">[[%simplecart.cart.quantity]]</th>
[[+cart.total.vat_total:notempty=`<th class="quantity">[[%simplecart.cart.vat]]</th>`:isempty=``]]
<th class="subtotal">[[%simplecart.cart.subtotal]]</th>
<th> </th>
</tr>
[[+cart.wrapper]]
[[+cart.total.discount:notempty=`<tr class="total first discount">
<td colspan="[[+cart.total.vat_total:notempty=`3`:isempty=`2`]]"> </td>
<td class="label">[[%simplecart.cart.discount]]</td>
<td class="value">- [[+cart.total.discount_formatted]]</td>
<td class="extra">[[+cart.total.discount_percent:notempty=`([[+cart.total.discount_percent]]%)`:isempty=` `]]</td>
</tr>`:isempty=``]]
[[+cart.total.vat_total:notempty=`
<tr class="total [[+cart.total.discount:notempty=`second`:isempty=`first`]]">
<td colspan="3"> </td>
<td class="label">[[%simplecart.cart.total_ex_vat]]</td>
<td class="value">[[+cart.total.price_ex_vat_formatted]]</td>
<td class="extra"> </td>
</tr>
[[+cart.vat_rates]]
<tr class="total [[+cart.total.discount:notempty=`third`:isempty=`second`]]">
<td colspan="3"> </td>
<td class="label">[[%simplecart.cart.total_vat]]</td>
<td class="value">[[+cart.total.vat_total_formatted]]</td>
<td class="extra"> </td>
</tr>
<tr class="total [[+cart.total.discount:notempty=`fourth`:isempty=`third`]]">
<td colspan="3"> </td>
<td class="label">[[%simplecart.cart.total_in_vat]]</td>
<td class="value">[[+cart.total.price_formatted]]</td>
<td class="extra"> </td>
</tr>
`:isempty=`
<tr class="total [[+cart.total.discount:notempty=`second`:isempty=`first`]]">
<td colspan="2"> </td>
<td class="label">[[%simplecart.cart.total]]</td>
<td class="value">[[+cart.total.price_formatted]]</td>
<td class="extra"> </td>
</tr>
`]]
</table>
<div class="submit">
<input type="submit" value="[[%simplecart.cart.update]]" />
</div>
</form>
This does appear to be documented:
Product Options (TVs)
and to output them:
Modifying the Product Template
It appears that you would just output them normally [[*myProductOptions]]
Though, it appears that your template is using a placeholder, I would try
[[+cart.myProductOptions] as well. If all else fails you might try debugging the simplecart class and dump the array of product data before it populates the chunk, there might be a clue in there.
Found (through trial and error) you must use:
[[+product.tv.name_of_tv]]

C# Html Agility Pack : Remove 2 columns on a table

I am trying to remove 2 columns on a table which inside a div which has a attribute "data-group" with value "Revision". The problem is it is removing 2 columns on all the tables or not doing anything.
Below is the code:
string htmlDoc = #"
<div id='TestCo_1' class='view' data-routingURI='ViewRouter.aspx' data-view='TestCo_1' data-filters='' data-viewVersion='2' data-vmVersion='2.2.0.0'>
<div id='g1' class='group' data-group='Reddy,HEATHER+M'>
<div id='gh1' class='gh' style='margin-left:10px;'>
<img id='gti1' class='gti' src='Images/closed.png'/>
<span id='gt1' class='gt'>Reddy,HEATHER M</span>
<a id='ge1' class='groupExport'>
<img src='Images/excel.png' title='Excel export Reddy,HEATHER M' class='export'/>
</a>
</div>
<div id='gc1' class='gc'/>
<div id='g2' class='group' data-group='Reddy,HEATHER+M/Data+Check+Status'>
<div id='gh2' class='gh' style='margin-left:60px;'>
<img id='gti2' class='gti' src='Images/closed.png'/>
<span id='gt2' class='gt'>Data Check Status</span>
<a id='ge2' class='groupExport'>
<img src='Images/excel.png' title='Excel export Data Check Status' class='export'/>
</a>
</div>
<div id='gc2' class='gc'>
<table border='0' class='groupTable' style='margin-left:110px;color:black; background-color:White;'>
<thead>
<tr style='margin-left:60px;color:blue; background-color:White; '>
<th style='text-align:center;' width='50px'>RK ID</th>
<th width='80px'>Plan Year</th>
<th style='text-align:center;' width='80px'>Period</th>
<th style='text-align:center;' width='80px'>Plan Term Date</th>
<th width='300px'>Subscriber Name</th>
<th width='300px'>Plan Market</th>
<th width='300px'>TestCoTS Review Requested</th>
<th width='400px'>Status</th>
<th width='60px'>Region</th>
</tr>
</thead>
<tr class='dtl'>
<td style='text-align:center;' class='link' data-target='ae:311085;id:763;status:Data+Check+Status;'>311085</td>
<td>2013</td>
<td style='text-align:center;'>Year End</td>
<td style='text-align:center;'/>
<td>KEDRION BIOPHARMA INC</td>
<td/>
<td/>
<td style='font-weight:bold;'>TestCoTS Data Checks Review Requested</td>
<td style='text-align:center;'>Florida</td>
</tr>
</table>
</div>
</div>
<div id='g3' class='group' data-group='Reddy,HEATHER+M/ER+Funding+Status'>
<div id='gh3' class='gh' style='margin-left:60px;'>
<img id='gti3' class='gti' src='Images/closed.png'/>
<span id='gt3' class='gt'>ER Funding Status</span>
<a id='ge3' class='groupExport'>
<img src='Images/excel.png' title='Excel export ER Funding Status' class='export'/>
</a>
</div>
<div id='gc3' class='gc'>
<table border='0' class='groupTable' style='margin-left:110px;color:black; background-color:White;'>
<thead>
<tr style='margin-left:60px;color:blue; background-color:White; '>
<th style='text-align:center;' width='50px'>RK ID</th>
<th width='80px'>Plan Year</th>
<th style='text-align:center;' width='80px'>Period</th>
<th style='text-align:center;' width='80px'>Plan Term Date</th>
<th width='300px'>Subscriber Name</th>
<th width='300px'>Plan Market</th>
<th width='300px'>TestCoTS Review Requested</th>
<th width='400px'>Status</th>
<th width='60px'>Region</th>
</tr>
</thead>
<tr class='dtl'>
<td style='text-align:center;' class='link' data-target='ae:311077;id:377;status:ER+Funding+Status;'>311077</td>
<td>2013</td>
<td style='text-align:center;'>Year End</td>
<td style='text-align:center;'/>
<td>APPLE ROCK ADVERTISING AND PRO</td>
<td/>
<td/>
<td style='font-weight:bold;'>TestCoTS ER Funding Follow Up Requested</td>
<td style='text-align:center;'>Florida</td>
</tr>
<tr class='dtl'>
<td style='text-align:center;' class='link' data-target='ae:51212105;id:1506;status:ER+Funding+Status;'>51212105</td>
<td>2012</td>
<td style='text-align:center;'>Year End</td>
<td style='text-align:center;'/>
<td>WORD ACADEMIES, INC.</td>
<td/>
<td/>
<td style='font-weight:bold;'>TestCoTS ER Funding Follow Up Requested</td>
<td style='text-align:center;'>Florida</td>
</tr>
<tr class='dtl'>
<td style='text-align:center;' class='link' data-target='ae:51212105;id:390;status:ER+Funding+Status;'>51212105</td>
<td>2013</td>
<td style='text-align:center;'>Year End</td>
<td style='text-align:center;'/>
<td>WORD ACADEMIES, INC.</td>
<td/>
<td/>
<td style='font-weight:bold;'>TestCoTS ER Funding Follow Up Requested</td>
<td style='text-align:center;'>Florida</td>
</tr>
</table>
</div>
</div>
<div id='g4' class='group' data-group='Reddy,HEATHER+M/Match+Verification+Status'>
<div id='gh4' class='gh' style='margin-left:60px;'>
<img id='gti4' class='gti' src='Images/closed.png'/>
<span id='gt4' class='gt'>Match Verification Status</span>
<a id='ge4' class='groupExport'>
<img src='Images/excel.png' title='Excel export Match Verification Status' class='export'/>
</a>
</div>
<div id='gc4' class='gc'>
<table border='0' class='groupTable' style='margin-left:110px;color:black; background-color:White;'>
<thead>
<tr style='margin-left:60px;color:blue; background-color:White; '>
<th style='text-align:center;' width='50px'>RK ID</th>
<th width='80px'>Plan Year</th>
<th style='text-align:center;' width='80px'>Period</th>
<th style='text-align:center;' width='80px'>Plan Term Date</th>
<th width='300px'>Subscriber Name</th>
<th width='300px'>Plan Market</th>
<th width='300px'>TestCoTS Review Requested</th>
<th width='400px'>Status</th>
<th width='60px'>Region</th>
</tr>
</thead>
<tr class='dtl'>
<td style='text-align:center;' class='link' data-target='ae:311085;id:763;status:Match+Verification+Status;'>311085</td>
<td>2013</td>
<td style='text-align:center;'>Year End</td>
<td style='text-align:center;'/>
<td>KEDRION BIOPHARMA INC</td>
<td/>
<td/>
<td style='font-weight:bold;'>TestCoTS Match Verification Review Requested</td>
<td style='text-align:center;'>Florida</td>
</tr>
</table>
</div>
</div>
<div id='g5' class='group' data-group='Reddy,HEATHER+M/Plan+Contact+Status'>
<div id='gh5' class='gh' style='margin-left:60px;'>
<img id='gti5' class='gti' src='Images/closed.png'/>
<span id='gt5' class='gt'>Plan Contact Status</span>
<a id='ge5' class='groupExport'>
<img src='Images/excel.png' title='Excel export Plan Contact Status' class='export'/>
</a>
</div>
<div id='gc5' class='gc'>
<table border='0' class='groupTable' style='margin-left:110px;color:black; background-color:White;'>
<thead>
<tr style='margin-left:60px;color:blue; background-color:White; '>
<th style='text-align:center;' width='50px'>RK ID</th>
<th width='80px'>Plan Year</th>
<th style='text-align:center;' width='80px'>Period</th>
<th style='text-align:center;' width='80px'>Plan Term Date</th>
<th width='300px'>Subscriber Name</th>
<th width='300px'>Plan Market</th>
<th width='300px'>TestCoTS Review Requested</th>
<th width='400px'>Status</th>
<th width='60px'>Region</th>
</tr>
</thead>
<tr class='dtl'>
<td style='text-align:center;' class='link' data-target='ae:311026;id:0;status:Plan+Contact+Status;'>311026</td>
<td/>
<td style='text-align:center;'/>
<td style='text-align:center;'/>
<td>INSTITUTE OF FINANCIAL OPERATI</td>
<td/>
<td/>
<td style='font-weight:bold;'>TestCoTS Contacts Undeliverable</td>
<td style='text-align:center;'>Florida</td>
</tr>
<tr class='dtl'>
<td style='text-align:center;' class='link' data-target='ae:311036;id:0;status:Plan+Contact+Status;'>311036</td>
<td/>
<td style='text-align:center;'/>
<td style='text-align:center;'/>
<td>VOTENET SOLUTIONS, INC</td>
<td/>
<td/>
<td style='font-weight:bold;'>TestCoTS Contacts Undeliverable</td>
<td style='text-align:center;'>Florida</td>
</tr>
</table>
</div>
</div>
<div id='g6' class='group' data-group='Reddy,HEATHER+M/Revision+Status'>
<div id='gh6' class='gh' style='margin-left:60px;'>
<img id='gti6' class='gti' src='Images/closed.png'/>
<span id='gt6' class='gt'>Revision Status</span>
<a id='ge6' class='groupExport'>
<img src='Images/excel.png' title='Excel export Revision Status' class='export'/>
</a>
</div>
<div id='gc6' class='gc'>
<table border='0' class='groupTable' style='margin-left:110px;color:black; background-color:White;'>
<thead>
<tr style='margin-left:60px;color:blue; background-color:White; '>
<th style='text-align:center;' width='50px'>RK ID</th>
<th width='80px'>Plan Year</th>
<th style='text-align:center;' width='80px'>Period</th>
<th style='text-align:center;' width='80px'>Plan Term Date</th>
<th width='300px'>Subscriber Name</th>
<th width='300px'>Plan Market</th>
<th width='300px'>TestCoTS Review Requested</th>
<th width='400px'>Status</th>
<th width='60px'>Region</th>
</tr>
</thead>
<tr class='dtl'>
<td style='text-align:center;' class='link' data-target='ae:51212105;id:779;status:Revision+Status;'>51212105</td>
<td>2013</td>
<td style='text-align:center;'>Year End</td>
<td style='text-align:center;'/>
<td>WORD ACADEMIES, INC.</td>
<td/>
<td/>
<td style='font-weight:bold;'>TestCoTS Additional Data Requested</td>
<td style='text-align:center;'>Florida</td>
</tr>
</table>
</div>
</div>
<div id='g7' class='group' data-group='Reddy,HEATHER+M/Testing+Status'>
<div id='gh7' class='gh' style='margin-left:60px;'>
<img id='gti7' class='gti' src='Images/closed.png'/>
<span id='gt7' class='gt'>Testing Status</span>
<a id='ge7' class='groupExport'>
<img src='Images/excel.png' title='Excel export Testing Status' class='export'/>
</a>
</div>
<div id='gc7' class='gc'>
<table border='0' class='groupTable' style='margin-left:110px;color:black; background-color:White;'>
<thead>
<tr style='margin-left:60px;color:blue; background-color:White; '>
<th style='text-align:center;' width='50px'>RK ID</th>
<th width='80px'>Plan Year</th>
<th style='text-align:center;' width='80px'>Period</th>
<th style='text-align:center;' width='80px'>Plan Term Date</th>
<th width='300px'>Subscriber Name</th>
<th width='300px'>Plan Market</th>
<th width='300px'>TestCoTS Review Requested</th>
<th width='400px'>Status</th>
<th width='60px'>Region</th>
</tr>
</thead>
<tr class='dtl'>
<td style='text-align:center;' class='link' data-target='ae:51212105;id:779;status:Testing+Status;'>51212105</td>
<td>2013</td>
<td style='text-align:center;'>Year End</td>
<td style='text-align:center;'/>
<td>WORD ACADEMIES, INC.</td>
<td/>
<td/>
<td style='font-weight:bold;'>TestCoTS Testing Review Requested - Failed</td>
<td style='text-align:center;'>Florida</td>
</tr>
<tr class='dtl'>
<td style='text-align:center;' class='link' data-target='ae:311083;id:759;status:Testing+Status;'>311083</td>
<td>2013</td>
<td style='text-align:center;'>Year End</td>
<td style='text-align:center;'/>
<td>REDI-GROUP NORTH AMERICA, LLC</td>
<td/>
<td/>
<td style='font-weight:bold;'>TestCoTS Testing Review Requested - Failed</td>
<td style='text-align:center;'>Florida</td>
</tr>
</table>
</div>
</div>
</div>
</div>";
HtmlDocument myhtmlDoc = new HtmlDocument();
myhtmlDoc.LoadHtml(htmlDoc);
var revNodes = myhtmlDoc.DocumentNode
.Descendants("div")
.Where(x => x.Attributes["data-group"] != null && x.Attributes["data-group"].Value.Contains("Revision") == true)
.ToList<HtmlNode>();
foreach (HtmlNode node in myhtmlDoc.DocumentNode.Descendants("div"))
{
foreach (HtmlNode revNode in revNodes)
{
if (node == revNode)
{
var test = node.SelectNodes("//div[2]//table//tr");
//foreach (HtmlNode row in test.Nodes)
foreach (HtmlNode row in node.SelectNodes("//div//div[2]//table//tr"))
{
if (row.SelectSingleNode("td[1]") != null)
row.RemoveChild(row.SelectSingleNode("td[1]"));
if (row.SelectSingleNode("td[2]") != null)
row.RemoveChild(row.SelectSingleNode("td[2]"));
if (row.SelectSingleNode("th[1]") != null)
row.RemoveChild(row.SelectSingleNode("th[1]"));
if (row.SelectSingleNode("th[2]") != null)
row.RemoveChild(row.SelectSingleNode("th[2]"));
// row.RemoveChild(row.SelectSingleNode("td[8]"));
}
}
}
}
myhtmlDoc.Save(#"D:\REsult.html")
Assuming you have a context node and you want to select a child div or table use the path div respectively div/table. If you start your path with //div respectively //div/table your selection starts down from the root node of the context node, that is, it searches the whole document. So make sure you use a relative path, if you look for descendants then use .//div or .//div/table but not //div/table as that way you search the whole document of the context node and not the subtree of the context node.

Resources