4 Replies Latest reply on May 28, 2014 12:19 PM by KylePutzier

    Aligning columns and variable width fonts.

    KylePutzier

      I am using a simple Custom Dialog to quickly display various record totals. The problem is that the dialog uses a variable width font that I cannot control. It makes using the text formatting tools ineffective as the number of padding spaces varies.

      Is there a way of padding the dollar figures so that they right justify more evenly as thier Lenght() changes?

      My first thought is something like PaddingSpaces = (15 - Lenght(DollarValue)) * 1.5

       

      Sample of existing output below.

       

       

      Number of Sales Orders: 19

       

      Unbilled: $ 47,399.35

      Partially Billed: $ 56,560.16

      _________________________________

      Active Sales: $ 103,959.51

      Inventory Orders: $ 0.00

      _________________________________

      All Sales: $ 103,959.51

       

       

       

      Desired output like this.

       

       

      Number of Sales Orders: 19

       

      Unbilled: $ 47,399.35

      Partially Billed: $ 56,560.16

      __________________________________

      Active Sales: $ 103,959.51

      Inventory Orders: $ 0.00

      __________________________________

      All Sales: $ 103,959.51

       

       

      ( I even had to fiddle with this to attempt to show an example. Your view may still not right align)

        • 1. Re: Aligning columns and variable width fonts.
          mikebeargie

          What about concatenating in some tab characters in?

           

          It would not meet your need to right justify the right side of your text lines, but it could left-align the right column of your reference file, and look neater than just inserting spacing.

           

          You can use Char(9) to render a tab.

          • 2. Re: Aligning columns and variable width fonts.
            KylePutzier

            Turns out that my first though works pretty well, at least for OS X.

             

            Below is the basic calc I'm using.

            The 1.8 constant right aligns the numbers pretty well from $0.00 though $9,999,999

             

            "MyTitleHere:             " &  Right("                                        "; (18-Length(MyDollarValue))*1.8) & MyDollarValue

            • 3. Re: Aligning columns and variable width fonts.
              Stephen Huston

              If you really need this to be precise, you can build your own layout to use as a "dialog" with text objects that use custom tab and alignment settings, then script opening to that layout in a new (modal) window. (Be sure to include a close or other control button to let the user get back out of it when done.)

               

              This gives you absolute layout control of your content and affords other options by using buttons for any variety of user actions after viewing your "dialog" layout.

               

              You can even employ global fields on this layout which your script sets for you, giving the layout the flexibility to be used for multiple report types.

              • 4. Re: Aligning columns and variable width fonts.
                KylePutzier

                It doesn't need to be that precise. I have a layout that mimics a standard dialog box where I have more control but it would be a fair amount of work to change over all of the simple 1 line button dialogs I have now. As you can see in the image below, it lines up pretty well.

                I thank you both for your ideas, though.

                 

                Screen Shot 2014-05-28 at 12.07.10 PM.png