Revised method of constructing borders for merged cells

Closed Bitbucket Importer requested to merge bitbucket/declined-pr-274 into branch/2.6