Dynamic Generation of Microsoft Office Documents
using Open Office
Darren Shu
thshufits at gmail.com
Agenda
- Benefits
- Overview of Problem Solved
- Setup Tips
- Conclusion
- Summary
Benefits
- Cost Effective*
- Higher Stability*
- Corporate Friendly (Microsoft dominates the marketshare)
In my particular case, the corporate document format standard was Microsoft Word. Your milage may vary, but many sources will say validate that Microsoft dominates the office document format.
Benefits (Cost)
-
"Besides the technical problems, you must also consider the feasibility of such a design with respect to licensing. Current licensing guidelines prevent Office Applications from being used on a server to service client requests, unless those clients themselves have licensed copies of Office. Using server-side Automation to provide Office functionality to unlicensed workstations is not covered by the End User License Agreement (EULA)."*
During a brief research period, the only other development library available was through Soft Artisans for $1200. Some organizations may find this to be an acceptable cost.
Benefits (Improved Stability)
-
"Microsoft does not currently recommend, and does not support, Automation of Microsoft Office applications from any unattended, non-interactive client application or component (including ASP, DCOM, and NT Services), because Office may exhibit unstable behavior and/or deadlock when run in this environment."*
Basically, Microsoft didn't design the Office suite to be automated in a server environment. In my own personal experience using .NET libraries in 2005, there was a bug (and still might be) that kept an Excel process that did not properly close during automation. While searching for a solution, I came across the Microsoft Knowledge Base article. OpenOffice has it's share of bugs as well, but can potentially be more stable in another environment because the developers design it that way.
Overview
-
A report was due at 9am in Word document format. Sending a report before the deadline was critical.
-
Summary information was requested. Detailed information was sometimes requested.
-
Report needed to be received via email.
Overview 1/7
-
Updated database with executive summary
Example code doesn't use a database. This was what was used in production.
Overview 2/7
-
Updated database with detailed notes
Overview 3/7
-
At 9am, a status report to my boss was due. Program waited slightly after 8am to start.
Overview 4/7
-
After the waiting period was over, gather summary data
Overview 5/7
Example code only demonstrates the generation of the word document. The other steps are up to the interested reader.
Overview 6/7
Overview 7/7
Setup Tips
- Update locate database (if it hasn't been updated already)
-
$ updatedb
- Locate the binaries and udk
-
$ locate uno.py
/usr/lib/openoffice/program/uno.py
$ locate soffice.bin
/usr/lib/openoffice/program/soffice.bin
There are probably other ways of finding the files if slocate wasn't emerged. You can also use:
$ find / -name "uno.py" -print
Conclusion
-
At a fraction of a cost of a Windows solution, it is possible to reliably generate Microsoft Office Documents using Open Office.
Summary
- Benefits
- Overview of Problem Solved
- Setup Tips
- Conclusion
- Summary
To get more information
- http://udk.openoffice.org
- http://www.oooforum.org
- Email: theshufits at gmail.com