[Solved] Getting data from TXT to Calc

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
king_026
Posts: 22
Joined: Wed Oct 15, 2008 8:42 pm

[Solved] Getting data from TXT to Calc

Post by king_026 »

Hi,

I'm trying to get data from a TXT file into a calc sheet using a macro. When I used LoadComponentFromURL, it opens in writer (though other files open fine this way) and using a Link to External Data source doesn't work at all (can't even be done manually using the dialogs).

Can someone please tell me some way to force the file to open in calc? Or any other workaround to have a macro put that data into an open spreadsheet?

Code: Select all

oSheet.link(sURL, "Sheet1", "scalc: Text - txt - csv (OpenOffice.org Calc)", "32/MRG,34,0,1", "NORMAL")
or

Code: Select all

aArgs(0).Name = "FilterName"
	aArgs(0).Value = "Repeating space delimeted"	' "scalc: Text - txt - csv (OpenOffice.org Calc)"
	aArgs(1).Name = "FilterFlags"
	aArgs(1).Value = "32/MRG,34,0,1"	'32/MRG for repeating spaces, 34 for "
	aArgs(3).Name = "ReadOnly"
	aArgs(3).Value = True

OpenLST = oFrame.LoadComponentFromUrl(sURL, "_blank", 2, aArgs())
Thanks.
Last edited by king_026 on Wed Oct 22, 2008 8:14 pm, edited 1 time in total.
OOo 2.2.X on Ms Windows XP
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Getting data from TXT to calc

Post by Villeroy »

Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply