Used_range = getUsedRectangle(focused_sheet) Src_cell = row.getCellByPosition(I_COL_TO_READ_FROM, 0)įocused_sheet = connectToLO().CurrentController.ActiveSheet # if you know what you deal with right away But you may want to remove overhead of this test # see comments under the post: a cell has different state when a number is If row.getCellByPosition(I_COL_MARKS, 0).String = MARK:ĭst_cell = dst_col.getCellByPosition(0, row_index) # the "unused rectangle" by default is 1048576×1024, which probably isn't something ".UnoUrlResolver", localContext )Ĭtx = resolver.resolve( "uno:socket,host=localhost,port=2002 urp StarOffice.ComponentContext" )ĭesktop = smgr.createInstanceWithContext( ".Desktop",ctx) # get the uno component context from the PyUNO runtime # soffice -calc -accept="socket,host=localhost,port=2002 urp StarOffice.ServiceManager" I_COL_TO_WRITE_TO = 2 # the empty column to write new numbers to I_COL_TO_READ_FROM = 0 # the column with numbers Here’s a code that does what you asked for: #!python on Fedora it’s libreoffice-pyuno package). You may need to install some python package for import uno line to work (e.g. There’re various language backends to it, here I’m using Python. LibreOffice supports scirpting through UNO API. a macro hopefully someone will write answers on that.īut I’ve been lately twiddling with scripting LO Calc, and I figured I could share some of what I learned, and answer your question. So keep in mind: there might be better ways, e.g. I’m not the best person to answer this since I don’t have much experience with Office stuff.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |