Calculate table width and height