Copy sheet from another ods file

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
arrowman
Posts: 8
Joined: Mon Nov 21, 2011 12:01 pm

Copy sheet from another ods file

Post by arrowman »

Hello,
I have a Basic script to copy one sheet to another sheet in the same file. I am doing it this way:

Code: Select all

ThisComponent.Sheets.copyByName(sourceSheetName, nameOfNewSheet, 32767)
But for now I need to copy sheet from another file. I woudl like to do it something like:

Code: Select all

sub testCopy
	Dim Dummy()
	oDispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
	oDocPersonList = StarDesktop.loadComponentFromURL("file:///d:/test.ods", "_blank",0, Dummy() )
	document = ThisComponent
	
	'document.Sheets.copy(oDocPersonList.getSheets.getByIndex(0), "test", 32767)
end Sub
And of course "copy" method doesn't exits. How can achieve this?

Thanks,
A.
OpenOffice 3.2.1, Windows XP/Vista
User avatar
Villeroy
Volunteer
Posts: 31279
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Copy sheet from another ods file

Post by Villeroy »

Search "SheetLinkMode" in http://www.pitonyak.org/oo.php and in this forum.
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