<-- Previous || Up || Next -->

Wrap Blocks Function
Formats Justifies Class

Public Function WrapBlocks( _
      ByVal vBlock As Variant _
    , ByVal vWidth As Variant _
    , Optional ByVal vBlockSeparator As Variant _
    ) As Variant

Rearranges long lines of text so that a specific range of columns from all lines are first, then the next range of columns from all lines, etc.
Used to view a very wide page of a text-based report the way that Excel separates the columns of very wide Worksheets onto separate printed pages.

Examples:
    ? WrapBlocks("1234567890" + vbCrLf + "ABCDEFGHIJ",4)
    1234
    ABCD
    5678
    EFGH
    90
    IJ
    ? WrapBlocks(IllustrateCodesBelow(CryptoAlphabet), 40)
             A   B   C   D   E   F   G   H
    Dec  32  65  66  67  68  69  70  71  72
    Hex  20  41  42  43  44  45  46  47  48
    Oct  40 101 102 103 104 105 106 107 110
     I   J   K   L   M   N   O   P   Q   R
     73  74  75  76  77  78  79  80  81  82
     49  4A  4B  4C  4D  4E  4F  50  51  52
    111 112 113 114 115 116 117 120 121 122
     S   T   U   V   W   X   Y   Z
     83  84  85  86  87  88  89  90
     53  54  55  56  57  58  59  5A
    123 124 125 126 127 130 131 132
Note: To produce a nice table of the default character set, try:
     ? WrapBlocks(IllustrateCodesBelow(EveryCharacter), 60)
See also:
    WrapText Function
    AddCrLfEveryNCharacters Function
vBlock: String containing several lines of text that are to be rearranged. The individual lines of text in string vBlock can be separated by either line feed or carriage return line feed strings. Function returns Null if vBlock is Null or cannot be fixed up to a String.

vWidth: The maximum width of the lines in the result string. The portion of each line which is wider than this size will be placed after the beginning portion of all lines. vWidth defaults to 60 (sixty) if it is Null or cannot be fixed up to a number.

Function sets vWidth to 1 (one) if it is less than one.

vBlockSeparator: The string which will separate the blocks of text in the result string. vBlockSeparator defaults to carriage return and new line characters if it is missing or Null or cannot be fixed up to a String. If there are no lines of text in vBlock longer than vWidth, then the result string will consist of a single block of text and no vSeparator string will be added.

Copyright 1996-1999 Entisoft
Entisoft Tools is a trademark of Entisoft.