excel files in Opendialog

Hello everyone
XOJO
Very grateful for your answers

I have a Opendialog to get the path of an excel file

How can I do to show only excel files in the Opendialog?

Dim dlg as OpenDialog
Dim f as FolderItem  
Dim docFolder As String
'Create open dialog
dlg=New OpenDialog
dlg.InitialDirectory=SpecialFolder.home

'Show the Open dialog
f=dlg.ShowModal()
IF f <> nil then
  docFolder=f.NativePath
Else
  docFolder=""
End If
Self.txtRuta.Text=docFolder

Cordially,

Raul Juarez Pulache

Here you go mate example about it - it’s better to see then to write you again same things about

https://documentation.xojo.com/index.php/OpenDialog

added

This one too
https://documentation.xojo.com/index.php/FileType

Bellow you have small example of code


Dim dlg As OpenDialog
Dim f As FolderItem
dlg = New OpenDialog
#If Not TargetLinux Then
  dlg.InitialDirectory = SpecialFolder.Documents
#Else //open Home directory on linux
  dlg.InitialDirectory = SpecialFolder.Home
#Endif

dim XlsFileType as new FileType

XlsFileType.Name = "Microsoft Excel Files"
XlsFileType.Extensions = "xls;xlsx"

dlg.Title = "Select a Text file"
dlg.Filter = XlsFileType
f = dlg.ShowModal
If f <> Nil Then
  //proceed normally
Else
  //User Cancelled
End If

Thank you so much
Bogdan Pavlovic

Happy for your great help
Blessings

Raul