0

I'm setting up this table, but the fields that will compose the table are dynamic, and their sizes vary, does anyone have any idea how I can make the tables standardized? Also, the bottom element is overlapping my table... I'm using
for now to solve this, but if anyone has another suggestion I'd appreciate it

CSS:

.TableTam3{
font-size: 10pt;
text-align: left;
width:30%;
float:left;
border: 1px solid;
display: block;
margin-left: auto;}

VFP:

<apex:page showHeader="false" sidebar="false" controller="DadosNotaPromissoriaController" standardStylesheets="false" applyHtmlTag="false" applyBodyTag="false" renderAs="pdf">


 <apex:repeat value="{!Avalist}" var="item" rendered="true" > 
                    <table class="TableTam3"  >
                        <tbody>
                            <tr>
                                <td>AVALISTA:</td>
                            </tr>   
                            <tr>
                                <td>{!item.contact.Name}</td>
                            </tr> 
                            <tr>
                                <td>{!item.contact.CPF__c}</td>
                            </tr>
                            <tr>
                                <td>END.:{!item.contact.MailingStreet},CEP: {!item.contact.MailingPostalCode},{!item.contact.MailingCity}-{!item.contact.MailingState}</td>
                            </tr> 
                            <apex:outputText rendered="{!display[item.Id]}">
                                <tr><td>Ass: {!item.contact.Procurador_do_Contato__r.Name}</td></tr>
                                <tr><td>CPF: {!item.contact.Procurador_do_Contato__r.CPF__c}</td></tr>
                            </apex:outputText>  
                             
                        </tbody>
                    </table>
                </apex:repeat>

It is currently being generated like this: enter image description here

1 Answer 1

2

You're putting tables next to each other, and tables don't like to take up more space than necessary. You'll want to make a single table that has all the relevant detail in individual cells.

<table class="TableTam3">
  <tbody>
    <tr>
        <apex:repeat value="{!Avalist}" var="item" rendered="true">
        <td width="*">
            AVALISTA:<br>
            {!item.contact.Name}<br>
            {!item.contact.CPF__c}<br>
          END.:{!item.contact.MailingStreet},CEP:
          {!item.contact.MailingPostalCode},{!item.contact.MailingCity}-{!item.contact.MailingState}<br>
      <apex:outputText rendered="{!display[item.Id]}">
          Ass: {!item.contact.Procurador_do_Contato__r.Name}<br>
          CPF: {!item.contact.Procurador_do_Contato__r.CPF__c}
      </apex:outputText>
        </td>
    </apex:repeat>
    </tr>
  </tbody>
</table>

Other arrangements are possible, but this design is closest your current intent.

4
  • Thank you! It hadn't occurred to me to put everything inside the <tr>, so the repeat generates more columns, thank you @sfdcfox
    – Souza
    Commented Mar 13, 2022 at 18:50
  • How could I make it somehow possible to identify that the page width is over and that the next columns should be placed below?@sfdcfox
    – Souza
    Commented Mar 14, 2022 at 20:33
  • 1
    @DersonBarboza I think the closest you can get to that approximation is apex:panelGrid. This would allow you to create the table dynamically. However, you still have to specify a width for each column, so you may need to experiment. CSS support in PDF mode is very minimal.
    – sfdcfox
    Commented Mar 15, 2022 at 1:56
  • Thank you @sfdcfox
    – Souza
    Commented Mar 15, 2022 at 11:11

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .