How to avoid a CloseVetoException (report)

View: New views
4 Messages — Rating Filter:   Alert me  

How to avoid a CloseVetoException (report)

by Peter Eberlein-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi,

I want to open a report, save it as a writer document and close it:

aProp(0).Name = "ActiveConnection"
aProp(0).Value = xConnection
aProp(1).Name = "OpenMode"
aProp(1).Value = "open"
       
args(0).Name = "Overwrite"
args(0).Value = true
        report=reports.loadComponentFromURL(sReportName,"_blank",0,aProp())
report.storeToURL(newURL,args())
report.close(true)

Here I get the CloseVetoException, even with .close(false).
Any hints how to circumvent this?

Regards

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: How to avoid a CloseVetoException (report)

by Frank Schoenheit, Sun Microsystems Germany :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Peter,

> report=reports.loadComponentFromURL(sReportName,"_blank",0,aProp())
> report.storeToURL(newURL,args())
> report.close(true)
>
> Here I get the CloseVetoException, even with .close(false).
> Any hints how to circumvent this?

The report (this holds for forms as well) is effectively owned by its
respective css.sdb.DocumentDefinition. You can obtain it from the
reports container (reports, in your example), and tell it to close, by
executing a "close" command. Something like (out of my head):

  reportDefinition = reports.getByName( sReportName )
  Dim command as new com.sun.star.ucb.Command
  command.Name = "close"
  reportDefinition.execute( command, _
    reportDefinition.createCommandIdentifier, _
    null ) ' or whatever equivalents exist in Basic :)

Ciao
Frank

--
- Frank Schönheit, Software Engineer         frank.schoenheit@... -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: How to avoid a CloseVetoException (report)

by Peter Eberlein-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Frank,
Am 05.11.2009 12:25, schrieb Frank Schoenheit, Sun Microsystems Germany:

> Hi Peter,
>
>> report=reports.loadComponentFromURL(sReportName,"_blank",0,aProp())
>> report.storeToURL(newURL,args())
>> report.close(true)
>>
>> Here I get the CloseVetoException, even with .close(false).
>> Any hints how to circumvent this?
>
> The report (this holds for forms as well) is effectively owned by its
> respective css.sdb.DocumentDefinition. You can obtain it from the
> reports container (reports, in your example), and tell it to close, by
> executing a "close" command. Something like (out of my head):
>
>    reportDefinition = reports.getByName( sReportName )
>    Dim command as new com.sun.star.ucb.Command
>    command.Name = "close"
>    reportDefinition.execute( command, _
>      reportDefinition.createCommandIdentifier, _
>      null ) ' or whatever equivalents exist in Basic :)
>
works fine, thanks.

what also works, is
reportDefinition.close()

Regards

Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...


Re: How to avoid a CloseVetoException (report)

by Frank Schoenheit, Sun Microsystems Germany :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi Peter,

> what also works, is
> reportDefinition.close()

ah, right ... complete forgot about this, it's a method from the
XSubComponent interface, which I introduced exactly for the reason of
not wanting to deal with all that UCB/Command stuff :)

Ciao
Frank

--
- Frank Schönheit, Software Engineer         frank.schoenheit@... -
- Sun Microsystems                      http://www.sun.com/staroffice -
- OpenOffice.org Base                       http://dba.openoffice.org -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@...
For additional commands, e-mail: dev-help@...