Alexander Thurgood <alex.thurg...@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 ... 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+h...@global.libreoffice.org In case of problems unsubscribing, write to postmas...@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