Hi all,
I have a table in my RTF document.
I am creating the table in landscape.But still the table width gets restricted to a fixed size.
I am setting the table width based on the columns....
But still it does not get set.....
Is there any mistake in the following code??
I have another question.....is it possible that based on the column text the column width should get fixed....
Please let me know.....if u have a solution for this problem.....
Table tabfile = new Table(TableColumns);
tabfile.setBorderWidth(2);
tabfile.setPadding(9f);
tabfile.setBorderColor(new Color(0xC0, 0xC0, 0xC0));
tabfile.setCellpadding(1);
tabfile.setCellspacing(1);
tabfile.setAlignment(Element.ALIGN_LEFT);
// Headtable.setWidth(150);
if(TableColumns==1)
{
tabfile.setWidths(new int[]{50});
}
else if(TableColumns==2)
{
tabfile.setWidths(new int[]{50,50});
}
else if(TableColumns==3)
{
tabfile.setWidths(new int[]{50,50,50});
}
else if(TableColumns==4)
{
tabfile.setWidths(new int[]{50,50,50,50});
}
else if(TableColumns==5)
{
tabfile.setWidths(new int[]{50,50,50,50,50});
}
else if(TableColumns==6)
{
tabfile.setWidths(new int[]{50,50,50,50,50,50});
}
else if(TableColumns==7)
{
tabfile.setWidths(new int[]{50,50,50,50,50,50,50});
}
tabfile.setBorderWidth(2);
tabfile.setBorderColor(Color.lightGray);
tabfile.setBorderWidth(2);
tabfile.setPadding(9f);
tabfile.setBorderColor(new Color(0xC0, 0xC0, 0xC0));
tabfile.setCellpadding(1);
tabfile.setCellspacing(1);
tabfile.setAlignment(Element.ALIGN_LEFT);
// Headtable.setWidth(150);
if(TableColumns==1)
{
tabfile.setWidths(new int[]{50});
}
else if(TableColumns==2)
{
tabfile.setWidths(new int[]{50,50});
}
else if(TableColumns==3)
{
tabfile.setWidths(new int[]{50,50,50});
}
else if(TableColumns==4)
{
tabfile.setWidths(new int[]{50,50,50,50});
}
else if(TableColumns==5)
{
tabfile.setWidths(new int[]{50,50,50,50,50});
}
else if(TableColumns==6)
{
tabfile.setWidths(new int[]{50,50,50,50,50,50});
}
else if(TableColumns==7)
{
tabfile.setWidths(new int[]{50,50,50,50,50,50,50});
}
tabfile.setBorderWidth(2);
tabfile.setBorderColor(Color.lightGray);
Thanks,
Sujatha
Yahoo! for Good
Click here to donate to the Hurricane Katrina relief effort.
