Hi again ,
I think , the code I sent earlier was way too big and
confusing for any one to look. I have removed all unnecessary things from it and
made it precise.
Can any one please have a look at following
request.
Thanks in advance,
Madhur Taneja
*********************************
Hi,
I am using itext to print a (Grid) table in
HTML format. But I could not justify the contents in
the cells with ALIGN_RIGHT as horizontal alignment in the cells.
the cells with ALIGN_RIGHT as horizontal alignment in the cells.
I am using Table class instead of PdfPTable class as I want the output in HTML format.
Can I use PdfP class
to produce HTML format instead of Table Format.
Please find below the part of code (method being
called) which is being used currently for the purpose.
Could anybody tell me what changes do i need to make in following method to
right justify the content in
cell ?
Thanks
& Regards,
Madhur Taneja
Madhur Taneja
****************************************************************************************************
try
{
int rowCount = grid.getRowCount();
int headerCount =
grid.getHeaderCount();
boolean hasChildren =
grid.hasChildren();
if ( rowCount > 0
)
{
// - grid -
float tablewidth=tableProperty.pageSize_.width()- MARGIN_LEFT - MARGIN_RIGHT;
float tableheight=tableProperty.pageSize_.height()- MARGIN_TOP - MARGIN_BOTTOM ;
{
// - grid -
float tablewidth=tableProperty.pageSize_.width()- MARGIN_LEFT - MARGIN_RIGHT;
float tableheight=tableProperty.pageSize_.height()- MARGIN_TOP - MARGIN_BOTTOM ;
table = new Table( headerCount
);
table.setWidths(tableProperty.widths_);
table.setBorderColor( COLOR_BORDER );
table.setBorderWidth( 1 );
table.setPadding( PADDING );
table.setBackgroundColor( Color.white );
table.setWidths(tableProperty.widths_);
table.setBorderColor( COLOR_BORDER );
table.setBorderWidth( 1 );
table.setPadding( PADDING );
table.setBackgroundColor( Color.white );
for( int j=0; j<
grid.getGroupCount(); j++ )
{
{
table.setBorder(
Rectangle.TOP | Rectangle.LEFT | Rectangle.RIGHT );
if (
grid.getGroupId(j)!=null )
{
table.addCell( new Phrase(capitalize( grid.getGroupId(j) ), headerFont ) );
}
else
{
table.addCell("");
}
}
}
{
table.addCell( new Phrase(capitalize( grid.getGroupId(j) ), headerFont ) );
}
else
{
table.addCell("");
}
}
}
// - data
-
table.setBorderWidth( 1 );
table.setBorderColor( COLOR_BORDER );
table.setBorderWidth( 1 );
table.setBorderColor( COLOR_BORDER );
for ( int i = 0; i < rowCount;
i++ )
{
// - rows -
for ( int j = 0; j < headerCount; j++ )
{
Object value = grid.getValue( i, j );
{
// - rows -
for ( int j = 0; j < headerCount; j++ )
{
Object value = grid.getValue( i, j );
// if this is the first
column.
if ( j == 0 )
{
table.setBorder( Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM );
table.setBackgroundColor( Color.WHITE );
}
else
{
table.setBackgroundColor( getFillBackground( grid.getValue( i, "UI_KEY_DISPLAY_ATTRIBUTE" ) ) );
table.setBorder( Rectangle.RIGHT | Rectangle.BOTTOM );
if ( j == 0 )
{
table.setBorder( Rectangle.LEFT | Rectangle.RIGHT | Rectangle.BOTTOM );
table.setBackgroundColor( Color.WHITE );
}
else
{
table.setBackgroundColor( getFillBackground( grid.getValue( i, "UI_KEY_DISPLAY_ATTRIBUTE" ) ) );
table.setBorder( Rectangle.RIGHT | Rectangle.BOTTOM );
}
}
catch( Exception exception )
{
ReportAppLog.logStackTrace(ReportAppLog.ERROR, exception);
}
}
------------------------------------------------------------------------- Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________ iText-questions mailing list iText-questions@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/itext-questions