# Code a code page

### Pyth, 60 bytes

```
K+*"+---"hJ16\+Vm++"| "j" | "d" |"+]+]d.HMJ.e+.Hk.[bdJczJNK
```

The leading newline is significant.

Try it here.

## Python 3.5, ~~326~~ 355 bytes:

(*+29 bytes since if the length of the last row is not a multiple of 16, unused cells should be left empty (although, in my opinion, it looks much better if those empty cells are just not even shown)*)

```
def f(r):o=' 0123456789ABCDEF';r=[r[0+i:16+i]for i in range(0,len(r),16)];print('+---'*17+'+\n|',end='');[print(' {} |'.format(h),end='')for h in o];print(''.join([str(e+' | ')if e.isdigit()or e.isalpha()else str(e)for e in''.join([str('\n'+'+---'*17+'+\n| '+x[0]+x[1])for x in zip(o[1::1],r)])]),end='');print(' |'+' |'*(15-len(r[-1]))+'\n'+'+---'*17+'+')
```

Works like a charm!

**Sample Inputs and Outputs:**

```
Input: 'hopper'
Output:
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | h | o | p | p | e | r | | | | | | | | | | |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Input: 'honkhonkhonkhonkhonk'
Output:
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | h | o | n | k | h | o | n | k | h | o | n | k | h | o | n | k |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 1 | h | o | n | k | | | | | | | | | | | | |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
Input: 'hi'
Output:
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | h | i | | | | | | | | | | | | | | |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
```

I hope this is okay.

Also, here is another version I created for this challenge, which, although is an invalid candidate since it does **not** print out extra empty cells for the last row if its length is not a multiple 16, in my opinion outputs a much better looking page than the one required by OP, mainly because it does not even show empty cells if the last row is not a multiple of 16, but instead just shows filled cells, and that's it:

```
def f2(r):o=' 0123456789ABCDEF';r=[r[0+i:16+i]for i in range(0,len(r),16)];print('+---'*17+'+\n|',end='');[print(' {} |'.format(h),end='')for h in o];print(''.join([str(e+' | ')if e.isdigit()or e.isalpha()else str(e)for e in''.join([str('\n'+'+---'*17+'+\n| '+x[0]+x[1])for x in zip(o[1::1],r)])]));print('+---'*(len(r[-1])+1)+'+')
```

Here is a sample input and output for the inapplicable code above:

```
Input: 'ggreuuobgugoubgoubguorgoruguor'
Output:
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | A | B | C | D | E | F |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 0 | g | g | r | e | u | u | o | b | g | u | g | o | u | b | g | o |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
| 1 | u | b | g | u | o | r | g | o | r | u | g | u | o | r |
+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
(As you can see, there are no empty cells shown in the entire table. This looks much better to me.)
```

## Excel VBA, _{157} 146 Bytes (Cheating?)

Anonymous VBE Immediate Window function that destructively takes input from range `[A1]`

and outputs to the `ActiveSheet`

object.

### Golfed

```
[B1:Q1]="=Dec2Hex(Column(B1)-2)":L=[Len(A1)]:For i=0To l:Cells(i\16+2,i Mod 16+2)=Mid([A1],i+1,1):Next:For i=1To l\16+1:Cells(i+1,1)=i:Next:[A1]="
```

### Formatted

```
[B1:Q1]="=Dec2Hex(Column(B1)-2)"
L=[Len(A1)]
For i=0To l:Cells(Int(i/16)+2,i Mod 16+2)=Mid([A1],i+1,1):Next
For i=1To Int(l/16)+1:Cells(i+1,1)=i:Next
[A1]=""
```

### Input / Output

Given:

```
[A1]="qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJ"
```

the generated output is