Calc rows to Writer paragraphs

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Post Reply
eschabichi
Posts: 2
Joined: Fri Oct 27, 2017 5:27 pm

Calc rows to Writer paragraphs

Post by eschabichi »

Hi,

I'm looking for a macro to copy the rows of a Calc spreadsheet to paragraphs in a Writer document. That is, each row in the sheet (or in a range of cells) becomes a paragraph. The cells within the row would be concatenated with a space between them. And in particular, formatting (bold, italics) must be maintained.

Does anyone have a similar macro?

I tried starting from viewtopic.php?f=45&t=82224# which does much of this, but I had trouble modifying that macro to combine the cells of a row to paragraphs instead of just writing them to a table.

Thanks,
Joe
LibreOffice 5.1.6.2 on Ubuntu 16.04
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Calc rows to Writer paragraphs

Post by Villeroy »

menu>Table>Convert>Table to Text...
Specify a space as column delimiter
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
eschabichi
Posts: 2
Joined: Fri Oct 27, 2017 5:27 pm

Re: Calc rows to Writer paragraphs

Post by eschabichi »

Oh, you're saying to do that in Writer after running the macro I linked. That's a decent idea. I'd hoped to have finer control over the output even though I made it sound simpler in my question... I'll have to do a fair amount of cleanup in Writer... but this gets it most of the way there. Thanks Villeroy for your reply.
LibreOffice 5.1.6.2 on Ubuntu 16.04
User avatar
Villeroy
Volunteer
Posts: 31269
Joined: Mon Oct 08, 2007 1:35 am
Location: Germany

Re: Calc rows to Writer paragraphs

Post by Villeroy »

Yes, I would expect that this dissolves the entire table structure while keeping all text attributes. I would also expect strange layouts where some cells contained line feeds.
Please, edit this topic's initial post and add "[Solved]" to the subject line if your problem has been solved.
Ubuntu 18.04 with LibreOffice 6.0, latest OpenOffice and LibreOffice
Post Reply