Jump to content


Photo

Generating Excel files for adresses and import to Word


  • Please log in to reply
4 replies to this topic

#1 Akira

Akira
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 24 July 2006 - 01:57 PM

Hey guys,

Im trying to create a excel file from PHP and import this to Word.
How can this be done??

I've tried 2 different methods so far.
1. genarating and XML file and saving it as Excel
2. generating a full workbook, also with the help off XML

A piece of the code

<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:o="urn:schemas-microsoft-com:office:office"
 xmlns:x="urn:schemas-microsoft-com:office:excel"
 xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet"
 xmlns:html="http://www.w3.org/TR/REC-html40">
 <ExcelWorkbook xmlns="urn:schemas-microsoft-com:office:excel">
  <WindowHeight>11910</WindowHeight>
  <WindowWidth>15195</WindowWidth>
  <WindowTopX>480</WindowTopX>
  <WindowTopY>60</WindowTopY>
  <ProtectStructure>False</ProtectStructure>
  <ProtectWindows>False</ProtectWindows>
 </ExcelWorkbook>
 <Styles>
  <Style ss:ID="Default" ss:Name="Normal">
   <Alignment ss:Vertical="Bottom"/>
   <Borders/>
   <Font/>
   <Interior/>
   <NumberFormat/>
   <Protection/>
  </Style>
 </Styles>
 <Worksheet ss:Name="Blad1">
  <Table ss:ExpandedColumnCount="10" ss:ExpandedRowCount="<?=count($_POST['id'])?>" x:FullColumns="1"
   x:FullRows="1">
   <Column ss:Index="9" ss:Width="52.5"/>
   <Row>
    <Cell><Data ss:Type="String">voorletters</Data></Cell>
    <Cell><Data ss:Type="String">tussenvoegsel</Data></Cell>
    <Cell><Data ss:Type="String">achternaam</Data></Cell>
    <Cell><Data ss:Type="String">adres</Data></Cell>
    <Cell><Data ss:Type="String">huisnr</Data></Cell>
    <Cell><Data ss:Type="String">toevoeging</Data></Cell>
    <Cell><Data ss:Type="String">postcode</Data></Cell>
    <Cell><Data ss:Type="String">woonplaats</Data></Cell>
    <Cell><Data ss:Type="String">telefoon</Data></Cell>
    <Cell><Data ss:Type="String">e-mail</Data></Cell>
   </Row>

But Word doenst see it as a legal document.

Can someone help me with this, need to have this done by tonight 00.00 :|
Greetz Akira


#2 lead2gold

lead2gold
  • Members
  • PipPipPip
  • Advanced Member
  • 164 posts
  • LocationOttawa, On

Posted 24 July 2006 - 02:11 PM

you might find it way easier to export it as a comma separated value (.csv) file.
there is a great tutorial on how to do this on this site.

It's the easiest format to open into excel with.

#3 Akira

Akira
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 24 July 2006 - 02:20 PM

yes,  i know, thats not a problem. Already have the scripts for that ;) But i need to import it to Word.

Otherwise i'll have 2 steps, instead of one.

THnx for the reply btw
Greetz Akira


#4 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 24 July 2006 - 02:31 PM

I copied your sample and saved it as the file "test.xml". Both Excel 2003 & Word 2003 opened the file with no problems.

How are you saving the file?

Ken

#5 Akira

Akira
  • Members
  • PipPipPip
  • Advanced Member
  • 32 posts

Posted 24 July 2006 - 02:34 PM

Get your freak on! Saved the file everytime as .xsl file :|

Thnx bro, were gonna try that one!
Greetz Akira





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users