Jump to content

Archived

This topic is now archived and is closed to further replies.

Akira

Generating Excel files for adresses and import to Word

Recommended Posts

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

[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>[/code]

But Word doenst see it as a legal document.

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
Get your freak on! Saved the file everytime as .xsl file :|

Thnx bro, were gonna try that one!

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.