On Thursday 10 March 2005 01:04 pm, Mathias Bauer wrote:
> Chris Kratz wrote:
> > Hello all,
> >
> > Would there be any reason that the csv export filter for a spreadsheet
> > would create an empty file, while running it interactively would work
> > fine?
> >
> > I've been trying to modify the ooextract example application to export
> > csv with no luck.
> >
> > When I run with an existing conversion (--pdf for exmple), the script
> > produces a pdf file as expected. When I do the same and change the
> > filter to csv, I get no errors and a 1 byte file. I look at it with a
> > hex dump and it contains only "0a".
> >
> > Doing the conversion directly through the gui works fine and produces the
> > expected file. It seems as if I either have the wrong filter, or there
> > are other options that need to be passed in.
> >
> > Does anyone have any ideas what I might be doing wrong?
>
> In fact the export fails because you don't provide any filter options.
> The "csv" filter is not able to operate without them.
>
> Unfortunately the API (storeTo/AsURL) does not allow to throw a suitable
> exception (an API bug we can't fix without losing compatibility), so the
> error is not notified to the caller. There seems to be an additional bug
> that the empty file is not removed, I roughly remember to have seen such
> an issue some time ago.
>
> Best regards,
> Mathias
Hello Mathias, thanks for the response.
I guess the followup question is then how does one come up with the options to
pass in?
Here is what I tried, I used the macro record feature in OO.org to do the save
as csv manually and got the following snippet.
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dim args1(4) as new com.sun.star.beans.PropertyValue
args1(0).Name = "URL"
args1(0).Value = "file:///home/clk/projects/pyunotest/test.csv"
args1(1).Name = "FilterName"
args1(1).Value = "Text - txt - csv (StarCalc)"
args1(2).Name = "FilterOptions"
args1(2).Value = "44,34,12"
args1(4).Name = "SelectionOnly"
args1(4).Value = true
dispatcher.executeDispatch(document, ".uno:SaveAs", "", 0, args1())
end sub
I then tried to convert that to python by doing the following...
filterName ="Text - txt - csv (StarCalc)"
outProps=(
PropertyValue( "FilterName" , 0, filterName , 0 ),
PropertyValue( "Overwrite" , 0, True , 0 ),
PropertyValue( "OutputStream", 0, OutputStream(), 0),
PropertyValue( "FilterOptions", 0, "44,34,12", 0 ),
PropertyValue( "SelectionOnly", 0, True, 0)
)
which is then passed in to the call to doc.storeToURL
doc.storeToURL(destUrl, outProps)
Which sadly has the exact same behavior as before. No file is created. So,
how does one find out how to pass the parms or what might be needed?
Thanks again for your help,
-Chris
--
Chris Kratz
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]