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

rocko sunblaster5 at ...626...
Wed Apr 3 23:01:54 CEST 2013


Thanks for all you help.

I figured out why it saves as .zip instead of .odt.
Apparently there a spaces at the end of the names in the database I'm using.
So it looks like this to the Shell:
  name .odt
with a space before the .odt

So my next question is can I remove the spaces??



On 04/03/2013 10:55 AM, Willy Raets wrote:
> On Wed, 2013-04-03 at 19:36 +0200, Willy Raets wrote:
>> On Wed, 2013-04-03 at 10:13 -0700, rocko wrote:
>>> 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
>> zip -h2 in a terminal gives you more detailed instructions on use of zip
>>
>> zip -r NameOfZipFile FileOrFolderToAdd
>>
>> NameOfZipFile in your case is sFirst & ".odt"
>> FileOrFolderToAdd is the place you unzipped the original .odt to and
>> where you replaces some content.
>>
>> ------------------
>> Dim sCommand, sPath As String
>> sPath = User.Home & "place you unzipped and modified the content of odt"
>> sCommand = "zip -r " & sFirst & ".odt " & sPath
>> Shell sCommand
>> ------------------
>>
>> Watch the spaces in the strings as they are important!!
>>
> Some hints:
> 1. For command always try --help 0r -h and study the command before
> coding. We have to do the same to help you. Bit strange don you think
> 2. Always try running your planned command in a terminal before coding
> in Gambas
> 3. Study Gambas documentation on what to use best for getting the job
> done. Read every word over and over as every detail is important.
> 4. When testing in Gambas add a Print sCommand before Shell sCommand so
> that when running you see the string in the console of IDE.
> 5. If command doesn't work from Gambas try Copy/paste that string in
> Gambas IDE console to a terminal and try it there. If it doesn't work
> there, it will never work in Gambas, so back to terminal testing,
> adapting your sCommand and test app again.
>
> Keep doing this until it works..mind the details!!
>
> Good luck..





More information about the User mailing list