PyUNO sheet.setColumnDescriptions does not work with the getCol.. tuple - why?

It’s the same values/tuple that I am passing back and it does not work - why??? [otherwise the code is of no significance - just trying out the various methods]

 def Hello(*args, **kwargs):
    
    doc = XSCRIPTCONTEXT.getDocument()
    sheet = doc.Sheets[0]
    col = sheet.Columns[0]
    cell = sheet.getCellByPosition(0,0)
    visible_cells = sheet.queryVisibleCells()

    for item in dir(visible_cells):
        print(item, ' ', end=' ')

    for srvc in visible_cells.getSupportedServiceNames():
        print(srvc)
    
    import inspect
    x = sheet.getColumnDescriptions()
    print(x, type(x)) #sheet.Data
    try:
        sheet.setColumnDescriptions( x ) #<-------------------------------
    except Exception as e:
        print(dir(e))
        raise

whats the task?
copy&paste random Code-snippets is VBA-style-coding!

install and use mri for Objectinspection

I couldn’t get MRI to work on linux :frowning: There is no task - I am just trying to learn/familiarize myself with it… (the methods) I was able to pull the column names (‘Column A’, ‘Column B’, ‘Column C’, ‘Column D’, ‘Column E’, ‘Column F’, ‘Column G’) <class ‘tuple’> BUT I can’t set them!

this is what the error looks like error

it seems that MRI by extension manager sometimes doesn’t give a successful install, you can try to download .oxt file directly from github link to hanya github

@vek.m1234,

Have been using MRI in Python on Linux for a few years now. Currently tested with Ubuntu 20.04.2 with MRI version 1.3.4 using LO v7.1.3.2

A basic working class can be found here → Clearing direct format (Pyuno)

@parsley thanks - got it to work - I had installed the older version

This would only work if the sheet’s ChartRowAsLabel property is set to True.

how did you figure that out? (I did read the docs for getColumnDescriptions) It does not update on screen - just within ‘print’ - anyway to change it in the GUI? https://i.imgur.com/KoQy3U4.png

ah! found it the other way - ChartRowAsLabel has it LibreOffice: CellRange Service Reference There isn’t even a hint of it here Interface XChartDataArray

I debugged.