You need to sign in to do that
Don't have an account?
kishore64
Hw to display columns horizontally in a table
Hi buddies,
I was not able to display records in horizontally.
Ex : In a table am retrieving phone,email from contact. Now i want to show phone,Email in horizontally.
Normally we can show them in columns, but my client needs thus to be display in horizontally.
Phone 98451212312 9876789989 9888999999
Email test@test.com test1@tes.com test2@test.com
Waiting for your respnse buddies.
I was not able to display records in horizontally.
Ex : In a table am retrieving phone,email from contact. Now i want to show phone,Email in horizontally.
Normally we can show them in columns, but my client needs thus to be display in horizontally.
Phone 98451212312 9876789989 9888999999
Email test@test.com test1@tes.com test2@test.com
Waiting for your respnse buddies.
http://bobbuzzard.blogspot.co.uk/2010/09/rotating-visualforce-table.html
This solution was very good but i was not able to pass values in first column such that
Account Name, BillingStreet, BillingCity, BillingPostalCode. With this we can understand first row is for name and like that.
Can you help me out, plz.
Its resolved and everything coming in a good manner but in pdf these are not coming.
Withour pdf it is shwoing correctly what exactly we needed but when i save it as pdf it throws error like :
PDF generation failed. Check the page markup is valid.
Can you check it once.
"PDF generation failed. Check the page markup is valid." :This type of errors occur when we use normal visualforce page tags like <apex:form> and so on.so, once remove this type of tags and use basic html tags and try.you will get what you want.
if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Here i am using HTML tags only. I am not using any Visualforce Page Tags then how can rectify that error .
Help me out .
Can u post the full code that you used so that I can go through that code and find where the issue is.once I resoved this issue by using html tags
<apex:page controller="cls_printpage1" sidebar="false" showHeader="false" renderAs="pdf">
<table class="list" border="1" cellpadding="0" cellspacing="0">
<apex:repeat value="{!rowWrappers}" var="row">
<tr>
<apex:repeat value="{!row.labels}" var="label">
<td>
<b>{!label}</b>
</td>
</apex:repeat>
<apex:repeat value="{!row.values}" var="value">
<td>
{!value}
</td>
</apex:repeat>
</tr>
</apex:repeat>
</table>
</apex:page>
This is controller code:
public class cls_printpage1 {
// retrieves the list of accounts backing the page
Public List<Account> accs;
public List<Account> getAccounts()
{
if (null==accs)
{
accs=[select id, Name, BillingStreet, BillingCity, BillingPostalCode from Account
where BillingCity != null and BillingPostalCode!=null limit 3];
}
return accs;
}
// retrieves the list of row wrappers
List<RowWrapper> rows;
public List<RowWrapper> getRowWrappers()
{
if (null==rows)
{
rows=new List<RowWrapper>();
// create a row for each field - there are 4 of these, Name, Street, City and PostCode
for (Integer idx=0; idx<5; idx++)
{
rows.add(new RowWrapper());
}
// iterate the accounts and populate the rows
for (Integer idx=0; idx<getAccounts().size(); idx++)
{
// rows[0].addValue('Name');
rows[0].addValue(getAccounts()[idx].Name);
// rows[1].addValue('BillingStreet');
rows[1].addValue(getAccounts()[idx].BillingStreet);
// rows[2].addValue('BillingCity');
rows[2].addValue(getAccounts()[idx].BillingCity);
// rows[3].addValue('BillingPostalCode');
rows[3].addValue(getAccounts()[idx].BillingPostalCode);
}
rows[0].addLabels('Name');
rows[1].addLabels('BillingStreet');
rows[2].addLabels('BillingCity');
rows[3].addLabels('Billling PostalCode');
}
return rows;
}
public class RowWrapper
{
// the values (cells) making up this row
public List<String> values {get; set;}
public List<String> labels {get; set;}
// constructor
public RowWrapper()
{
values=new List<String>();
labels=new List<String>();
}
// append a value (cell) to the row
public void addValue(String value)
{
values.add(value);
}
//add all labels to column
public void addLabels(String value){
labels.add(value);
}
}
}
Check this one and let me know what is the issue where i need to modify it please help out......
Here is the modfied vf code.Its working fine now.
<apex:page controller="cls_printpage1" sidebar="false" showHeader="false" renderAs="pdf">
<table class="list" border="1" cellpadding="0" cellspacing="0">
<apex:repeat value="{!rowWrappers}" var="row">
<apex:repeat value="{!row.labels}" var="label">
<tr>
<td>
<b>{!label}</b>
</td>
<apex:repeat value="{!row.values}" var="value">
<td>
{!value}
</td>
</apex:repeat>
</tr>
</apex:repeat>
</apex:repeat>
</table>
</apex:page>
if this provides you with useful information and if this is what you where looking for then please mark it as a solution for other benefits.
Thanks a lot. Now it's working fine .......
here the requuirement is the table should be lke as below
Size 4 x 5 2 x 3 5 x 6
Guage 120 60 120
But ourr code will display like this
Size 4 x 2 x 5 x
5 3 6
Guage 120 60 120
<table class="list" border="1" cellpadding="0" cellspacing="0">
<apex:repeat value="{!rowWrappers}" var="row">
<apex:repeat value="{!row.labels}" var="label">
<tr>
<td style="padding:0 15px 0 15px;">
<b>{!label}</b>
</td>
<apex:repeat value="{!row.values}" var="value">
<td style="padding:0 30px 0 30px;" align="left">
{!value}
</td>
</apex:repeat>
</tr>
</apex:repeat>
</apex:repeat>
</table>
how can i chage this format to that format please help me out .....
abcd,billingcity,address
efgh,billingcity,address
you want to display in table like below
abcd efgh
billingcity billingcity
address address
is this what you are looking for?
I want to display like below
Size 4 x 5 2 x 3 5 x 6
Guage 120 60 120
But my code will display like this
Size 4 x 2 x 5 x
5 3 6
Guage 120 60 120
so, where i need to modify it ?
I have no clarity how you are getting size values.If possible post sample code.I will go through it and resolve.I think while adding size values to wrapper class,take size value in string and add.