As far as I know, Crystal report has a lot of limitation on interpreting HTML tags. I have also seen the supported tags list provided here. However, I have tr and td tags and I cannot avoid using it.
Is there anything I can do in between the HTML and Crystal Report so that table can be created?
Sample Data
<p>Your tenses are a bit confused here.
For next piece of writing, write everything in past tense. Set all your
story with “Last Sunday” to get used to recounting in past
tense first.</p>
<table border="1" cellpadding="1" cellspacing="1" style="width:500px">
<tbody>
<tr>
<td>look</td>
<td>looked</td>
</tr>
<tr>
<td>cook</td>
<td>cooked</td>
</tr>
<tr>
<td>bless</td>
<td>blessed</td>
</tr>
</tbody>
</table>
<p> </p>
Related
I'll admit, I'm not very experienced with writing code in general - I do it on a per-needed basis. Our company is researching different frameworks for writing code for emails. We stumbled across Zurb Foundation. I thought, great, it will make writing a lot less convoluted. Then, while going through the tutorials, I see this for making JUST A BUTTON:
<table align="center" class="container">
<tbody>
<tr>
<td>
<table class="row">
<tbody>
<tr>
<th class="small-12 large-12 columns first last">
<table>
<tr>
<th>
<center data-parsed="">
<table class="button float-center">
<tr>
<td>
<table>
<tr>
<td>Centered Button</td>
</tr>
</table>
</td>
</tr>
</table>
</center>
</th>
<th class="expander"></th>
</tr>
</table>
</th>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
WHY..?? Why does it seem that in coding everything has to a table within a table within a table header, within a table row, within a table cell, within a table row. It goes on forever and literally makes me angry when I look at that. I don't see why making a simple button cannot be 1 line of text, that's it.
Why does code have to be so long and convoluted for the simplest things?
Foundation Emails uses Inky - a custom template language (like all other email frameworks), which generates this for you.
https://foundation.zurb.com/emails/docs/inky.html
Emails are a different beast and if you hand write tables this is common. As Daniel pointed out, Inky is the way to avoid this mess.
Hello I want match a table tag, followed by any characters but not another table, followed by an element with id ContentPlaceHolder1 and finally followed by the /table closed tag.
I write this reg exp:
~\<table[^>]*>.*?ContentPlaceHolder1.+?<\/table>~is
In my text editor (Emeditor) work fine, in PHP script this match the first table tag of page and al the followed code.
Can anyone tell me what's wrong?
Tks a lot
I am just assuming what you wish to achieve, and as Matt has commented on your question, a code snippet with an explanation of what exactly you are trying to achieve would help us help you.
So, in that context, I will try to guess the issue:
I'm guessing that your code has an element with id ContentPlaceHolder1 near the end and maybe nowhere else. What is leading me to assume that is that you are stating:
in PHP script this match the first table tag of page and al the followed code.
and also
want match a table tag, followed by any characters but not another table
Though this is not the case. In fact your regex is doing the following:
Match the first <table> tag with any attributes there might be inside it ([^>]*)
Match any character as few times as possible (.*?)
Match ContentPlaceHolder1
Match at least one character to any, but as few as possible to make a match (.+?)
Match a closing <\/table> tag
What I tend to believe you are misinterpreting is step #2. What this step is trying to achieve, is not to ignore leading <table> tags, but instead ignore multiple occurrences of the keyword ContentPlaceHolder1.
Consider the following example (please ignore that the html is broken, it's just an example):
<table border="3" cellpadding="10" cellspacing="10">
<td>
<table border="3" cellpadding="3" cellspacing="3">
<td>2nd table</td>
<some_element id="ContentPlaceHolder1"></some_element>
</table>
<td>2nd table</td>
<tr>
<td>2nd table</td>
<td>2nd table</td>
</tr>
</table>
<some_element id="ContentPlaceHolder1"></some_element>
</td>
<td> the cell next to this one has a smaller table inside of it, a table inside a table.</td>
</table>
Here, .*? is not instructing the regex engine to avoid matching a second <table> tag, what is instructing instead is to match the first occurence of the keyword ContentPlaceHolder1 instead of greedily matching the last one.
What you are trying to achieve, can be achieved using Negative Lookahead. What this implies, is that it instructs the regex engine, to look further away and assure that it doesn't match the first subset, if the second one exists. You can see this in practice in this demo, where I'm using negative lookahead to instruct the regex engine to only match a <table> tag if it is not followed by another <table> tag (<table[^>]*>(?!.*<table[^>]*>).
Please review my answer, and if it does solve your issue, please add more information and a sample of your code so that we can provide further assistance.
Regards
tks for the answere
This is an ipotetical page code:
<table border="3" cellpadding="10" cellspacing="10">
<tr>
<td>aaaaa</td>
</tr>
</table>
<table border="3" cellpadding="10" cellspacing="10">
<tr>
<td>aaaaa</td>
</tr>
</table>
<table border="3" cellpadding="10" cellspacing="10">
<tr>
<td>
<!-- from here -->
<table border="3" cellpadding="3" cellspacing="3">
<tr>
<td>aaaa</td>
<td><a id="ContentPlaceHolder1">link</a></td>
</tr>
</table>
<!-- to here -->
</td>
</tr>
</table>
<table border="3" cellpadding="10" cellspacing="10">
<tr>
<td>aaaaa</td>
</tr>
</table>
<table border="3" cellpadding="10" cellspacing="10">
<tr>
<td>aaaaa</td>
</tr>
</table>
I want to match from the first comment to the second.
In other word I want to match the complete table that contains elemnt with ContentPlaceHolder1 id.
My regexp in PHP match the first page table tag.
Tks a lot
I have been trying to get text after a table in HTML but for some reason I cannot get this to work. I have tried using div, padding and margin on the table but nothing seem to work. No matter what I do the text always end up behind the first row of the table unless I use </br>.
Here is my HTML:
<div>
<h2 align=left>1. Delivery schedule</h2>
<body> The table below list the various delivery cycles per store:</body>
<br>
<br/>
<p>
<table border="1" align="left" width="61%" height="100px" frame="border">
<tr>
<th height="30" bgcolor="#002387">Store name</th>
<th height="30" bgcolor="#002387">Order deadline</th>
<th height="30" bgcolor="#002387">Delivery lead time from approval date</th>
</tr>
<tr>
<td colspan="3" bgcolor="#002387" ><font color="#FFFFFF"> Cycle 1</font></td>
</tr>
<tr>
<td>Borehamwood</td>
<td>Friday 1st August 2014 by midday</td>
<td>2-4 working days</td>
</tr>
<tr>
<td>Hemel</td>
<td>Friday 1st August 2014 by midday</td>
<td>2-4 working days</td>
</tr>
</table>
</div>
<importantLink>Please note that the advertised 2-4 working days delivery lead time is conditional of the orders being approved by the regional operation managers by the end of order deadline day.</importantLink>
Your code is bleeding from many wounds. First of all, you should forget about the align attribute, and use a CSS class instead.
.align-left {
text-align: left;
}
<h2 class="align-left">1. Delivery schedule</h2>
Then, you have an unclosed <p> tag right before your table, which could be causing your problem. Having invalid markup can lead to unexpected results. And finally, importantLink - depending on your <!DOCTYPE> - is likely not valid (you have a doctype, right?). Use a standard element like an <a> tag, which actually means that it's a link, and if you want to be able to tell it apart from the rest, use a class or id tag to give it a reusable/unique name, respectively. In your case, the text you are presenting in that tag is nothing like a link, so I suppose a <p> tag is the most suited for your case.
<p class="importantLink">Please note that the advertised 2-4 working days delivery lead time is conditional of the orders being approved by the regional operation managers by the end of order deadline day.</p>
usually html elements go one after another unless you give an element a property such as float:left or float:right or in your case align:left so elements after the table won't be under that table, they will be positioned on it's right and from the top.
if you want that link to be after the table (under that table) remove the align:left from the table,
and when writing HTML make sure the opening and closing tags are the same and that your content is inside the body tag, here is the correction for that:
<html> <!--<div>-->
<body>
<h2 align=left>1. Delivery schedule</h2>
<p> The table below list the various delivery cycles per store:</p>
<br>
<br/>
<div><!--<p>-->
<table border="1" align="left" width="61%" height="100px" frame="border">
<tr>
<th height="30" bgcolor="#002387">Store name</th>
<th height="30" bgcolor="#002387">Order deadline</th>
<th height="30" bgcolor="#002387">Delivery lead time from approval date</th>
</tr>
<tr>
<td colspan="3" bgcolor="#002387" ><font color="#FFFFFF"> Cycle 1</font></td>
</tr>
<tr>
<td>Borehamwood</td>
<td>Friday 1st August 2014 by midday</td>
<td>2-4 working days</td>
</tr>
<tr>
<td>Hemel</td>
<td>Friday 1st August 2014 by midday</td>
<td>2-4 working days</td>
</tr>
</table>
</div>
<importantLink>Please note that the advertised 2-4 working days delivery lead time is conditional of the orders being approved by the regional operation managers by the end of order deadline day.</importantLink>
</body>
<html>
this line <table border="1" align="left" width="61%" height="100px" frame="border">
is causing your issue, either remove align:left or change <importantLink> to <importantLink style="clear:both">
If you want the text within the <importantLink> to be displayed below the table you insert text in a div tag as below:
<div style="clear:both">
<importantLink>Your text comes here....</importantLink>
</div>
Replace your importantLink with the three lines of code above.
I have a page written in HTML/ASP that has a series of nested tables that I use for formatting the page the way I want it.
When the page loads however there is a white space between the two tables that is not in the code and when I inspect it in chrome it shows the code has a   character between them.
Why is this appearing in the page when it loads but it is not in the script? How can I remove it?
<table width=100% border=2 cellpadding=0>
<tr>
<table width=100%>
<tr>
<th width=10% align="right">Destination:</th>
<td width=60%>Here</td>
<td width=10% align="right">Date:</td>
<td width=20% align="left"> <%=FormatDateTime(d,2)%></td>
</tr>
</table>
</tr>
<tr>
<table width = 100%>
<tr>
<td width=2%> </td>
<td align="right">Time1:</td>
<td align="center"><%=formatTime(oRS1("time"))%></td>
<td><%=oRS1("location")%></td>
<td width=40> </td>
<td align="right">Driver</td>
<td> <%=fpn%></td>
</tr>
<tr>
</table>
I just had this same issue and here are the steps that I tried that eventually fixed it:
Cleared the cache in the browser
Cleared all browser data
Tried a different browser
None of the above worked in my case, and the phantom was not in my code (and I triple checked it!!!!), but it was obviously somewhere since it was showing in the console and other browsers:
So, (and this may not be the best way to solve this but it worked) as you can see from my console output, I added two paragraph tags above and two below (by carefully putting the cursor in front of the next element and using a carriage return and the arrow key to go back up) to get the phantom in the middle. After that I saved it, then proceeded to select and delete the two paragraph tags in the middle together (with the phantom between them). This is what finally worked, the delete of both the elements surrounding it together took the phantom with it...
Perhaps some small part of my html page became corrupted? Who knows... but if anyone else is having this issue, give this a try.
EDIT: I have added a fiddle to better demonstrate what is happening since the person who has taken the time to offer an answer (thanks!) does not seem to get what I was asking, so hopefully this helps to clarify
http://jsfiddle.net/t5sPL/
I am sending an HTML email. It renders fine in gmail, outlook desktop client, and several other email clients. however, when viewing an inbox online in the outlook webmail app, http://portal.microsoftonline.com, Microsoft seems to be doing its best to not let me center the contents of a table. Tipped off by this article
https://litmus.com/blog/hotmail-and-outlook-com-drop-support-for-margin
I see that the margin attribute is no longer supported. I tried using padding instead and no luck. So, to center my table, I thought I could go oldschool and use this pattern to center it:
<table width='100%' style='width:100%'>
<tbody>
<tr>
<td align='center'>
<table width='700' style='width:700px'>
<tbody>
<tr>
<td>Content to be centered</td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>
</table>
however, this still does not work, because in my <td align='center'> tag, outlook is inexplicably attaching a style='text-align:center;' attribute, for a result of
<td align='center' style='text-align:center;'>
which effectively justifies the content to the left. When I use "inspect element" and delete the style attribute, everything looks as expected.
Has anyone dealt with this issue before? Any resolution, or explanation? Thanks!
Are you trying to center the content inside the 700 wide table? If so, add align="center" to the table cell it is in:
<table width='700' style='width:700px'>
<tbody>
<tr>
<td align="center">Content to be centered</td>
</tr>
</tbody>
</table>
If you are trying to left align the 700 table content, but have the 700 table itself centered, just add align="left" to the <td> instead.
UPDATE:
Based on your jsFiddle - This should fix it:
<table width='100%' style='width:100%' border=1>
<tbody>
<tr>
<td align='center' style='text-align:center'>
<table align='center' width='700' style='width:700px' border=1>
<tbody>
<tr>
<td align='left'><b style='color:red'>This content used to be aligned incorrectly...</b></td>
</tr>
</tbody>
</table>
</td>
</tr>
</tbody>