Question

I am asked to study a Proof of Concept and I can't find anything telling me the following can be a solution.

Indeed, I have to process some data to find which .docx or .rtf template I have to use and build a XML file that can be loaded by the Oracle BIPublisher plugin in MS Word.

Getting and processing the data isn't quite difficult but, thanks to browser's security I can't open MS Word on the client-side. So i was thinking making them download the *.docx or .rtf file*s which would have been modified thanks to the BIPublisher conditional structures written in the templates.

Do you know if you can interact with a presintalled MS Word Plugin as BIP using a PHP script ?

Was it helpful?

Solution

Actually you can interact with BI Publisher Word plugin in PHP. First make sure your Java, Word and BI Publisher plugin works, which I think you have already done. The create an XML file like this:

<tb>
  <type>PDF</type>
  <template>absolute path to your RTF template</template>
  <data>absolute path to your XML data</data>
  <xlifffile></xlifffile>
  <tmppath>C:\Users\<User name>\AppData\Local\Oracle\BIPublisher\TemplateBuilderforWord\tmp</tmppath>
  <locale>en-us</locale>
  <tbhome>C:\Program Files (x86)\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word</tbhome>
  <mastertemplate></mastertemplate>
  <userconfigdir>C:\Users\<User name>\AppData\Local\Oracle\BIPublisher\TemplateBuilderforWord\config</userconfigdir>
</tb>

The tmppath, tbhome and userconfigdir values from from my installation, so modify them accordingly. The next step is to call java in your PHP script, which could be done with exec() function.

java -Xmx256M -jar "C:\Program Files (x86)\Oracle\BI Publisher\BI Publisher Desktop\Template Builder for Word\jlib\RTF2PDFv2.jar" absolute_path_to_the_xml_you_created

Again, check the path of RTF2PDFv2.jar. After that, you can goto the tmppath and there's a folder inside it called tmp, open it, you'll find the generated PDF. And the PDF can be viewed directly inside a browser.

Although you can make it with the procedures above, I suggest to try BI Publisher Server, which offers more than the desktop plugin version.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top