You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@openoffice.apache.org by bu...@apache.org on 2017/05/05 08:08:15 UTC

[Issue 127395] setActiveSheet does not work in Hidden mode

https://bz.apache.org/ooo/show_bug.cgi?id=127395

--- Comment #8 from oooforum (fr) <oo...@free.fr> ---
So weird, it seems ActiveSheet not compatible _only_ with CSV filter
I try with SYLK export and it works too.
I found a workaround with dispatcher help.

Sub csvexport
        Dim sDoc as String
        Dim Arg(0) As New com.sun.star.beans.PropertyValue
        Dim Args1(0) as new com.sun.star.beans.PropertyValue
        Dim Args2(0) as new com.sun.star.beans.PropertyValue
        Arg(0).Name = "Hidden"
        Arg(0).Value = True

        sDoc = ConvertToURL("C:\Temp\export_csv.ods")
        oDoc = StarDesktop.loadComponentFromURL(sDoc, "_default", 0, Arg() )
        'oSheet = oDoc.sheets.GetByIndex(2)
        'oDoc.CurrentController.setActiveSheet(oSheet)

        ' Workaround with these lines
        oFrame = oDoc.CurrentController.Frame
        dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
        Args1(0).Name = "Tables"
        Args1(0).Value = Array(2) 'index # for sheet
        dispatcher.executeDispatch(oFrame, ".uno:SelectTables", "", 0, args1())

        Arg2(0).Name = "FilterName"
        Arg2(0).Value = "Text - txt - csv (StarCalc)"
        'Arg2(0).Value = "dBase"

        outputUrl = ConvertToURL( "C:\Temp\test.csv")
        'msgbox oDoc.CurrentController.ActiveSheet.Name
        oDoc.storeToURL( outputUrl, Arg() )
        oDoc.close(true)
End Sub

I don't know if this issue must be reopen

-- 
You are receiving this mail because:
You are the assignee for the issue.