Am 24.06.2011 18:28, schrieb lee:
Alexander Thurgood<alex.thurgood@gmail.com> writes:
Le 24/06/11 15:13, lee a écrit :
Hi Lee,
Now I would like to make it so that I can press a button and be
presented with a form or the like that lets me fill in the variable
data, inserts the data at the appropriate places into the document,
saves the document to a file I specify and exports the document as PDF
with a password for access rights to the PDF file set.
How do I do that? Does it take some kind of advanced programming?
If you don't want to go down the mailmerge route, then the answer is
yes, you will need to be able to program it in Basic or some other
scripting language that LibO knows how to interpret (Javascript or
Python for example) and can bind with UNO dialog components.
Well, I'm thinking about using it, I just don't see yet how I could make
it really useful.
Really, the simplest way would be to use a Calc spreadsheet to hold the
data, and then bind those fields to your text document.
That is exactly what I'm trying to avoid. The workflow is like:
while(webpages) {
check out the web page
decide whether to send my document or not
if(I send it) {
create a new directory to save the document in // this is already
// automated by a
// shell script
paste a unique reference number generated by the shell script into
the document
copy and paste some data like a company name and address and a
persons name into the document
adjust the salutation as needed
go to another place in the document and enter the companys name and
city
save the document in the directory created by the shell script with
a meaningful file name (like "<documentname>-<company>")
export the document as pdf with a permissions password set
create an email by editing an email template appropriately to send
the pdf file by email
save the webpage in the same directory as the LO document
make a note in a text file that the document was sent in response to
the particular web page
}
}
I can hear this crying for (at least some more) automation from 10 miles
away ...
This is crying for for some macros and for a database.
if you already know how to use shell scripts, it's not hard to learn to
program some macros.
and you can use command-line commands inside macros as well.
so you can integrate your scripts into the macros. ( Coder : shell (
command-line command , options , ,).
If you make a database in Base with a table(or better more, with are
linked together) with a column for each entry you have to make in the
writer-document (and some more for information and ID) ,
you can connect the fields (columns) to text-boxes in the document (with
invisible borders).
create a form (in Base), to insert the new data.
Then you need a macro to
Sub.....
-create a new directory to save the document in
-paste a unique reference number generated by the shell script (bette the macro)
into the document (better the database)
-save the document in the directory created by the macro with
a meaningful file name (like "<documentname>-<company>"(use the database to find this name)
-export the document as pdf
-save the PDF with a permissions password (schell command inside the Macro)
-create an email by editing an email template(using again the data from the database) to send
the pdf file by email
-save the webpage in the same directory as the LO document
-make a note in the database that the document was sent in response to
the particular web page
End Sub
regards
Frieder
It is possible to gather the data inserted into the document in
advance. The problem is that when I do that, I think it would become
rather difficult to keep track of what happens. And I need to keep track
of what happens because I have to do some of the steps manually because
it would be too much effort to automate all of them.
Perhaps there is way to make things easier that I just don't see? I'm
free to change the workflow in whatever way I like, only the outcome
needs to be the same.
Even here though, if you want it to automatically export your filled
in text document as a password protected PDF, you will need to learn
some kind of programming to automate it.
Hm, I think someone here posted about commandline options for converting
to PDF. Perhaps I can use those ...
Alternatively, use text placeholders in your document, but this will
force you to type in each time for each and every different data set.
Placeholders ... can you address placeholders from the commandline? For
example, I'd create a document that has 5 placeholder fields and tell LO
on the commandline to process the document so that the data for the
fields I supply on the commandline is inserted into the document. Then
the document is converted to a PDF file.
Or can I use sed to modify the content.xml file and then use LO
commandline options to turn the file into a PDF? If that's possible, I
could make a script to produce the PDF files I need automatically ...
--
Unsubscribe instructions: E-mail to users+help@global.libreoffice.org
In case of problems unsubscribing, write to postmaster@documentfoundation.org
Posting guidelines + more: http://wiki.documentfoundation.org/Netiquette
List archive: http://listarchives.libreoffice.org/global/users/
All messages sent to this list will be publicly archived and cannot be deleted
Context
- Re: [libreoffice-users] using fields in a text document (continued)
Privacy Policy |
Impressum (Legal Info) |
Copyright information: Unless otherwise specified, all text and images
on this website are licensed under the
Creative Commons Attribution-Share Alike 3.0 License.
This does not include the source code of LibreOffice, which is
licensed under the Mozilla Public License (
MPLv2).
"LibreOffice" and "The Document Foundation" are
registered trademarks of their corresponding registered owners or are
in actual use as trademarks in one or more countries. Their respective
logos and icons are also subject to international copyright laws. Use
thereof is explained in our
trademark policy.