Sophie

Sophie

distrib > Mandriva > 2008.1 > i586 > by-pkgid > 927a1532fb070c51449654bb68b5bde2 > files > 456

itext-manual-2.0.8-0.0.2mdv2008.1.i586.rpm

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html><head><META http-equiv="Content-Type" content="text/html; charset=UTF-8"><title>iText Tutorial: Extended table cell support</title><meta name="Description" content="Using the extended table cell support available in the RTF package."><meta name="Keywords" content="PDF, JAVA, iText, RTF, examples, Lowagie, Bruno"><link rel="stylesheet" href="./../../../style.css" type="text/css"></head><body><a name="top" class="logo" href="http://www.lowagie.com/iText"><img src="http://www.lowagie.com/iText/images/logo.gif" border="0" alt="iText"></a><h1>Tutorial: iText by Example</h1><h2>Extended table cell support</h2><div id="content"><div id="sidebar"><a class="toc" href="./../../../index.html#rtf_extensions_table">
							Table of Contents
						</a><div align="Center" class="small">Best viewed with:<br><script type="text/javascript"><!--
google_ad_client = "pub-0340380473790570";
google_ad_width = 180;
google_ad_height = 60;
google_ad_format = "180x60_as_rimg";
google_cpa_choice = "CAAQyaj8zwEaCIwcWMzeycafKMu293M";
//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script></div><div class="sidetitle">Sections:</div><ul><li><a href="#extendedhf">Extended table cell support</a></li></ul><br><br><div class="sidetitle">Examples:</div><div class="example"><a class="source" href="http://itext.ugent.be/library/com/lowagie/examples/rtf/extensions/table/ExtendedTableCell.java">ExtendedTableCell</a><br><div class="description">Generates an RTF document with a Table with specific borders per cell</div><div class="small">Output:</div><ul><li><a href="http://itext.ugent.be/library/com/lowagie/examples/rtf/extensions/table/ExtendedTableCell.rtf">ExtendedTableCell.rtf</a></li></ul></div><div class="example"><div class="small">ANT script (all examples):</div><ul><li><a href="./../../../rtf/extensions/table/build.xml">
					build.xml
				</a></li></ul></div></div><div id="main"><a name="extendedhf"></a><div class="title">Extended table cell support:</div><div xmlns="http://www.w3.org/1999/xhtml" xmlns:site="http://www.lowagie.com/iText/site">
		  Similarly to the situation with headers and footers it is not possible to create
		  advanced cell borders using page events in the RTF package.<br><br>
		  
		  To overcome this the <a xmlns="" href="http://itext.ugent.be/library/api/com/lowagie/text/rtf/table/RtfCell.html">RtfCell</a>
		  class exists, which makes it possible to specify advanced borders. To do this
		  create a <a href="http://itext.ugent.be/library/api/com/lowagie/text/rtf/table/RtfBorderGroup.html">RtfBorderGroup</a>
		  and specify the style for that <a href="http://itext.ugent.be/library/api/com/lowagie/text/rtf/table/RtfBorderGroup.html">RtfBorderGroup</a>,
		  then apply it to the <a href="http://itext.ugent.be/library/api/com/lowagie/text/rtf/table/RtfCell.html">RtfCell</a>.
		  
		  <pre xmlns="http://www.w3.org/1999/xhtml" class="commandline">
// Create a simple RtfCell with a dotted border.
RtfCell cellDotted = new RtfCell("Dotted border");
cellDotted.setBorders(new RtfBorderGroup(Rectangle.BOX,
        RtfBorder.BORDER_DOTTED, 1, new Color(0, 0, 0)));
		  </pre>
		  
		  You can also create <a xmlns="" href="http://itext.ugent.be/library/api/com/lowagie/text/rtf/table/RtfCell.html">RtfCell</a>s
		  that have a border on only one side
		  
		  <pre xmlns="http://www.w3.org/1999/xhtml" class="commandline">
// Create a simple RtfCell that only has a border on the bottom side.
RtfCell bottomBorder = new RtfCell("Bottom border");
bottomBorder.setBorders(new RtfBorderGroup(Rectangle.BOTTOM,
        RtfBorder.BORDER_SINGLE, 2, new Color(255, 0, 0)));
		  </pre>
		  
		  or that have different borders on different sides of the <a xmlns="" href="http://itext.ugent.be/library/api/com/lowagie/text/rtf/table/RtfCell.html">RtfCell</a>.

          <pre xmlns="http://www.w3.org/1999/xhtml" class="commandline">
// Create a simple RtfCell that has different borders
// on the left and bottom sides.
RtfCell mixedBorder = new RtfCell("Mixed border");
RtfBorderGroup mixedBorders = new RtfBorderGroup();
mixedBorders.addBorder(Rectangle.RIGHT,
        RtfBorder.BORDER_DOUBLE_WAVY, 2, Color.GREEN);
mixedBorders.addBorder(Rectangle.BOTTOM,
        RtfBorder.BORDER_DOT_DASH, 1, Color.BLUE);
mixedBorder.setBorders(mixedBorders);
          </pre>
          
          Finally if you want a <a xmlns="" href="http://itext.ugent.be/library/api/com/lowagie/text/rtf/table/RtfCell.html">RtfCell</a>
          without any borders simply set an empty <a href="http://itext.ugent.be/library/api/com/lowagie/text/rtf/table/RtfBorderGroup.html">RtfBorderGroup</a>.
          
          <pre xmlns="http://www.w3.org/1999/xhtml" class="commandline">
// Create a simple RtfCell with no border.
RtfCell cellNoBorder = new RtfCell("No border");
cellNoBorder.setBorders(new RtfBorderGroup());
          </pre>
          
          For a full list of the border styles that are available, please check the javadoc
          for the <a xmlns="" href="http://itext.ugent.be/library/api/com/lowagie/text/rtf/table/RtfBorder.html">RtfBorder</a> class.
		  <div id="example">
					Example: java
					<a href="http://itext.ugent.be/library/com/lowagie/examples/rtf/extensions/table/ExtendedTableCell.java">
						com.lowagie.examples.rtf.extensions.table.ExtendedTableCell</a><br>Generates an RTF document with a Table with specific borders per cell: see
						 <a href="http://itext.ugent.be/library/com/lowagie/examples/rtf/extensions/table/ExtendedTableCell.rtf">ExtendedTableCell.rtf</a><br></div>
		</div><a class="top" href="#top">Go to top of the page</a><div id="footer" xmlns="http://www.w3.org/1999/xhtml">
			Page Updated: 2006/10/05 21:25:54
			Copyright &copy; 1999-2005
			Mark Hall<br><a href="http://www.lowagie.com/iText/">iText</a> is a Free Java-Pdf library by Bruno Lowagie and Paulo Soares.
		</div></div></div><div class="commercial"><br><script type="text/javascript"><!--
google_ad_client = "pub-0340380473790570";
google_ad_width = 120;
google_ad_height = 600;
google_ad_format = "120x600_as";
google_ad_channel ="";
google_ad_type = "text_image";
google_color_border = "FFFFFF";
google_color_bg = "FFFFFF";
google_color_link = "1B09BD";
google_color_url = "100670";
google_color_text = "707070";
//--></script><script type="text/javascript" src="http://pagead2.googlesyndication.com/pagead/show_ads.js"></script><br><br><div class="subtitle">Amazon books:</div><script type="text/javascript"><!--
document.write('<iframe src="http://rcm.amazon.com/e/cm?t=itisacatalofwebp&o=1&p=8&l=as1&asins=0596004753&fc1=000000&lc1=0000ff&bc1=&lt1=_blank&IS2=1&bg1=ffffff&f=ifr" width="120" height="240" scrolling="no" marginwidth="0" marginheight="0" frameborder="0" align="Center"></iframe>');
//--></script><a xmlns="" href="http://www.amazon.co.uk/exec/obidos/ASIN/0596004753/catloogjecom-21" class="amazonlinks">
			amazon.co.uk-link
		</a><br><br><script type="text/javascript"><!--
document.write('<iframe src="http://rcm.amazon.com/e/cm?t=itisacatalofwebp&o=1&p=10&l=st1&mode=books&search=JAVA&=1&fc1=&lc1=&lt1=&bg1=&f=ifr" width="120" height="460" border="0" frameborder="0" style="border:none;" scrolling="no" marginwidth="0" marginheight="0"></iframe>');
//--></script><br><script type="text/javascript"><!--
document.write('<iframe src="http://rcm.amazon.com/e/cm?t=itisacatalofwebp&o=1&p=10&l=st1&mode=books&search=RTF&=1&fc1=&lc1=&lt1=&bg1=&f=ifr" width="120" height="460" border="0" frameborder="0" style="border:none;" scrolling="no" marginwidth="0" marginheight="0"></iframe>');
//--></script><br></div></body></html>