[Solved-Workaround] Insert/delete cells within tables?

Discuss the word processor
Post Reply
Doranwen
Posts: 83
Joined: Sun May 26, 2019 6:46 am

[Solved-Workaround] Insert/delete cells within tables?

Post by Doranwen »

It's very easy to insert or delete a row or column in a table. But is it at all possible to insert or delete *cells*, the way you can in Calc (shifting the remaining ones up or down to compensate)?

I'm needing to do some planning that will involve aligning data in two to four different lists simultaneously. This would be easy to do in Calc, except that I'll be doing a lot of editing within the items as well as multi-line items, and Calc's default behavior when clicking on a cell and typing is to overwrite - I want to be able to click in it and immediately edit, hit return and have it create a new line, etc.

Is this at all possible to do with Writer, or do I need to stick with Calc, as annoying as it will be? (Double-clicking instead of clicking may seem a minor annoyance, but these lists will end up over a hundred items long each and I've got about eight sets of them to do. It adds up.)

For a sample of what I'm talking about, in case it's not clear - I might have the situation below:

(1) (A) (B)
(2) (C) (D)

And if I decided I needed a new item in the last column, I would insert E like so:

(1) (A) (B)
(2) (C) (E)
(3) ( ) (D)

Deleting B from the original would produce:

(1) (A) (D)
(2) (C) ( )

I tried searching but can only find instructions on how Word does it, not Writer. I've not been able to find any way to do it in Writer. It's basically like keeping multiple numbered lists aligned across multiple pages. If I have to stick with Calc, I will, I've just been trying to find an alternative method if one exists. (Tried searching for other software even, but everything either doesn't align in grids or it doesn't have the correct delete/insert functionality as I've described above.)
Last edited by Doranwen on Tue Oct 04, 2022 2:07 am, edited 1 time in total.
LibreOffice 5.1.6.2 on Linux Mint 18.1
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Insert/delete cells within tables?

Post by JeJe »

to move cells down

Select the cells.
Press ctrl+x to cut
click in the cell lower down where you want to move the items to
Press ctrl+v to paste
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Doranwen
Posts: 83
Joined: Sun May 26, 2019 6:46 am

Re: Insert/delete cells within tables?

Post by Doranwen »

If the cell below it already has stuff in it, which it will because I'm inserting info in between existing cells, that won't work. I'm talking a list of dozens of items. You're saying to select however many *dozens* of items there might be, cut them all, and then paste, which is rather tedious due to the scroll involved. I was asking if Writer had a way to automatically shift them all down the way Calc will.
LibreOffice 5.1.6.2 on Linux Mint 18.1
Bill
Volunteer
Posts: 8932
Joined: Sat Nov 24, 2007 6:48 am

Re: Insert/delete cells within tables?

Post by Bill »

Doranwen wrote: Mon Oct 03, 2022 2:52 am I was asking if Writer had a way to automatically shift them all down the way Calc will.
No. Such commands would be under Insert/Delete in the context menu for cells and under Table > Insert/Delete when a cell is selected. They aren't there and would not be hidden elsewhere.
AOO 4.1.14 on Ubuntu MATE 22.04
Doranwen
Posts: 83
Joined: Sun May 26, 2019 6:46 am

Re: Insert/delete cells within tables?

Post by Doranwen »

Alas! Thanks for confirming my fear there. I wish it did - that's one feature Word has that it doesn't, and really ought to.
LibreOffice 5.1.6.2 on Linux Mint 18.1
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Insert/delete cells within tables?

Post by JeJe »

There's the macro recorder facility will may help you implement what you want - and help here if you don't succeed.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Insert/delete cells within tables?

Post by JeJe »

This is to start you off if you want a macro to do it:

If you put the cursor in a cell, then the following macro will move the contents of that column (to the end of the column) down 1 making space for a new entry in that cell. A table row will be added if the string of the last cell in the column is not empty.

You can see if it works for you (on a copy of your document) and modify it for your needs.

Code: Select all

Sub MoveCellContentsDown1
controller = thiscomponent.currentcontroller
vc =controller.viewcursor
st =vc.cell.cellname
cell = vc.cell
col = asc( st)-65
mid(st,1,1)=""
row = val(st)-1

tbl = vc.texttable
rows = tbl.getrows
endcell= tbl.getcellbyposition(col,rows.count-1)
if endcell.string <> "" then rows.insertbyindex(rows.count,1)
controller.select tbl.getcellrangebyposition(col,row,col,rows.count -2)
trans = controller.gettransferable
controller.select tbl.getcellbyposition(col,row+1)
controller.inserttransferable trans
cell.string = ""
End Sub
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
User avatar
MrProgrammer
Moderator
Posts: 4895
Joined: Fri Jun 04, 2010 7:57 pm
Location: Wisconsin, USA

Re: Insert/delete cells within tables?

Post by MrProgrammer »

Doranwen wrote: Sun Oct 02, 2022 11:35 pm But is it at all possible [In Writer] to insert or delete *cells*, the way you can in Calc (shifting the remaining ones up or down to compensate)?
The feature you want does not exist, so you will need to be satisfied with workarounds.

Doranwen wrote: Sun Oct 02, 2022 11:35 pm This would be easy to do in Calc, except that I'll be doing a lot of editing within the items as well as multi-line items, and Calc's default behavior when clicking on a cell and typing is to overwrite - I want to be able to click in it and immediately edit, hit return and have it create a new line, etc.
In Calc, just press F2 before editing if you want to add to the contents instead of overwriting them.

