sergio ha scritto:
Thanks for your answer.
I explain better as I can: I open a calc document, I read the first
record, where there are the header, then I open a writer document, and
I should open a non-modal(?) dialog, where I ask the user: "Put the
cursor where you want the first header", with a ok button to push when
he has positioned the cursor, and so on to the last header. (The user
can also modify the writer document, in the meanwhile).
There will be string and value data in the calc document.
Andrew Douglas Pitonyak ha scritto:
What type of data file do you want to open?
What kind of data do you want to read?
How do you know where to put the data?
I find a solution with copy-paste from this discussion
http://user.services.openoffice.org/en/forum/viewtopic.php?f=20&t=5815&start=0&st=0&sk=t&sd=a
This seems working.
I append the final macro.
REM ***** BASIC *****
Dim vData as Variant
Dim Ccount as Integer
Global g_Dlg, g_Stop as Boolean
Sub Main
oCalc = ThisComponent
StarDesktop.loadComponentFromUrl(UrlFile,"_blank",0,array())
DataFinder(oCalc,1)
for l = 0 to Ccount
Dialog(vData(l))
next
End Sub
Function UrlFile
oFilePicker = createUnoService ("com.sun.star.ui.dialogs.FilePicker")
oFilePicker.execute
Url = oFilePicker.getSelectedFiles
UrlFile = Url(0)
End Function
Function DataFinder(oCalc, Optional Row)
oSel = oCalc.CurrentSelection
if Row then
Rcount = Row-1
else
Rcount = oSel.rows.count-1
endif
Ccount = oSel.columns.count-1
aData = oSel.getDataArray
for i = 0 to Rcount
vData = aData(i)
next
End Function
Sub Dialog(Optional Data)
DialogLibraries.loadLibrary("MyLibrary")
oLib = DialogLibraries.getByName("MyLibrary")
g_Dlg = CreateUnoDialog(oLib.getByName("Dialog1"))
g_Dlg.setVisible(True)
g_Dlg.model.TextField1.text = Data
REM test status every second:
do until g_Stop
wait 1000
loop
g_Dlg.setVisible(False)
g_Stop = false
End Sub
Sub someEvent(oEv)
g_Stop = True
End Sub
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]