Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Simple csv macro import works only from basic editor in new LO version. What's wrong ?

I have a very simple macro that imports data in libreoffice calc from two CSV files. It has been always working but on my new laptop/new LO the first dataset is not imported, while the second it is.

Funny enought if I run the code from the BASIC editor rather than from the button I implemented, the macro works.

What could cause this different behaviour ?

The code is here: http://pastebin.com/FipK2qc0

Simple csv macro import works only from basic editor in new LO version. What's wrong ?

I have a very simple macro that imports data in libreoffice calc from two CSV files. It has been always working but on my new laptop/new LO the first dataset is not imported, while the second it is.

Funny enought if I run the code from the BASIC editor rather than from the button I implemented, the macro works.

What could cause this different behaviour ?

The code is here: http://pastebin.com/FipK2qc0

EDIT: Importing from line 0 didn't help. Very weird if I run the macro from the "run macro" command I got both the importers working, while if I run it from the button associated to the macro I got only the second import to work. To have both the importers to work from the button I need to write the first importers two times:

tempDoc = starDeskTop.loadComponentFromURL(fUrl, "_blank", 0, oPropertyValue)
copyData(tempDoc, thisDoc, fDataSheet)
tempDoc.close (-1)
tempDoc = starDeskTop.loadComponentFromURL(fUrl, "_blank", 0, oPropertyValue)
copyData(tempDoc, thisDoc, fDataSheet)
tempDoc.close (-1)
tempDoc2 = starDeskTop.loadComponentFromURL(pUrl, "_blank", 0, oPropertyValue)
copyData(tempDoc2, thisDoc, pDataSheet)
tempDoc2.close (-1)

I am starting to think this is a lo bug, as it was working with previous versions..

Simple csv macro import works only from basic editor in new LO version. What's wrong ?

I have a very simple macro that imports data in libreoffice calc from two CSV files. It has been always working but on my new laptop/new LO the first dataset is not imported, while the second it is.

Funny enought if I run the code from the BASIC editor rather than from the button I implemented, the macro works.

What could cause this different behaviour ?

The code is here: http://pastebin.com/FipK2qc0

EDIT: EDIT:

Importing from line 0 didn't help. help.

Very weird if I run the macro from the "run macro" command I got both the importers working, while if I run it from the button associated to the macro I got only the second import to work. work.

To have both the importers to work from the button I need to write the first importers two times:

tempDoc = starDeskTop.loadComponentFromURL(fUrl, "_blank", 0, oPropertyValue)
copyData(tempDoc, thisDoc, fDataSheet)
tempDoc.close (-1)
tempDoc = starDeskTop.loadComponentFromURL(fUrl, "_blank", 0, oPropertyValue)
copyData(tempDoc, thisDoc, fDataSheet)
tempDoc.close (-1)
tempDoc2 = starDeskTop.loadComponentFromURL(pUrl, "_blank", 0, oPropertyValue)
copyData(tempDoc2, thisDoc, pDataSheet)
tempDoc2.close (-1)

I am starting to think this is a lo bug, as it was working with previous versions..