I believe that almost every Lotus Notes developer had a task about creation some report in MS Excel.
It might be a task about creation a MS Word document.
Sometimes you needed to do that on the server side: in Web UI, by some schedule, whatever...
In the most of cases you can not expect to resolve such tasks using OLE related technologies.
The reason is simple - administrators do not install Office application on the server.
So how to do that?
There are enough possibilities to do that even without OLE. Google for them.
I want to share with you the way I usually used (not always, but usually).
It is based on native for MS Office xml-files.
Approach is very simple.
Create office document you want to get using corresponding application manually.
For example, I need to create some XLS-report.
I create it manually in MS Excel.
To make it easier to operate with this manually created xls-template later I created placeholders I am going to replace with real values using lotus script. You may use your own, you do not need to do it like me with two % symbols.
After that I save this template as XML using native MS Excel capabilities.
I use "XML Spreadsheet 2003" option because I want to support any possible MS Excel versions.
Now you have everything you need.
You save this xml-template as an attachment somewhere in configuration NotesDocument.
In your Web application (or in a scheduled agent) you extract this xml-file to disk, associate NotesStream with it and then do any required manipulations with xml including replacement of placeholders with real values using lotus script.
When your file is ready, you may (print "[" & url & "]") it or (mail) it to the end user.
But except this warning with only MS Office 2010 user will not notice any difference.
Previous versions of MS Office (2003, 2007) did not care about such extension substitutions so it works perfect for those versions.
The same about MS Word documents.
No comments:
Post a Comment