DPP2011
asked on
Help with odtPHP to generate a document
Hello,
I am trying to get odtPHP working with my project, but I am getting an error and I can not find any solutions on the net that can work.
My code is:
I am getting the following error:
Fatal error: Uncaught exception 'OdfException' with message 'Nothing to parse - check that the content.xml file is correctly formed' in C:\wamp\www\Sugar\odf.php: 61 Stack trace: #0 C:\wamp\www\Sugar\include\ publicconf irm_events .php(58): Odf->__construct('demo_oo_ text.od... ') #1 C:\wamp\www\Sugar\publicco nfirm_view .php(710): eventclass_publicconfirm-> BeforeShow View(Objec t(XTempl), 'publicconfirm_v...', Array) #2 {main} thrown in C:\wamp\www\Sugar\odf.php on line 61
My open office file code is:
[!-- BEGIN chargeslog --]
{Contact_First_Name}
{Contact_Last_Name}
[!-- END chargeslog --]
My file location is:
C:\wamp\tmp directory
outside (www) directory
I am using wamp server 2.1 in windows 7 (64 bits)
Please Help, this is driving me bananas!!!!!!!!
I am trying to get odtPHP working with my project, but I am getting an error and I can not find any solutions on the net that can work.
My code is:
function BeforeShowView($xt,$templatefile,$values)
{
require_once('odf.php');
$config = array(
'ZIP_PROXY' => 'PhpZipProxy'
);
$odf = new odf($values['DocumentName']);
$name = $values["Contact_First_Name"];
$odf->setVars('Contact_First_Name', $name);
$message = $values["Contact_Last_Name"];
$odf->setVars('Contact_Last_Name', $message);
$odf->exportAsAttachedFile();
}
I am getting the following error:
Fatal error: Uncaught exception 'OdfException' with message 'Nothing to parse - check that the content.xml file is correctly formed' in C:\wamp\www\Sugar\odf.php:
My open office file code is:
[!-- BEGIN chargeslog --]
{Contact_First_Name}
{Contact_Last_Name}
[!-- END chargeslog --]
My file location is:
C:\wamp\tmp directory
outside (www) directory
I am using wamp server 2.1 in windows 7 (64 bits)
Please Help, this is driving me bananas!!!!!!!!
ASKER
Hello,
Thank you for the comment, I have looked around and it seems like it is supported.
The following is the xml file code
Thank you for the comment, I have looked around and it seems like it is supported.
The following is the xml file code
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><?mso-application progid="Word.Document"?><w:wordDocument xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xml:space="preserve" w:embeddedObjPresent="no">
<o:DocumentProperties><o:Title/><o:Subject/><o:Keywords/><o:Description/><o:Category/><o:Author/><o:LastAuthor>Derek Popovich</o:LastAuthor><o:Manager/><o:Company/><o:HyperlinkBase/><o:Revision>54</o:Revision><o:TotalTime>80</o:TotalTime><o:LastPrinted/><o:Created>2009-10-28T22:36:31Z</o:Created><o:LastSaved>2011-04-24T11:02:58.64Z</o:LastSaved><o:Pages>1</o:Pages><o:Words>2</o:Words><o:Characters>39</o:Characters><o:Paragraphs>2</o:Paragraphs></o:DocumentProperties><o:CustomDocumentProperties><o:Editor dt:dt="string">OpenOffice.org/3.3$Win32 OpenOffice.org_project/330m20$Build-9567</o:Editor><o:Language dt:dt="string"/><o:Info1 dt:dt="string"/><o:Info2 dt:dt="string"/><o:Info3 dt:dt="string"/><o:Info4 dt:dt="string"/></o:CustomDocumentProperties>
<w:fonts><w:defaultFonts w:ascii="" w:h-ansi="" w:fareast="" w:cs=""/><w:font w:name="Tahoma1"><w:family w:val="System"/><w:pitch w:val=""/></w:font><w:font w:name="Times New Roman"><w:family w:val="Roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Arial"><w:family w:val="Swiss"/><w:pitch w:val="variable"/></w:font><w:font w:name="Arial Unicode MS"><w:family w:val="System"/><w:pitch w:val="variable"/></w:font><w:font w:name="MS Mincho"><w:family w:val="System"/><w:pitch w:val="variable"/></w:font><w:font w:name="Tahoma"><w:family w:val="System"/><w:pitch w:val="variable"/></w:font></w:fonts>
<w:lists><w:listDef w:listDefId="0"><w:lvl w:ilvl="0"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%1"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="1"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%2"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="2"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%3"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="3"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%4"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="4"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%5"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="5"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%6"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="6"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%7"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="7"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%8"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="8"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%9"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl></w:listDef><w:list w:ilfo="1"><w:ilst w:val="0"/></w:list></w:lists>
<w:styles>
<w:style w:styleId="default-paragraph-style" w:type="paragraph" w:default="on"><w:name w:val="default-paragraph-style"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing/><w:ind/><w:widowControl w:val="off"/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:ascii="Times New Roman" w:h-ansi="Times New Roman" w:fareast="Arial Unicode MS" w:cs="Tahoma"/><w:sz w:val="24"/><w:lang w:val="en-US"/></w:rPr></w:style><w:style w:styleId="default-table-style" w:type="table" w:default="on"><w:name w:val="default-table-style"/><w:tblPr><w:tblInd w:w="0" w:type="auto"/></w:tblPr></w:style><w:style w:styleId="Standard" w:type="paragraph"><w:basedOn w:val="default-paragraph-style"/><w:name w:val="Standard"/></w:style><w:style w:styleId="Heading" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Heading"/><w:next w:val="Text_20_body"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing w:before="239.841" w:after="120.204"/><w:ind/><w:widowControl w:val="off"/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:fareast="MS Mincho" w:cs="Tahoma"/><w:sz w:val="28"/></w:rPr></w:style><w:style w:styleId="Text_20_body" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Text_20_body"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing w:before="0" w:after="120.204"/><w:ind/><w:widowControl w:val="off"/><w:pBdr/><w:ind/></w:pPr></w:style><w:style w:styleId="List" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="List"/><w:rPr><w:rFonts w:cs="Tahoma1"/></w:rPr></w:style><w:style w:styleId="Caption" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Caption"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing w:before="120.204" w:after="120.204"/><w:ind/><w:widowControl w:val="off"/><w:supressLineNumbers/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:cs="Tahoma1"/><w:sz w:val="24"/><w:i/></w:rPr></w:style><w:style w:styleId="Index" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Index"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing/><w:ind/><w:widowControl w:val="off"/><w:supressLineNumbers/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:cs="Tahoma1"/></w:rPr></w:style><w:style w:styleId="Table_20_Contents" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Table_20_Contents"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing/><w:ind/><w:widowControl w:val="off"/><w:supressLineNumbers/><w:pBdr/><w:ind/></w:pPr></w:style><w:style w:styleId="Table_20_Heading" w:type="paragraph"><w:basedOn w:val="Table_20_Contents"/><w:name w:val="Table_20_Heading"/><w:pPr><w:adjustRightInd w:val="off"/><w:jc w:val="center"/><w:spacing/><w:ind/><w:widowControl w:val="off"/><w:supressLineNumbers/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:b/></w:rPr></w:style><w:style w:styleId="Footer" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Footer"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing/><w:ind/><w:widowControl w:val="off"/><w:tabs><w:tab w:val="center" w:pos="4818.3661"/><w:tab w:val="right" w:pos="9638.4332"/></w:tabs><w:supressLineNumbers/><w:pBdr/><w:ind/></w:pPr></w:style><w:style w:styleId="Internet_20_link" w:type="character"><w:name w:val="Internet_20_link"/><w:rPr><w:u w:val="single"/><w:color w:val="000080"/><w:lang w:val="zxx-none"/></w:rPr></w:style>
<w:style w:styleId="P1" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="P1"/><w:hidden w:val="on"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing w:line-rule="auto" w:line="276"/><w:ind/><w:widowControl w:val="off"/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial"/><w:sz w:val="16"/><w:color w:val="943634"/><w:lang w:val="en-US"/></w:rPr></w:style><w:style w:styleId="P2" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="P2"/><w:hidden w:val="on"/><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial"/><w:sz w:val="22"/><w:color w:val="800000"/></w:rPr></w:style><w:style w:styleId="P3" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="P3"/><w:hidden w:val="on"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing w:line-rule="auto" w:line="276"/><w:ind/><w:widowControl w:val="off"/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial"/><w:sz w:val="16"/><w:color w:val="943634"/><w:lang w:val="en-US"/></w:rPr></w:style><w:style w:styleId="P4" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="P4"/><w:hidden w:val="on"/><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial"/><w:sz w:val="22"/><w:color w:val="800000"/></w:rPr></w:style><w:style w:styleId="P5" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="P5"/><w:hidden w:val="on"/><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial"/><w:sz w:val="22"/><w:i/></w:rPr></w:style>
<w:style w:type="character" w:styleId="Hyperlink"><w:name w:val="Hyperlink"/><w:rsid w:val="006A55B0"/><w:rPr><w:color w:val="000080"/><w:u w:val="single"/></w:rPr></w:style><w:style w:type="character" w:styleId="FollowedHyperlink"><w:name w:val="FollowedHyperlink"/><w:rsid w:val="006A55B0"/><w:rPr><w:color w:val="800000"/><w:u w:val="single"/></w:rPr></w:style>
<w:style w:type="character" w:styleId="CommentReference"><w:name w:val="annotation reference"/><w:basedOn w:val="DefaultParagraphFont"/><w:semiHidden/><w:rsid w:val="007770B7"/><w:rPr><w:sz w:val="16"/><w:sz-cs w:val="16"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="CommentText"><w:name w:val="annotation text"/><w:basedOn w:val="Normal"/><w:semiHidden/><w:rsid w:val="007770B7"/><w:pPr><w:pStyle w:val="CommentText"/></w:pPr><w:rPr><w:sz w:val="20"/><w:sz-cs w:val="20"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="CommentSubject"><w:name w:val="annotation subject"/><w:basedOn w:val="CommentText"/><w:next w:val="CommentText"/><w:semiHidden/><w:rsid w:val="007770B7"/><w:pPr><w:pStyle w:val="CommentSubject"/></w:pPr><w:rPr><w:b/><w:b-cs/></w:rPr></w:style>
</w:styles>
<w:docPr><w:displayBackgroundShape/><w:view w:val="print"/><w:zoom w:percent=""/><w:defaultTabStop w:val="709.317"/><w:docVars/></w:docPr>
<w:body><w:p><w:pPr><w:pStyle w:val="P2"/></w:pPr><w:r><w:t>{Contact_First_Name}</w:t></w:r></w:p><w:p><w:pPr><w:pStyle w:val="P2"/></w:pPr><w:r><w:t>{Contact_Last_Name}</w:t></w:r></w:p><w:p><w:pPr><w:pStyle w:val="P5"/></w:pPr></w:p><w:sectPr><w:type w:val="next-page"/><w:pgSz w:w="11906.4332" w:h="16839.3333" w:orient="portrait"/><w:pgMar w:top="1134" w:bottom="1134" w:left="1134" w:gutter="0" w:right="1134"/><w:pgBorders w:offset-from="text"/><w:ftr w:type="odd"><w:p><w:pPr><w:pStyle w:val="P1"/></w:pPr></w:p></w:ftr></w:sectPr></w:body>
</w:wordDocument>
ASKER
Hello,
I have change my code to be exactly as per the sample on the internet and I am getting the same error,
I have also check the xml code of my open-office document over the internet and it shows no error.
I have written to the odtphp forum administrator for help but no reply so far.
I am very puzzled????????
I have change my code to be exactly as per the sample on the internet and I am getting the same error,
I have also check the xml code of my open-office document over the internet and it shows no error.
I have written to the odtphp forum administrator for help but no reply so far.
I am very puzzled????????
That's about what I would expect for a SourceForge project with only 16 recommendations. To say that it is "thinly supported" may be an understatement. If you want to use open-source software the first thing to look for is a developer's group in your own community. For example, in the Washington, DC area we have dozens of PHP developers, so I am fairly comfortable using PHP since I know there are a lot of people using it. For me that means there is no need to read and verify the operation of every line of the PHP source code - others are doing that and I can rely on their work. If there were not a large community of developers, I would want to read the source code and understand every line of it, which might be a big task.
This script at http://www.laprbass.com/RAY_temp_DPP2011.php outputs these notices.
Notice: Undefined variable: Win32 in /home/websitet/public_html /RAY_temp_ DPP2011.ph p on line 7
Notice: Undefined variable: Build in /home/websitet/public_html /RAY_temp_ DPP2011.ph p on line 21
I think the Notice about Build is wrong - that string occurs on line 7. But the point is that you have undefined variables in the XML string and this may be having an effect on your efforts to use the string.
This script at http://www.laprbass.com/RAY_temp_DPP2011.php outputs these notices.
Notice: Undefined variable: Win32 in /home/websitet/public_html
Notice: Undefined variable: Build in /home/websitet/public_html
I think the Notice about Build is wrong - that string occurs on line 7. But the point is that you have undefined variables in the XML string and this may be having an effect on your efforts to use the string.
<?php // RAY_temp_DPP2011.php
error_reporting(E_ALL);
echo "<pre>";
$xml = <<<ENDXML
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><?mso-application progid="Word.Document"?><w:wordDocument xmlns:aml="http://schemas.microsoft.com/aml/2001/core" xmlns:number="urn:oasis:names:tc:opendocument:xmlns:datastyle:1.0" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:fo="urn:oasis:names:tc:opendocument:xmlns:xsl-fo-compatible:1.0" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.microsoft.com/office/word/2003/wordml" xmlns:wx="http://schemas.microsoft.com/office/word/2003/auxHint" xmlns:o="urn:schemas-microsoft-com:office:office" xml:space="preserve" w:embeddedObjPresent="no">
<o:DocumentProperties><o:Title/><o:Subject/><o:Keywords/><o:Description/><o:Category/><o:Author/><o:LastAuthor>Derek Popovich</o:LastAuthor><o:Manager/><o:Company/><o:HyperlinkBase/><o:Revision>54</o:Revision><o:TotalTime>80</o:TotalTime><o:LastPrinted/><o:Created>2009-10-28T22:36:31Z</o:Created><o:LastSaved>2011-04-24T11:02:58.64Z</o:LastSaved><o:Pages>1</o:Pages><o:Words>2</o:Words><o:Characters>39</o:Characters><o:Paragraphs>2</o:Paragraphs></o:DocumentProperties><o:CustomDocumentProperties><o:Editor dt:dt="string">OpenOffice.org/3.3$Win32 OpenOffice.org_project/330m20$Build-9567</o:Editor><o:Language dt:dt="string"/><o:Info1 dt:dt="string"/><o:Info2 dt:dt="string"/><o:Info3 dt:dt="string"/><o:Info4 dt:dt="string"/></o:CustomDocumentProperties>
<w:fonts><w:defaultFonts w:ascii="" w:h-ansi="" w:fareast="" w:cs=""/><w:font w:name="Tahoma1"><w:family w:val="System"/><w:pitch w:val=""/></w:font><w:font w:name="Times New Roman"><w:family w:val="Roman"/><w:pitch w:val="variable"/></w:font><w:font w:name="Arial"><w:family w:val="Swiss"/><w:pitch w:val="variable"/></w:font><w:font w:name="Arial Unicode MS"><w:family w:val="System"/><w:pitch w:val="variable"/></w:font><w:font w:name="MS Mincho"><w:family w:val="System"/><w:pitch w:val="variable"/></w:font><w:font w:name="Tahoma"><w:family w:val="System"/><w:pitch w:val="variable"/></w:font></w:fonts>
<w:lists><w:listDef w:listDefId="0"><w:lvl w:ilvl="0"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%1"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="1"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%2"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="2"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%3"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="3"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%4"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="4"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%5"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="5"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%6"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="6"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%7"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="7"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%8"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl><w:lvl w:ilvl="8"><w:start w:val="1"/><w:nfc w:val="255"/><w:lvlText w:val="%9"/><w:lvlJc w:val="left"/><w:pPr><w:tabs><w:tab w:val="list" w:pos="366.027"/></w:tabs><w:ind w:left="0" w:hanging="0"/></w:pPr></w:lvl></w:listDef><w:list w:ilfo="1"><w:ilst w:val="0"/></w:list></w:lists>
<w:styles>
<w:style w:styleId="default-paragraph-style" w:type="paragraph" w:default="on"><w:name w:val="default-paragraph-style"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing/><w:ind/><w:widowControl w:val="off"/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:ascii="Times New Roman" w:h-ansi="Times New Roman" w:fareast="Arial Unicode MS" w:cs="Tahoma"/><w:sz w:val="24"/><w:lang w:val="en-US"/></w:rPr></w:style><w:style w:styleId="default-table-style" w:type="table" w:default="on"><w:name w:val="default-table-style"/><w:tblPr><w:tblInd w:w="0" w:type="auto"/></w:tblPr></w:style><w:style w:styleId="Standard" w:type="paragraph"><w:basedOn w:val="default-paragraph-style"/><w:name w:val="Standard"/></w:style><w:style w:styleId="Heading" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Heading"/><w:next w:val="Text_20_body"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing w:before="239.841" w:after="120.204"/><w:ind/><w:widowControl w:val="off"/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial" w:fareast="MS Mincho" w:cs="Tahoma"/><w:sz w:val="28"/></w:rPr></w:style><w:style w:styleId="Text_20_body" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Text_20_body"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing w:before="0" w:after="120.204"/><w:ind/><w:widowControl w:val="off"/><w:pBdr/><w:ind/></w:pPr></w:style><w:style w:styleId="List" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="List"/><w:rPr><w:rFonts w:cs="Tahoma1"/></w:rPr></w:style><w:style w:styleId="Caption" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Caption"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing w:before="120.204" w:after="120.204"/><w:ind/><w:widowControl w:val="off"/><w:supressLineNumbers/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:cs="Tahoma1"/><w:sz w:val="24"/><w:i/></w:rPr></w:style><w:style w:styleId="Index" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Index"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing/><w:ind/><w:widowControl w:val="off"/><w:supressLineNumbers/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:cs="Tahoma1"/></w:rPr></w:style><w:style w:styleId="Table_20_Contents" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Table_20_Contents"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing/><w:ind/><w:widowControl w:val="off"/><w:supressLineNumbers/><w:pBdr/><w:ind/></w:pPr></w:style><w:style w:styleId="Table_20_Heading" w:type="paragraph"><w:basedOn w:val="Table_20_Contents"/><w:name w:val="Table_20_Heading"/><w:pPr><w:adjustRightInd w:val="off"/><w:jc w:val="center"/><w:spacing/><w:ind/><w:widowControl w:val="off"/><w:supressLineNumbers/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:b/></w:rPr></w:style><w:style w:styleId="Footer" w:type="paragraph"><w:basedOn w:val="Standard"/><w:name w:val="Footer"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing/><w:ind/><w:widowControl w:val="off"/><w:tabs><w:tab w:val="center" w:pos="4818.3661"/><w:tab w:val="right" w:pos="9638.4332"/></w:tabs><w:supressLineNumbers/><w:pBdr/><w:ind/></w:pPr></w:style><w:style w:styleId="Internet_20_link" w:type="character"><w:name w:val="Internet_20_link"/><w:rPr><w:u w:val="single"/><w:color w:val="000080"/><w:lang w:val="zxx-none"/></w:rPr></w:style>
<w:style w:styleId="P1" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="P1"/><w:hidden w:val="on"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing w:line-rule="auto" w:line="276"/><w:ind/><w:widowControl w:val="off"/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial"/><w:sz w:val="16"/><w:color w:val="943634"/><w:lang w:val="en-US"/></w:rPr></w:style><w:style w:styleId="P2" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="P2"/><w:hidden w:val="on"/><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial"/><w:sz w:val="22"/><w:color w:val="800000"/></w:rPr></w:style><w:style w:styleId="P3" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="P3"/><w:hidden w:val="on"/><w:pPr><w:adjustRightInd w:val="off"/><w:spacing w:line-rule="auto" w:line="276"/><w:ind/><w:widowControl w:val="off"/><w:pBdr/><w:ind/></w:pPr><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial"/><w:sz w:val="16"/><w:color w:val="943634"/><w:lang w:val="en-US"/></w:rPr></w:style><w:style w:styleId="P4" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="P4"/><w:hidden w:val="on"/><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial"/><w:sz w:val="22"/><w:color w:val="800000"/></w:rPr></w:style><w:style w:styleId="P5" w:type="paragraph"><w:basedOn w:val="Text_20_body"/><w:name w:val="P5"/><w:hidden w:val="on"/><w:rPr><w:rFonts w:ascii="Arial" w:h-ansi="Arial"/><w:sz w:val="22"/><w:i/></w:rPr></w:style>
<w:style w:type="character" w:styleId="Hyperlink"><w:name w:val="Hyperlink"/><w:rsid w:val="006A55B0"/><w:rPr><w:color w:val="000080"/><w:u w:val="single"/></w:rPr></w:style><w:style w:type="character" w:styleId="FollowedHyperlink"><w:name w:val="FollowedHyperlink"/><w:rsid w:val="006A55B0"/><w:rPr><w:color w:val="800000"/><w:u w:val="single"/></w:rPr></w:style>
<w:style w:type="character" w:styleId="CommentReference"><w:name w:val="annotation reference"/><w:basedOn w:val="DefaultParagraphFont"/><w:semiHidden/><w:rsid w:val="007770B7"/><w:rPr><w:sz w:val="16"/><w:sz-cs w:val="16"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="CommentText"><w:name w:val="annotation text"/><w:basedOn w:val="Normal"/><w:semiHidden/><w:rsid w:val="007770B7"/><w:pPr><w:pStyle w:val="CommentText"/></w:pPr><w:rPr><w:sz w:val="20"/><w:sz-cs w:val="20"/></w:rPr></w:style><w:style w:type="paragraph" w:styleId="CommentSubject"><w:name w:val="annotation subject"/><w:basedOn w:val="CommentText"/><w:next w:val="CommentText"/><w:semiHidden/><w:rsid w:val="007770B7"/><w:pPr><w:pStyle w:val="CommentSubject"/></w:pPr><w:rPr><w:b/><w:b-cs/></w:rPr></w:style>
</w:styles>
<w:docPr><w:displayBackgroundShape/><w:view w:val="print"/><w:zoom w:percent=""/><w:defaultTabStop w:val="709.317"/><w:docVars/></w:docPr>
<w:body><w:p><w:pPr><w:pStyle w:val="P2"/></w:pPr><w:r><w:t>{Contact_First_Name}</w:t></w:r></w:p><w:p><w:pPr><w:pStyle w:val="P2"/></w:pPr><w:r><w:t>{Contact_Last_Name}</w:t></w:r></w:p><w:p><w:pPr><w:pStyle w:val="P5"/></w:pPr></w:p><w:sectPr><w:type w:val="next-page"/><w:pgSz w:w="11906.4332" w:h="16839.3333" w:orient="portrait"/><w:pgMar w:top="1134" w:bottom="1134" w:left="1134" w:gutter="0" w:right="1134"/><w:pgBorders w:offset-from="text"/><w:ftr w:type="odd"><w:p><w:pPr><w:pStyle w:val="P1"/></w:pPr></w:p></w:ftr></w:sectPr></w:body>
</w:wordDocument>
ENDXML;
ASKER
Hello Ray,
Thank you for the data, very much appreciated, the xml file was created by openOffice 3.3, I
was wondering if a previous version of the open office will be better.
Do you or anyone know of a good php code that I can use to merge data from my database to
a open office document? something simple to use?
Thank you for the data, very much appreciated, the xml file was created by openOffice 3.3, I
was wondering if a previous version of the open office will be better.
Do you or anyone know of a good php code that I can use to merge data from my database to
a open office document? something simple to use?
something simple to use?
From where I sit, "simple" may not be an option in dealing with Microsoft Word documents, no matter how they were created. There are lots of schemas to digest. Have a look a this, where we expanded the XML into an object (a necessary part of programmatic manipulation).
http://www.laprbass.com/RAY_temp_DPP2011.php
That blows up into thousands of lines and dozens of sub-objects, mostly related to formatting, from what I can tell by scanning the output. Suggest you leave this question open a little longer and see if another expert has something to offer. Or try to give us the deep background that would explain why you want to use odtPHP instead of some other technology. There may be an "easy" solution once we know that part.
From where I sit, "simple" may not be an option in dealing with Microsoft Word documents, no matter how they were created. There are lots of schemas to digest. Have a look a this, where we expanded the XML into an object (a necessary part of programmatic manipulation).
http://www.laprbass.com/RAY_temp_DPP2011.php
That blows up into thousands of lines and dozens of sub-objects, mostly related to formatting, from what I can tell by scanning the output. Suggest you leave this question open a little longer and see if another expert has something to offer. Or try to give us the deep background that would explain why you want to use odtPHP instead of some other technology. There may be an "easy" solution once we know that part.
ASKER
Hi,
I just want to be able to generate a document into open office or ms words from a template where I can insert the first name last name etc into the top of the documnet.
I have look on the internet and found odtphp and tinybutstrong but they don't work properly with
my system and I can not find enough support to answer my questions, I don't know why.
I will leave this open for a little while and I am going back to my books to see if I can work out another way to make it work.
I just want to be able to generate a document into open office or ms words from a template where I can insert the first name last name etc into the top of the documnet.
I have look on the internet and found odtphp and tinybutstrong but they don't work properly with
my system and I can not find enough support to answer my questions, I don't know why.
I will leave this open for a little while and I am going back to my books to see if I can work out another way to make it work.
Does it have to be MS Word? How about PDF or XML?
ASKER
I have generated a code that does the merge quite well if I specify the full path to the directory
but I want to be able to select the template file to be use based on what is on my directory.
How can I change it so I can select a different file from a list? I have a field
name called DocumentTemplate that I can use to select the right file.
but I want to be able to select the template file to be use based on what is on my directory.
$name = $values["Contact_First_Name"];
$lname = $values["Contact_Last_Name"];
{
header('Content-type: application/msword');
header('Content-Disposition: inline, filename=demo.rtf');
$date = date ('F d, y');
$filename = 'C:\wamp\tmp\demo.rtf';
$fp = fopen ($filename, 'r');
$output = fread( $fp, filesize($filename));
fclose ($fp);
$output = str_replace( '<<NAME>>', strtoupper ($name), $output );
$output = str_replace( '<<name>>', $name, $output );
$output = str_replace( '<<lname>>', $lname, $output );
$output = str_replace( '<<mm/dd/yyyy>>', $date, $output );
echo $output;
}
How can I change it so I can select a different file from a list? I have a field
name called DocumentTemplate that I can use to select the right file.
ASKER
Hello,
I have changed the code to:
I am getting the following error:
It seems that the file is not being found,
Can someone please tell me why:
Works fine, and
I have changed the code to:
$name = $values["Contact_First_Name"];
$lname = $values["Contact_Last_Name"];
$fieldname = $values["DocumentName"];
{
header('Content-type: application/msword');
header('Content-Disposition: inline, filename='.$fieldname);
$date = date ('F d, y');
$filename = $fieldname;
$fp = fopen('C:/wamp/tmp/'.$fieldname,'r');
$output = fread( $fp, filesize($filename));
fclose ($fp);
$output = str_replace( '<<NAME>>', strtoupper ($name), $output );
$output = str_replace( '<<name>>', $name, $output );
$output = str_replace( '<<lname>>', $lname, $output );
$output = str_replace( '<<mm/dd/yyyy>>', $date, $output );
echo $output;
}
I am getting the following error:
filesize() [function.filesize]: stat failed for demo.rtf
It seems that the file is not being found,
Can someone please tell me why:
$filename = 'C:\wamp\tmp\demo.rtf';
$fp = fopen ($filename, 'r');
Works fine, and
$filename = $fieldname;
$fp = fopen('C:/wamp/tmp/'.$fieldname,'r');
Can't find the file??????????? This is frustrating.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hello,
The right code is
The right code is
$name = $values["Contact_First_Name"];
$lname = $values["Contact_Last_Name"];
$fieldname = $values["DocumentTemplate"];
{
header('Content-type: application/msword');
header('Content-Disposition: inline, filename=demo.rtf');
$date = date ('F d, y');
$dirname = 'C:/wamp/tmp/';
$filename = $dirname.$fieldname;
$fp = fopen ($filename, 'r');
$output = fread( $fp, filesize($filename));
fclose ($fp);
$output = str_replace( '<<NAME>>', strtoupper ($name), $output );
$output = str_replace( '<<name>>', $name, $output );
$output = str_replace( '<<lname>>', $lname, $output );
$output = str_replace( '<<mm/dd/yyyy>>', $date, $output );
echo $output;
}
ASKER
This code help me find the problem
Can you please post the content.xml file?