RE : Subject: Excel - merging cells with PHP

From: Date: Tue, 30 Nov 2004 13:31:21 +0000
Subject: RE : Subject: Excel - merging cells with PHP
Groups: php.db 
Request: Send a blank email to php-db+get-37469@lists.php.net to get a copy of this message
Sure, you'd output to the Excel XML spreadsheet format, which allows you to do colspans and such, although with a different syntax to HTML. (I posted this answer to the microsoft.public.xsl list the other day ;-) The documentation is here : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnexcl2k2/html/odc_xmlss.asp Some Examples : http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dnoffpro01/html/XMLOfficeXPPartI.asp http://www.simonstl.com/articles/officeXML/spreadsheetML.html and http://www.simonstl.com/articles/officeXML/spreadsheetMLsample.html But the easiest way by far is this : Save your XML file in the desired format but choose "Save As", then pick "XML Spreadsheet" as the file type to use (its in the same dropdown as Lotus1-2-3 and CSV files). Open the XML spreadsheet in a text editor and immediately you will see how it is formatted. Now, ignore the HTML, and create an XML file which matches the XML spreadsheet. Really you only need to generate <Row> and <Cell> <Data> tags, the Style tags can be added to the XSLT file. You can define almost any style used in excel such as borders, shading, number format (so no need to pre-convert numbers to currency for example_ Just use standard XSL to convert your XML data output from the DB to either of HTML or Excel spreadsheet (or even CSV for old Excel 97 !). I've done this in production environments and it works very very well indeed. It should take about 2-3 hours the first time, and you'll make a couple of mistakes. Examine the excel error log produced to find out the error (the error log is saved in your temporary internet files). It will be much fasted once you've tried it once.
Message-ID: <9EEDF0D0C8B3574B9B75503A0F0620E605843C84@HCEXCHANGE55a.hctx.net> From: "Perry, Matthew (Fire Marshal's Office)" <Matthew.Perry@fmo.hctx.net> To: php-db@lists.php.net Date: Mon, 29 Nov 2004 08:48:52 -0600 MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----_=_NextPart_001_01C4D622.8B3E44C4" Subject: Excel - merging cells with PHP When you export a table to excel, is there a way to merge cells and create borders? I want my excel file to look exactly like my html table looks. Matthew Perry
======================================================== CaptionKit http://www.captionkit.com : Production tools for accessible subtitled internet media, transcripts and searchable video. Supports Real Player, Quicktime and Windows Media Player. VideoChat with friends online, get Freshly Toasted every day at http://www.fresh-toast.net : NetMeeting solutions for a connected world.

« previous php.db (#37469) next »