Hey,

if someone is interested: I found a very terrible solution, but it works:
  ...
  dim oFrame as object
  dim dispatcher as object
  dim oCalcDoc as object
  dim sUrl as string

  sUrl = convertToURL("D:\Daten\AUSKUNFT.DBF")

  oCalcDoc = starDesktop.loadComponentFromURL("private:factory/scalc",
"_blank", 0, array())

  rem get access to the document-frame
  oFrame   = oCalcDoc.CurrentController.Frame
  dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")

  dim args1(2) as new com.sun.star.beans.PropertyValue
  args1(0).Name = "URL"
  args1(0).Value = sURL
  args1(1).Name = "FilterName"
  args1(1).Value = "dBase"
  args1(2).Name = "FilterOptions"
  args1(2).Value = "IBMPC_850"

  rem execute dispatch
  dispatcher.executeDispatch(oFrame, ".uno:Open", "", 0, args1())
  rem hide the currentWindow
  oFrame.getContainerWindow().setVisible(false)
  rem get access to the only sheet
  otab = oFrame.creator.currentComponent.sheets(0)

  msgbox oTab.getCellrangeByName("A3").string
  ...

It is nessesary to create first an empty frame (new document) before I
can open the dbf file (with the dispatch command). Unfortunatly this din
not work in hidden mode.... so it is still visible during loading
process. So, I do have a workaround - but it is still terrible.
If someone do have a better idea - please let me know...

Thanks
Thomas





Thomas Krumbein schrieb:
> Hey,
> 
> I do have a problem to open a *.dbf file in calc via basic-macro.
> Typically it is not a problem - I am using the following code and it
> works fine (in my systems - all OOo > 3.2). It is even not nessessary to
> pass an FilterName - just open it.
> 
> 
>   ...
>   sURL = convertToURL("D:\Daten\AUSKUNFT.DBF")
> 
> 
>   REM Datei als Calcdokument hidden öffnen
>   dim arg(1) as new com.sun.star.beans.PropertyValue
>   arg(0).name = "Hidden"
>   arg(0).value = true
>   arg(1).name = "FilterName"
>   arg(1).value = "dBase"
> 
>   oCalcDoc = starDesktop.loadComponentFromURL(sURL, "_blank", 0, arg())
> '  xray oCalcDoc
>   oTab = oCalcDoc.getSheets().getByIndex(0)
>   ...
> 
> Unfortunatly it does not work in OOo 3.0.1 on win 2000. In this case
> "loadComponentFromURL" Methode delivers nothing - even not an error. I
> believe, that the filter is defect or something else.
> The variable "oCalcDoc" is empty, next line will create an error.
> 
> Now I need a solution to open this file (*.dbf) as a calc-document - it
> is not possible to change the OOo version or the system.
> 
> Has someone a workaround or a solution?
> 
> Thank you for any hints
> 
> Thomas
> 
> 
> 
> 


-- 
## Marketing deutschsprachiges Projekt
## http://de.openoffice.org  - www.openoffice.org
## Vorstand OpenOffice.org Deutschland e.V.
## Mitglieder willkommen: www.OOoDeV.org

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@api.openoffice.org
For additional commands, e-mail: dev-h...@api.openoffice.org

Reply via email to