|  | 
  Niclas Paul - 2008-09-23 07:05:11First off, 2^100 thanks for a superb stream handler! It just made my life sooo much easier!
 But I need to construct an Excelfile with a seemingly simple format, but I can't make the array(s) work.
 Basically I need an xls with contact information at the top, and below it a standard listing. Simplified something like:
 
 Name    Bob the Builder
 Address Whatever
 
 Product        Code    Info
 Some product   123     Blahblah
 Another prod   456     Foobar
 ....
 
 Can it be done?
 
 br,
 Niclas Paul, Finland
  Niclas Paul - 2008-09-23 07:34:32 - In reply to message 1 from Niclas PaulTo partially answer my own question (in case someone else is wondering about the same). My mistake was of course that I tried to construct two separate arrays, when everything needs to go into one array.Again, simplified, my array now looks like this:
 
 Array
 (
 [0] => Array
 (
 [UserId] =>
 [600] =>
 )
 
 [1] => Array
 (
 [Address] =>
 [Some Road 1] =>
 )
 
 [2] => Array
 (
 [Amount] => 1
 [Price] => 217
 [Product Code] => 8264054
 )
 
 [3] => Array
 (
 [Amount] => 2
 [Price] => 213
 [Product Code] => 8260630
 )
 )
 
 Everything else looks fine, but in the generated xls the header row for the listing (Amount, Price & ProdCode) is left out. As I have (not?) understood this, this is because I have already specified columns A&B in the first elements of the array.
 Is there a way around this?
 
 br,
 Niclas Paul, Finland
 
 
  Niclas Paul - 2008-09-23 07:58:11 - In reply to message 1 from Niclas PaulThis is looking more and more like a monologue, but if it helps someone else it's worth it :)
 To answer my second own question, I got stuck with the idea that every key in the array needs to have the name specified. I solved my problem by starting the xls wirh the list that needed the headers in place. No problem there. Then I added the contact part without specifying the keynames. Without database calls:
 $Excel[]=array("Username", $username);
 $Excel[]=array("Address", $useraddress);
 
 That did the trick. I had to move the contact info below the listing, but that's of no importance at least to this project.
 
 Hopefully at least one of you have wondered about this and finds a solution, otherwise it's just plain embarrasying for me :)
 
 greetings,
 Niclas Paul, still from Finland...
 |