I confess I'm a little puzzled. Anyone I know who understands enough about PHP to be using it for programming would already know the answer to this... so I wonder why you're using PHP if you don't understand what it is and what it does.
PHP is a scripting
language, not a formatting
language, so it's no surprise it doesn't carry forward the formatting from Word or Excel. The PHP scripting language has no syntax for formatting -- it relies on other presentation/formatting languages (such as HTML or CSS) to handle that.
If these are intended to be pages presented via the web, you either need to use a text editor to add the HTML/CSS formatting yourself, or have Word or Excel save the document or spreadsheet to HTML format. If you choose the second option, you will likely need to do some extensive clean up, as the HTML generated by Word and Excel is stuffed with Microsoft-proprietary code that is not necessary and could get in the way of proper presentation for the web.