[Gambas-user] Output to Libre Office Writer ??

rocko sunblaster5 at ...626...
Wed Apr 3 19:13:46 CEST 2013


Ok thanks for suggestions.

I'm now having problems with zipping the files.
I "m naming the files dynamically with the first name of the
person from my database.

But the zip command sometimes saves the file as a zip not .odt.
Why it does this I don't know, actually it does this a lot/

I'm using this as my zip code:
zip -r " & sFirst & ".odt ." Wait

How do I get my files saved with the .odt extension all the time??
I tried renaming any .zip to a .odt with the rename command
  but thats not working either.




On 04/03/2013 10:05 AM, Willy Raets wrote:
> On Wed, 2013-04-03 at 09:18 -0700, rocko wrote:
>> Ok I got that to work, but the code is kinda long and ugly
>> as I have to save the file after doing a /Replace/.
>>
>> I have 6 fields I have to replace, so thats 6 Replace statements with 6
>> File.Save,
>> I can put in a Function and just call the function when I need it, but
>> still I would
>> think the Replace could take multiple arguments for replacing multiple
>> fields.
>> But oh well..
> As Fabien wrote:
> Load the file in a string
> Replace as many as need
> Save the string in the file
>
> Dim sFileText, sFilePath As String
>
> sFilePath = "home/rocko/Zip/content.xml"
> '-- Load file in string --
> sFileText = File.Load(sFilePath)
> '-- Replace as many as needed --
> sFileText = Replace(sFileText, "$(Name)", mName)
> sFileText = Replace(sFileText, ...)
> sFileText = Replace(sFileText, ...)
> sFileText = Replace(sFileText, ...)
> sFileText = Replace(sFileText, ...)
> sFileText = Replace(sFileText, ...)
> '-- Save string to file --
> File.Save(sFilePath, sMyFileText)
>
> Only one file load and one file save.
>
> Hope this will help you understand the matter..
>
>
>>
>>
>> On 04/03/2013 08:57 AM, Willy Raets wrote:
>>> On Wed, 2013-04-03 at 08:39 -0700, Rocko wrote:
>>>> so each value needs it's own the replace statement?
>>> YES
>>>
>>>> On Apr 3, 2013 8:28 AM, "Fabien Bodard" <gambas.fr at ...626...> wrote:
>>>>
>>>>> Ok so it's one call by entry.
>>>>>
>>>>> Unzip odt
>>>>> Load the file in a string
>>>>> Replace as many as need
>>>>> Save the string in the file
>>>>> Zip the directory
>>>>>
>>>>> Simple!
>>>>> Le 3 avr. 2013 17:20, "Rocko" <sunblaster5 at ...626...> a écrit :
>>>>>
>>>>>> I don't think you understanf, I want to replace different fields with
>>>>>> different values not all the same value
>>>>>> On Apr 3, 2013 1:41 AM, "Fabien Bodard" <gambas.fr at ...626...> wrote:
>>>>>>
>>>>>>> Replace,
>>>>>>> Replace all the words that match the pattern
>>>>>>> Read the doc!
>>>>>>> Le 3 avr. 2013 01:10, "rocko" <sunblaster5 at ...626...> a écrit :
>>>>>>>
>>>>>>>> Is it possible to do multiple replacing with/Replace/
>>>>>>>>
>>>>>>>> I have several fields that I want to change in an .odt file
>>>>>>>> do I have to do multiple Replace statements or can I
>>>>>>>> put them all in one /Replace/ statement??
>>>>>>>>
>>>>>>>>
>>>>>>>> On 04/02/2013 03:34 AM, Fabien Bodard wrote:
>>>>>>>>> Le 2 avr. 2013 01:37, "rocko" <sunblaster5 at ...626...> a écrit :
>>>>>>>>>> Not sure I'm using /Replace$/ correctly.
>>>>>>>>>> I want to replace instance of $(Name) in the XML file
>>>>>>>>>> with the value of the /mName/ variable
>>>>>>>>>>
>>>>>>>>>> Code:
>>>>>>>>>> /xName = "home/rocko/Zip/content.xml"//
>>>>>>>>>> // newFile = Replace$(xName, "$(Name)", mName)/
>>>>>>>>> Newfile=replace (file. Load(xname), "$(Name )",mname )
>>>>>>>>> File. Save(xname, newfile)
>>>>>>>>>> Of course this doesn't work, But I don't know why
>>>>>>>>>>
>>>>>>>>>> On 03/31/2013 05:21 PM, Benoît Minisini wrote:
>>>>>>>>>>> Le 01/04/2013 01:32, rocko a écrit :
>>>>>>>>>>>> I actually tried that after sending my response.
>>>>>>>>>>>> lo and behold! XML file woo hoo!
>>>>>>>>>>>>
>>>>>>>>>>>> So I assume I can just do a search thru th XML file and change
>>>>>>> things
>>>>>>>>>>>> then re-save
>>>>>>>>>>>> the file and re-zip it like you said.
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>>
>>>>>>>>>>>> So how do I unzip and re-zip a file in Gambas?, sorry  this is
>>>>>> kinda
>>>>>>>>> new
>>>>>>>>>>>> to me.
>>>>>>>>>>> SHELL "zip ..." WAIT
>>>>>>>>>>>
>>>>>>>>>>> SHELL "unzip ..." WAIT
>>>>>>>>>>>
>>>>>>>>>>> That run the shell commands as if you typed them in a terminal.
>>>>>>>>>>>
>>>>>>>>>>> There is a compression component that allows you to do the same
>>>>>> thing
>>>>>>>>>>> without running external process, but it is a more complex to
>>>>>>> explain.
>>>>>>>>>>>> Which kind of search functions does gambas have?? regex I
>>>>> assume,
>>>>>>> any
>>>>>>>>>>>> others??
>>>>>>>>>>>>
>>>>>>>>>>> I use Replace$(). No need for regexp. If your search pattern are
>>>>>> like
>>>>>>>>>>> "$(field name)", you won't mix up with any OpenOffice XML syntax.
>>>>>>>>>>>
>>>>>>>>>>> Don't forget to look at XML format for correctly quoting
>>>>> characters
>>>>>>>> that
>>>>>>>>>>> must be quoted.
>>>>>>>>>>>
>>>>>>>>>>> Regards,
>>>>>>>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>>>>>> Own the Future-Intel® Level Up Game Demo Contest 2013
>>>>>>>>>> Rise to greatness in Intel's independent game demo contest.
>>>>>>>>>> Compete for recognition, cash, and the chance to get your game
>>>>>>>>>> on Steam. $5K grand prize plus 10 genre and skill prizes.
>>>>>>>>>> Submit your demo by 6/6/13. http://p.sf.net/sfu/intel_levelupd2d
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Gambas-user mailing list
>>>>>>>>>> Gambas-user at lists.sourceforge.net
>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>>> ------------------------------------------------------------------------------
>>>>>>>>> Own the Future-Intel(R) Level Up Game Demo Contest 2013
>>>>>>>>> Rise to greatness in Intel's independent game demo contest. Compete
>>>>>>>>> for recognition, cash, and the chance to get your game on Steam.
>>>>>>>>> $5K grand prize plus 10 genre and skill prizes. Submit your demo
>>>>>>>>> by 6/6/13. http://altfarm.mediaplex.com/ad/ck/12124-176961-30367-2
>>>>>>>>> _______________________________________________
>>>>>>>>> Gambas-user mailing list
>>>>>>>>> Gambas-user at lists.sourceforge.net
>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>>>>>>> .
>>>>>>>>>
>>>>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>>>> Minimize network downtime and maximize team effectiveness.
>>>>>>>> Reduce network management and security costs.Learn how to hire
>>>>>>>> the most talented Cisco Certified professionals. Visit the
>>>>>>>> Employer Resources Portal
>>>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html
>>>>>>>> _______________________________________________
>>>>>>>> Gambas-user mailing list
>>>>>>>> Gambas-user at lists.sourceforge.net
>>>>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>>> Minimize network downtime and maximize team effectiveness.
>>>>>>> Reduce network management and security costs.Learn how to hire
>>>>>>> the most talented Cisco Certified professionals. Visit the
>>>>>>> Employer Resources Portal
>>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html
>>>>>>> _______________________________________________
>>>>>>> Gambas-user mailing list
>>>>>>> Gambas-user at lists.sourceforge.net
>>>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>>> Minimize network downtime and maximize team effectiveness.
>>>>>> Reduce network management and security costs.Learn how to hire
>>>>>> the most talented Cisco Certified professionals. Visit the
>>>>>> Employer Resources Portal
>>>>>> http://www.cisco.com/web/learning/employer_resources/index.html
>>>>>> _______________________________________________
>>>>>> Gambas-user mailing list
>>>>>> Gambas-user at lists.sourceforge.net
>>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>>>>
>>>>> ------------------------------------------------------------------------------
>>>>> Minimize network downtime and maximize team effectiveness.
>>>>> Reduce network management and security costs.Learn how to hire
>>>>> the most talented Cisco Certified professionals. Visit the
>>>>> Employer Resources Portal
>>>>> http://www.cisco.com/web/learning/employer_resources/index.html
>>>>> _______________________________________________
>>>>> Gambas-user mailing list
>>>>> Gambas-user at lists.sourceforge.net
>>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>>>>>
>>>> ------------------------------------------------------------------------------
>>>> Minimize network downtime and maximize team effectiveness.
>>>> Reduce network management and security costs.Learn how to hire
>>>> the most talented Cisco Certified professionals. Visit the
>>>> Employer Resources Portal
>>>> http://www.cisco.com/web/learning/employer_resources/index.html
>>>> _______________________________________________
>>>> Gambas-user mailing list
>>>> Gambas-user at lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/gambas-user
>> ------------------------------------------------------------------------------
>> Minimize network downtime and maximize team effectiveness.
>> Reduce network management and security costs.Learn how to hire
>> the most talented Cisco Certified professionals. Visit the
>> Employer Resources Portal
>> http://www.cisco.com/web/learning/employer_resources/index.html
>> _______________________________________________
>> Gambas-user mailing list
>> Gambas-user at lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/gambas-user





More information about the User mailing list