Page 1 of 1

[Solved] Save file dialog

Posted: Sat Jan 23, 2010 2:12 pm
by dstockman12
Greetings:

I need to open a dialog that allows a user to select a directory and name a new (or existing) file to save. This is a typical Save or Save As dialog box in Windows. I have found FilePicker, but this appears to only be for opening a file. What is the corresponding Save/Save As dialog box called? Thanks in advance.

Doug

Re: Save file dialog

Posted: Sat Jan 23, 2010 6:46 pm
by Villeroy
It's the same service which supports 11 "templates" for loading and saving plus optional extra controls:
11 constants specify the type of file-open or file-save:
http://api.openoffice.org/docs/common/r ... ption.html

Re: Save file dialog

Posted: Thu Jan 28, 2010 4:22 pm
by dstockman12
Villeroy:

Thanks! I got it working, although I am not sure my methods are fully sound. It took me a while to figure out how to set the constants. Did I do it correctly? Do I need the ConvertToURL in here?

Code: Select all

' ******* FilePicker Save File ******************************************
Function FilePickSave As String
Dim FilePicker As Object
Dim FPtype(0) As Integer

FilePicker = CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
FPtype(0)=com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_SIMPLE
FilePicker.initialize(FPtype())

If FilePicker.execute() Then
	FilePickSave = ConvertToURL(FilePicker.Files(0))
'	msgbox FilePickSave
EndIf

End Function
Thanks again. If this is correct, I will place [SOLVED] in the title.

Doug

Re: Save file dialog

Posted: Thu Jan 28, 2010 4:32 pm
by Villeroy
It looks right and it works.

Re: [Solved] Save file dialog

Posted: Wed Feb 03, 2010 1:40 pm
by MikeytheMagnificent
Yep :)

If it looks like a dog and it barks like a dog, it's always worth a sporting bet that it might not be a croc'

:super:

You have to make allowance for Villeroy, too long in the Fatherland, don't you know!
Give him credit though, he's lightening fast out of the traps,
appreciated and faithful servant of the forums.