Using Lilo Starbase Macros in LibreCalc, transfer tables and charts to writer document

I am thinking to store all drawobjects of a page somewhere eg. in an array, and then do a check if their names are same as expected.

But here is the other problem…
Macros cant change the name of the chart in real!
They remain empty!
So I am double stuck now!

The Doc.CurrentController.Select doesn’t select the object from Charts.getBy…, but the objects from the DrawPage. So if you want to get the chart by the name you set in the procedure CreateCalcWithSimpleChart, then you must iterate objects from DrawPage in some loop and test the property PersistName like in my upper example Using Lilo Starbase Macros in LibreCalc, transfer tables and charts to writer document - #10 by KamilLanda

The best way for copy&paste is getTransferable, next way is uno:Copy&uno:Paste. Or absolute hardcore - create new chart in the Writer and set to it all properties from the Calc chart.

1 Like

Finally, I did it.
I could set Title and Description Title, but I could not set the Name of the Chart (right click on chart → name → empty string).
Note that I try to set the name of chart using

	oCharts.addNewByName(sName, oRect, Array(oAddress), True, True) 



    oSheets  = ThisComponent.getSheets()
	For i = 0 to 1 step 1   
		genChartName = "stat_" & i
          	DrawObject  = oSheet.getDrawPage().getByIndex(i)
		DrawObject.Title       = genChartName
    DrawObject.Description        = genChartName
        
	next i

The name of the Chart (rightClick&Name or Format/Name) is in the properties in DrawPage, not in the Charts.

Sub getChartNameFromMenu
	dim o as object
	o=ThisComponent.Sheets(0).DrawPage.getByIndex(0)
	msgbox "Name: " & o.Name & chr(13) & "LinkDisplayName: " & o.LinkDisplayName
End Sub

More elements can be name by rightClick&Name, not only a charts.The object structure in the LibreOffice is capacious and sometimes it isn’t easy to discover where the some property is.

1 Like

About LinkName, it says that it is read-only when:
ThisComponent.getDrawPages.getByIndex(0).getByIndex(0).LinkDisplayName = “aaa”

But 

ThisComponent.getDrawPages.getByIndex(0).getByIndex(0).Name = "aaa"

set the name in LO basic, but not in actual chart. I filed a bug in bugzila, as i said.

I worked with Title of Chart (not main title), and Description of Chart.
This did the trick.
Thanks Kamil Landa

ps. Interesting! → Kamil (كامل and كميل)(കാമിൽ) is an Arabic name, sometimes used as an adjective, more usually transliterated as Kamel and Kameel which can be translated as “perfect” or “the Perfect One”. It is also used in Urdu, Persian and Sindhi meaning “complete”. (wiki)

ps. From Occitan *[landa], but ultimately from [Proto-Celtic] (“heath, open field”).

In my computer (Win10 Libre 7.2.1.1) it is functional. Example
graf3.ods (14.4 kB)

1 Like