How to bottom-align Address Block?

How do you create a box where the address grows up instead of down for variable lines? I need the barcode and last line to stay positioned in the same spot for mailings.

I have tried, with no success, to select a position box and change the bottom position to a set number from the bottom of the page.

There may be other ways to do this, but I’d think a script would be the easiest.

Assuming you have either a 3 line address or a 4 line address, you just need to make an if statement that checks if that last line is empty or not. If you do something like the pseudo code below, your bottom line will always be in the same position since you’re padding the top with blanks.

If address4 is empty then

addressBlock =
address1
address2
address3

Else

addressBlock = address1
address2
address3
address4

edit: formatting

Try this:

  • Insert a table (1 body row, 1 column).
  • Right mouse click the table cell and choose Cell… form the contextual menu.
  • Set the height for the cell, e.g. 1in.
  • CHange the Vertical Align property to bottom.

Regarding AlbertsN’s suggestion:

Wrap each address line a paragraph <p>. The layout engine will automatically collapse empty paragraphs. You may want to set the margin-bottom property to 0 (zero) to remove the extra spacing below the lines (e.g. via a stylesheet rule). Checkout the following sample. I’ve assigend an ID to my table (or table-cell) and changed the margin for the paragraphs in that element:

#my-address-block p {
    margin-bottom: 0;
}

Alternatively use a Text Script as described in the following How To:

Hope this helps,

Erik

If you are using absolutely positioned box for the address, which should be default on master page, you could try this:

<div anchor="page_media_0"
style="position: absolute; overflow: hidden; -moz-box-sizing: border-box; width: 200px; height: 200px; top: 105.967px; left: 86px;" offset-x="86" offset-y="105.967"> 
    <!-- this is absolutely positioned div created with "Insert Positioned Box" button -->
    <div id="addr_bottom" style="overflow: hidden; height: auto; position: absolute; bottom: 0; width: 180px;">
    <!-- this div sticking to the bottom of the outer div -->
    @ADDRESS@
    </div>
</div>

You can use the “flex” CSS properties. Assuming you have a Text Script named “@AddressBlock@”, this code will work to create a bottom-aligned Address Block.

<div style="display: flex; height: 209px; background-color: rgb(128, 128, 128); width: 221px;">
    <p style="display: inline-block; align-self: flex-end;">
        @AddressBlock@ 
    </p>
</div>
1 Like

In case anybody is still looking for this in 2021, Erik’s solution is the only one that works. Example for address block aligned for the use with a C5 windowed envelope as follows:

<table id=“address-block” class=“address-block” cellpadding=“0” anchor=“page_media_0” cellspacing=“0” style=“width: 100mm; height: 45mm; position: relative; margin: 0px;” offset-x=“0” offset-y=“0”>
    <tbody>
        <tr>
            <td style=“vertical-align: bottom;”>
                @AddressBlock@
            </td>
        </tr>
    </tbody>
</table>

I thought support for flex has been added in one of the previous versions, but apparently not.

1 Like

I just tested the flex method; it still works just fine.

What version are you running?

PlanetPress Connect 2021.1

I do it as detailed here

as I found the copy fitting not working