![]() It's also not too hard to loop through all open documents, if you find it more convenient to open multiple files at the same time. If this is a problem, you may find it easier to open, save and close each by hand, running the macro to optimize all tables in the currently open document. The most difficult part is closing properly without a crash, as closing events can sometimes interrupt each other. ![]() There are also ways to loop through a set of documents, so the code can open, optimize, save and close each document. cellsRange = table.getCellRangeByPosition(įrame, ".uno:SetOptimalColumnWidth", "", 0, ()) Here is some python code from a project of mine. ThisComponent.getCurrentController().select(oTable) The following Basic code from Andrew Pitonyak's macro document section 7.2.1 shows how to select a table. The code needs to loop through all tables in the document, select each one and then optimize the selected table. However, it would already make me very happy if I could automatically format all tables in a single docx file. ![]() It would be awesome if I could apply it to all tables in multiple docx files at once. If you pre-select a cell and choose Freeze Panes, all columns to the left and rows above the pre-selected cell will remain in view. Is there a way to apply the optimal column width setting to all tables in a file? This does widen all the tables, however the format is not desirable. I did this by using the following macro (snippet): tables = ThisComponent.TextTables I've managed to set the relative width of all tables to 100% by changing this property of all my tables: I've also tinkered with the examples given in this different SO question. This is an improvement, but it still requires a lot of manual work. I've assigned a keyboard shortcut to this macro such that I can reformat a single table by: Rem -ĭocument = ĭispatcher = createUnoService(".DispatchHelper")ĭispatcher.executeDispatch(document, ".uno:SelectAll", "", 0, Array())ĭispatcher.executeDispatch(document, ".uno:SetOptimalColumnWidth", "", 0, Array()) I've created the following macro that does the formatting for a single table: REM ***** BASIC ***** ![]() Selecting the entire table (ctrl-a, ctrl-a).Unfortunately, somehow all the tables have been squished in Writer as shown: I have 100+ *.docx files created with Microsoft Word on a Windows machine that I would like to use with LibreOffice Writer. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |