Hi Bruno,

Thanks for your quick response. I have some more issues.
 
1. While define the XML tags for Table & Cells.  I couldn't able to set the Border color. My XML coding is
 
<!-- table-->
 <tag name="table" alias="TABLE_NOBORDER_2COLS_25PCT">
  <attribute name="border" value="true" />
  <attribute name="align" value="Left" />
  <attribute name="width" value="25%" />
  <attribute name="widths" value="50;50" />
  <attribute name="tablefitspage" value="false" />
  <attribute name="cellpadding" value="1" />
  <attribute name="cellspacing" value="0" />
  <attribute name="columns" value="2" />
  <attribute name="offset" value="0" />
  <attribute name="bordercolor" value="#000000"/>
  <attribute name="backgroundcolor" value="#FFFFFF"/>
 </tag>
 
<!-- cell -->
 <tag name="cell" alias="TABLE_CELL_LEFT_MIDDLE">
  <attribute name="border" value="true" />
  <attribute name="verticalalign" value="Left" />
  <attribute name="horizontalalign" value="Middle" />
  <attribute name="cellsfitpage" value="false" />
  <attribute name="bordercolor" value="#000000"/>
  <attribute name="borderwidth" value="5"/>
  <attribute name="backgroundcolor" value="#FFFFFF"/>
 </tag>
Can you tell me what is wrong in this.
 
2. This is related to No.4 in the previous mail. I have tagmap.xml file, which has the Tag mapping follows.
 
<!-- tagmap.xml-->
<tagmap>
 <tag name="itext" alias="ROOT" />
 <tag name="newpage" alias="NEW_PAGE" />
 <tag name="newline" alias="NEW_LINE" />
 <tag name="paragraph" alias="PARA_LEFT_BOLD_BLACK_10">
  <attribute name="leading" value="11" />
  <attribute name="size" value="10" />
  <attribute name="style" value="bold" />
 </tag>
 ...
 
</tagmap>
 
Another file values.xml which used tagmap.xml
<!- -values.xml -->
<ROOT>
<PARA_LEFT_BOLD_BLACK_10>The sum assured is #SUM_ASSURED# </PARA_LEFT_BOLD_BLACK_10>
</ROOT>
 
Here I want to replace the #SUM_ASSURED# to $ 86456.80.
Can you tell me is it possible using XmlPeer?
 
My Code is ...
 
SAXParser parser = SAXParserFactory.newInstance().newSAXParser();
parser.parse("values.xml",
  new SISAXmyHandler(document, new TagMap("tagmap.xml")));
 
Can you help me proceed further?
 
Thanks & Regards
Sampath

Bruno <[EMAIL PROTECTED]> wrote:
Quoting D S S Sampath Kumar <[EMAIL PROTECTED]>:

> 1.The Chapter is always starts in the new Page. Is it possible to set to
> start with newline instead of new page (like I have Paragraph, which occupies
> half of the page, then I want to add the Chapter immediately after the
> Paragraph (very next line) Is possible? otherwise guide me to do this other
> way.

Not that I know of.

> 2. Current version I couldn't able to add any element after adding the
> elements from XML it throws com.lowagie.text.DocumentException: The document
> has been closed. You can't add any Elements.

Override the Handler class so that the document isn't closed
while parsing. Look at the way it is done in the Chapter 12 example:
http://www.lowagie.com/iText/examples/Chap1201.java
if (isDocumentRoot(peer.getTag())) {
return;
}

> 3. How to define the XML tags for Table & Cells.
<table>
  <row>
    <cell></cell>
    ...
    <cell></cell>
  </row>
  ...

  <row>
    <cell></cell>
    ...
    <cell></cell>
  </row>
</table>


See the constructors of Table and Cell that take a Properties object
as parameter to see what attributes are possible.

> 4. Is it possible to mix XML & the values we get from Application, like
> declare some variables in the XML file & those values should be replaced by
> the values from the application?
>
> Example: -
>
> Values in XML will be: "the Sum Assuered is <SUM_ASSUERD>
>
> This <SUM_ASSUERD> should be replaced by the values from application at
> runtime.

It should be and yes it's possible:
http://www.lowagie.com/iText/tutorial/ch07.html#datamerging
http://www.lowagie.com/iText/examples/Chap0705.java
Make an XmlPeer and set the content:
XmlPeer peer = new XmlPeer(ElementTags.CHUNK, "SUM_ASSURED");
peer.setContent("1.000 $");
Add this peer to the tagmap.

br,
Bruno


Do you Yahoo!?
SBC Yahoo! DSL - Now only $29.95 per month!

Reply via email to