Doranwen wrote: Mon Oct 03, 2022 2:52 am I was asking if Writer had a way to automatically shift them all down the way Calc will.
Yes, but you must structure your Writer table differently. Say you have four columns and and twenty rows. Instead of creating an 20x4 table, create a 1x4 table. Then in each of the four cells create a 20x1 table. After you create the first one you can use Edit → Repeat to create the other three. To keep the rows aligned, ensure the cells of the four tables are all the same height. This is done with Table → Select → Table then Table → Autofit → Row Height → Uncheck Fit to Size → Height → your choice.

Doranwen wrote: Mon Oct 03, 2022 5:54 am that's one feature Word has that [Writer] doesn't
Not relevant in an OpenOffice forum. It is what it is. If you are not satisfied with the free product, you don't have to use it.


If you don't like these ideas, just ignore them. Don't complain about free help with your problem.

If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel.   The locale for any menus or Calc formulas in my posts is English (USA).
Doranwen
Posts: 83
Joined: Sun May 26, 2019 6:46 am

Re: Insert/delete cells within tables?

Post by Doranwen »

MrProgrammer wrote: Mon Oct 03, 2022 4:01 pm Yes, but you must structure your Writer table differently. Say you have four columns and and twenty rows. Instead of creating an 20x4 table, create a 1x4 table. Then in each of the four cells create a 20x1 table. After you create the first one you can use Edit → Repeat to create the other three. To keep the rows aligned, ensure the cells of the four tables are all the same height. This is done with Table → Select → Table then Table → Autofit → Row Height → Uncheck Fit to Size → Height → your choice.
Someone just suggested that on another forum where I'd posted to see if someone knew of software that could do this. It's a clever idea and I'll definitely try it! Thank you for the suggestion.
MrProgrammer wrote: Mon Oct 03, 2022 4:01 pm Not relevant in an OpenOffice forum. It is what it is. If you are not satisfied with the free product, you don't have to use it.
Writer is attempting to compete with Word; I didn't think it's irrelevant to mention a feature that it ought to have in order to be as competitive as possible, especially as it's disappointing for someone who uses Linux - where Word is *not* available without complex workarounds. I don't have the option of using Word, so it's reasonable to be disappointed that the software available to me does not have the features I'm looking for. I only spent one sentence wishing it did, anyway, and definitely did not blame the user for that lack. (Nor is it necessarily the devs' fault - or anyone's fault. It just isn't in there yet; perhaps that will change in the future.)
MrProgrammer wrote: Mon Oct 03, 2022 4:01 pm If you don't like these ideas, just ignore them. Don't complain about free help with your problem.
I don't think I complained about the *help*. I thanked the user for letting me know, even if the result wasn't what I wanted. Your tone comes across as rather critical and a bit condescending. So I'm not complaining about your ideas at all - especially since the last one was very helpful indeed - but the tone felt a bit harsh.
Last edited by Doranwen on Tue Oct 04, 2022 1:52 am, edited 2 times in total.
LibreOffice 5.1.6.2 on Linux Mint 18.1
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Insert/delete cells within tables?

Post by JeJe »

You can use Word online for free. I tried an older version of Word with Linux/Wine without noticing any problems.

If you cross post you should say so - here and there [edit: with the link] - so people don't spend their time duplicating solutions already suggested.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Doranwen
Posts: 83
Joined: Sun May 26, 2019 6:46 am

Re: Insert/delete cells within tables?

Post by Doranwen »

JeJe wrote: Mon Oct 03, 2022 4:33 pm You can use Word online for free. I tried an older version of Word with Linux/Wine without noticing any problems.
I don't have a Microsoft account and my system is... complicated... so setting up Wine with it might not work so great, given what I'm already doing on this box. I contemplated doing so with a Windows VM, but was trying to avoid having to use a VM with this.
JeJe wrote: Mon Oct 03, 2022 4:33 pm If you cross post you should say so - here and there [edit: with the link] - so people don't spend their time duplicating solutions already suggested.
I didn't think of it as crossposting because I was actually asking there for *software* suggestions besides OO/LO that would work for this, rather than how to make this software work. I posted here mainly because I wondered if there was a buried feature I'd somehow missed that would do this. The fact that users on both forums simultaneously thought of how to make this software work for it is more coincidental than anything, since I wasn't asking them there for suggestions of how to do it on this program. It's definitely worth a try, though, and I'll be seeing how that works tonight when I get home from work.

Thank you all for the help! :)
LibreOffice 5.1.6.2 on Linux Mint 18.1
JeJe
Volunteer
Posts: 2764
Joined: Wed Mar 09, 2016 2:40 pm

Re: Insert/delete cells within tables?

Post by JeJe »

I think it was Word 2000 that I had working on Wine on MXLinux - there's no need for a Microsoft account with that - there's just a key with the disc it was on. Really easy install and worked well as far as I could tell. I bought it when it was current but old versions of Word like that or the full Office can be bought really cheaply sometimes.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Doranwen
Posts: 83
Joined: Sun May 26, 2019 6:46 am

Re: Insert/delete cells within tables?

Post by Doranwen »

That's an excellent idea - trying a really old version of Word. I think I may have an old version of Office 2003 somewhere… Between that option and the table-within-table idea, I should have a good solution then. Again, thank you! I feel much better about being able to do this planning that I need to do.
LibreOffice 5.1.6.2 on Linux Mint 18.1
Post Reply