How to copy cell's contents into a main document?

I need to automate the following actions:

For each table, extract the contents of the first cell (“A1”) and paste just before the table.

    localContext = uno.getComponentContext()
    resolver = localContext.ServiceManager.createInstanceWithContext(
        "", localContext
    ctx = resolver.resolve("uno:socket,host=localhost,port=2002;urp;StarOffice.ComponentContext")
    instance = subprocess.Popen(" ".join(
                ]), shell=True)

    smgr = ctx.ServiceManager
    desktop = smgr.createInstanceWithContext("", ctx)
    uno_path = uno.systemPathToFileUrl(str(doc_path))

    doc = desktop.loadComponentFromURL(uno_path, "_blank", 0, ())
    xTables = doc.getTextTables()
    for xTable in xTables:
        oCell = xTable.getCellByPosition(0, 0)
        oVC = doc.getCurrentController().getViewCursor()
        oVC.gotoRange(oCell, False)
        oVC.goUp(1, False)
        oEnum = oVC.getText().createEnumeration()
        oPrevPar = None
        oNextPar = None
        noteTable = False

        if len(xTable.DataArray) == 1 and len(xTable.DataArray[0]) == 2 and xTable.DataArray[0][0].lower() == "note":
            noteTable = True
            oEnum = oVC.getText().createEnumeration()
            oPrevPar = None
            oPar = None
            while oEnum.hasMoreElements():
                oPrevPar = oPar
                oPar = oEnum.nextElement()
                if oPar == xTable:

                    oPrevPar.Text.insertTextContent(oPrevPar.Text.getEnd(), xTable.getCellByName("A1"), True) # Does not work

Please note, that I want to copy not only the cell’s text, but also all the complicated mosaic of formatting.

please, add a test file for help you.

Here is my solution using Basic

sub copyFancyTableText
	Dim doc: doc = ThisComponent
    Dim xTables: xTables = doc.getTextTables()
    Dim xTable,oCell,oVC,oEnum,oPrevPar,oNextPar,noteTable,oPar
    Dim oFrame,oDispatcher 

	'Prep visual cursor
	oVC = doc.getCurrentController().getViewCursor()   
	'Dispatcher bits for clipboard functionality
	oDispatcher = createUnoService("")
	oFrame = ThisComponent.CurrentController.Frame
    for each xTable in xTables
        oCell = xTable.getCellByPosition(0, 0)

        oVC.gotoRange(oCell, False)
		'Copy cell
		oDispatcher.executeDispatch(oFrame, ".uno:Copy", "", 0, Array())
        'Move VC up, above table.
        oDispatcher.executeDispatch(oFrame, ".uno:Paste", "", 0, Array())
end sub

Here are the results,