Click here to Skip to main content
15,891,864 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
How to remove display: none tags from html string in c# code using regular expressions

XML
<tr>
<td colspan="6" rowspan="1" style="display: none;">ABC</td>
<td colspan="1" rowspan="2" >BCV</td>
<td colspan="8" rowspan="1" >Date</td>
</tr>

<tr class="headertr" style="color: Black; border-color: Black;">
<td scope="col" style="display: none;">kkfd %</td>
<td scope="col" style="display: none;">fd SR</td>
<td scope="col" style="display: none;">dsd</td>

<td scope="col">Current Year</td>
<td scope="col">Prior Year</td>

</tr>

I want to remove td which has display none property , I need output as below

<tr>

<td colspan="1" rowspan="2" >BCV</td>
<td colspan="8" rowspan="1" >Date</td>
</tr>

<tr class="headertr" style="color: Black; border-color: Black;">

<td scope="col">Current Year</td>
<td scope="col">Prior Year</td>

</tr>
Posted
Updated 13-Oct-14 5:07am
v3
Comments
Sergey Alexandrovich Kryukov 13-Oct-14 10:57am    
The question is: how did you come to displaying any tags in first place?
—SA
Joemens 13-Oct-14 11:05am    
Im exporting html data to excel which has tags of display:none , but these tags are also getting export to excel

[Unreadable code removed — SA]
Sergey Alexandrovich Kryukov 13-Oct-14 11:09am    
First of all, please put code in the question, not comments. (Click "Improve question" above.)
And still, nobody can see how did you export. Probably you don't want to show any tags at all, only content.
—SA
Joemens 13-Oct-14 11:13am    
want to remove from html string , the tags which has display:none property using c# code . I am sending table data as string to c# code .
Sergey Alexandrovich Kryukov 13-Oct-14 11:36am    
All right, if you don't want to show you C# code, don't. But why asking questions then?
—SA

1 solution

I love regular expressions also, but why not just use a simple if with a string contains? The regex seems like extreme overkill given the simple issue.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900