Home
Analytics
Hiding the Border of a table conditionally
birt_ag
<p>Hi,</p>
<p> </p>
<p>I've a simple table with 5 columns. The name of first column is Title. I've designed the xml to split the title into two block if the the length is huge. I cannot make use of BIRT internal wrap properties due to some limitation in our application. Hence i've manually split the text in different blocks in xml file.</p>
<p> </p>
<p>Now I need to hide the bottom border in the generated report. If there is only title tag in the xml block, we can assume it as continuation of previous xml block. <br>
with this assumption is it possible to hide the bottom border conditionally?</p>
<p> </p>
<p>or is there anything else that can be thought off </p>
<p> </p>
<p>I'm attaching the sample report, xml and a snapshot that contains actual output and expected output explained. </p>
<p>Since i'm not able to attach the xml file, i'm pasting it over here - </p>
<p> </p>
<div>
<pre class="_prettyXprint">
<?xml version="1.0" encoding="ISO-8859-1"?>
<BookStore>
<Book>
<title>History</title>
<author>Tom</author>
<copies>10</copies>
<price>80</price>
<date>11/12/2014</date>
</Book>
<Book>
<title>Basic Mathematics</title>
<author>Roy</author>
<copies>5</copies>
<price>100</price>
<date>10/12/2013</date>
</Book>
<Book>
<title>Written by Jason</title>
</Book>
<Book>
<title>Java</title>
<author>Harry</author>
<author>Potter</author>
<copies>6</copies>
<price>100</price>
<date>08/12/2010</date>
</Book>
</BookStore></pre>
<p>Any help on this would be very useful..<br>
Thank You.</p>
</div>
<p> </p>
Find more posts tagged with
Comments
Matthew L.
<p>This can be accomplished by using a custom Style along with a highlight rule on the table row.</p>
<p>Attached is an example that demonstrates this.</p>
<p> </p>
<p>Steps:</p>
<p>Remove borders from tables detail row.</p>
<p>Create custom Style with top border only.</p>
<p>Select table detail row and add highlight rule.</p>
<p>Apply Style using highlight condition on a blank cell.</p>
<p>Then select entire table and apply a bottom border so that the last row will have a bottom border.</p>
<p> </p>
<p>Let me know if you need assistance looking through the example.</p>
<p> </p>
birt_ag
<p>Hi Mathew,</p>
<p> </p>
<p>Thanks for the reply.<br>
I went through the attached report. But the bottom border are not visible when i generated the report.<br>
can u confirm if the attached design is correct file ? <br>
I don't see any custom styles added to it.</p>
<p> </p>
<p>I'll try with the steps mentioned above. </p>
<p> </p>
<p>Thank You.</p>
Matthew L.
<p>The output seems to work for me properly (See attached PDF output).</p>
<p>I've also attached an image that shows where the custom style "CustomTopBorder" is located and how it is used with the table rows.</p>
<p> </p>
<p>If you are not seeing the same results as the PDF i've attached, please let me know which version of BIRT you are using and I will verify against that version as well.</p>
birt_ag
<p>Hi Matthew,</p>
<p> </p>
<p>I'm using BIRT 4.3.1.</p>
<p>Eclipse BIRT Designer Version 4.3.1.v201309091055 Build <4.3.1.v20130917-1035></p>
<p> </p>
<p>Just verified the attached design file again. <br>
In PDF reports the borders are visible properly, whereas in DOC and DOCX the borders are not visible.</p>
<p> </p>
<p>I tried replicating the steps u mentioned. And was able to achieve the desired result. <br><br>
But i need it for doc format too. Is there anything else that can be done to get the desired result in doc too.</p>
<p> </p>
<p>Thank You very much for the help. <br><br>
Due to timezone difference i'm not able to reply on time. </p>
Matthew L.
<p>I've looked into the doc/docx output formats and it seems that the custom styles are not being applied through the Highlight rule.</p>
<p> </p>
<p>Because of this, I've created a workaround (See attached example).</p>
<p>Add the following code to each of the data elements onCreate script method in the tables detail row.</p>
<p>This will add the border's when outputting to a doc/docx format.</p>
<pre class="_prettyXprint _lang-js">
if(reportContext.getOutputFormat().slice(0,3)=="doc" && row["date"]!=null){
this.getStyle().borderTopStyle = "solid";
this.getStyle().borderTopWidth = "thin";
}
</pre>
birt_ag
<p>Hi Matthew,</p>
<p> </p>
<p>I tried with the script u gave above. <br>
Its working exactly the way i needed. </p>
<p>Only thing i modified was adding bottom border to table header, so that in repeating pages also bottom border for the header is visible.</p>
<p> </p>
<p>Thank You very much for the timely help and support.</p>