[Solved] Convert vertical word list to horizontal
-
- Posts: 7
- Joined: Mon May 11, 2020 1:34 am
[Solved] Convert vertical word list to horizontal
Hi:
In Apache Text Writer Doc I have several words in alphabetical order in a vertical column (not a table column). Some of the words are 2 or 3 line spacing apart. All are aligned left. How do I get them in a horizontal line in the same order and separated by a coma followed by a space after each word?
In Apache Text Writer Doc I have several words in alphabetical order in a vertical column (not a table column). Some of the words are 2 or 3 line spacing apart. All are aligned left. How do I get them in a horizontal line in the same order and separated by a coma followed by a space after each word?
Last edited by Hagar Delest on Tue May 12, 2020 7:25 am, edited 1 time in total.
Reason: tagged solved
Reason: tagged solved
Re: Convert vertical word list to horizontal
If you words are arranged as I think they are, you can use the following. If it does not work, please upload a sample document.
1. Eliminate the empty paragraphs by
A. Selecting the menu Edit -> Find & Replace
B. In the Search For box enter ^$
C. Leave the Replace With box empty,
D. Under More Options select Regular Expressions
E. Click Replace All
2. Replace the Paragraph ends with a comma and a space.
A. In the Search For box enter $
B. In the Replace With box enter a comma followed by a space.
C. Click Replace All
If you have a very long list, removing all of the paragraph marks will cause problems because the paragraph will be longer than the maximum supported lenth (~64,000 characters?).
1. Eliminate the empty paragraphs by
A. Selecting the menu Edit -> Find & Replace
B. In the Search For box enter ^$
C. Leave the Replace With box empty,
D. Under More Options select Regular Expressions
E. Click Replace All
2. Replace the Paragraph ends with a comma and a space.
A. In the Search For box enter $
B. In the Replace With box enter a comma followed by a space.
C. Click Replace All
If you have a very long list, removing all of the paragraph marks will cause problems because the paragraph will be longer than the maximum supported lenth (~64,000 characters?).
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
-
- Posts: 7
- Joined: Mon May 11, 2020 1:34 am
Re: Convert vertical word list to horizontal
I got to Step E & a pop-up said "Search Key not found".
OpenOffice 3.1 on Windows Vista
Re: Convert vertical word list to horizontal
Use Ctrl-F10 or View | Non-printing Characters to show end of line markers. Do you see a backwards P ¶ or a left pointing arrow ↩ at the end of your empty lines?
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
-
- Posts: 7
- Joined: Mon May 11, 2020 1:34 am
Re: Convert vertical word list to horizontal
2 of the empty lines don't show the backward P. All the rest of the empty lines have a backward P and there is a backward P at the end of each word on the vertical list.
OpenOffice 3.1 on Windows Vista
Re: Convert vertical word list to horizontal
What do you mean by "several"? If several is half a dozen then I'd put the cursor in front of each word, press backspace enough then type the comma and space manually. Its not elegant but it won't take long.
Otherwise Alt search is an extension which allows you to replace some surplus lines/line feeds with commas and spaces a little easier
https://extensions.openoffice.org/en/node/525/releases
Otherwise Alt search is an extension which allows you to replace some surplus lines/line feeds with commas and spaces a little easier
https://extensions.openoffice.org/en/node/525/releases
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Convert vertical word list to horizontal
Check the instructions posted by FJCC. They worked perfectly for me. Step E finds and deletes empty paragraphs. An empty line with a backward P is an empty paragraph.jimhebert722 wrote:2 of the empty lines don't show the backward P. All the rest of the empty lines have a backward P and there is a backward P at the end of each word on the vertical list.
AOO 4.1.14 on Ubuntu MATE 22.04
Re: Convert vertical word list to horizontal
Probably the lines are filled with spaces or some other white space; spaces will show as dots when you are displaying non-printing characters and tabs look like right pointing arrows.2 of the empty lines don't show the backward P
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
Re: Convert vertical word list to horizontal
Look at the paragraph format and make sure the line spacing is set to single and the spacing above and below the paragraph is 0.
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Convert vertical word list to horizontal
Use a regular expression to delete the end of paragraph or new line characters. Edit > Find and Replace. More Options. Tick regular expressions. Click Help or read the tutorial on regular expressions.
Or use the Alt Find and Replace add-on
Or
1. Copy into a spreadsheet
2. Use TRANSPOSE to transpose the array. Or use ROTATING TABLES to transpose the selection. Search Help
3. Copy back.
Or upload a small file with the text so that it can be analysed. Press POSTREPLY and click the Upload attachment tab below where you type (128 kB max); or use a file share site, Dropbox or Google Drive for a larger file.
Or use the Alt Find and Replace add-on
Or
1. Copy into a spreadsheet
2. Use TRANSPOSE to transpose the array. Or use ROTATING TABLES to transpose the selection. Search Help
3. Copy back.
Or upload a small file with the text so that it can be analysed. Press POSTREPLY and click the Upload attachment tab below where you type (128 kB max); or use a file share site, Dropbox or Google Drive for a larger file.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Convert vertical word list to horizontal
If there's no formatting, the words are just plain text, then this macro should convert the selection
Code: Select all
Sub ParasToCommaDelineated
vc = thiscomponent.currentcontroller.viewcursor
sts =split( vc.string,chr(13) & chr(10))
vc.string=join(sts,", ")
End Sub
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Convert vertical word list to horizontal
Slightly more complicated macro converts selected lines to comma delineated but preserves formatting.
Code: Select all
sub ParasToCommaDelineated
odoc = thiscomponent
sel =odoc.currentcontroller.selection.getbyindex(0)
l=odoc.text.createtextcursorbyrange( sel.getstart)
r=odoc.text.createtextcursorbyrange( sel.getend)
do
res=r.gotoStartOfParagraph(false)
if not res then exit do
If oDoc.Text.compareRegionEnds(l, r) <=0 Then Exit Do
r.goleft(1,true)
r.string = ", "
loop
End Sub
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
-
- Posts: 7
- Joined: Mon May 11, 2020 1:34 am
Re: Convert vertical word list to horizontal
I am not well versed in how to use Macros, sorry, JeJe. I did the manual insertion of comas and spaces. I repeated your original instructions and when I got to Step E I received the same pop-up and no inverted P's appeared anywhere. To Robleyd, the paragraphs are set to single line and all 0's.
OpenOffice 3.1 on Windows Vista
Re: Convert vertical word list to horizontal
Please upload a small file showing your data.
Press POSTREPLY and click the Upload attachment tab below where you type (128 kB max); or use a file share site, Dropbox or Google Drive for a larger file.
Press POSTREPLY and click the Upload attachment tab below where you type (128 kB max); or use a file share site, Dropbox or Google Drive for a larger file.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
-
- Posts: 7
- Joined: Mon May 11, 2020 1:34 am
Re: Convert vertical word list to horizontal
File requested by John_Ha
- Attachments
-
- P Table.odt
- (9.69 KiB) Downloaded 210 times
Re: Convert vertical word list to horizontal
FJCC's instructions work perfectly well on that file. Are you ticking the Regular expressions tickbox?
^$ to enter in the search box in those instructions is just those two letters, no space before. Can't think how it can not be working...
Create a new document with all your words in and follow those instructions carefully...
Edit:Abrot, Achy-a, Acon, Adel, Adlu, Aesc, Aeth, Agar, Agar-em, Agath-a, Aids, Alco, Alco-s, Alf, All-c, All-s, Aln, Aloe, Alum, Alum-met, Alumn, Ambr, Am-c, Aml-n, Am-m, Ammc, Amyg-am, Amyg-p, Anac, Anag, Anemps, Ang, Ango, Anh, Anil, Anis, Ant-c, Anth, Antho, Antipyrin, Ant-o, Ant-s, Ant-t, Ap-g, Aphis, Apis, Aq-pet, Aral, Aran, Arbu, Arec, Arge-p, Arg-m, Arg-n, Arn, Ars, Ars-br, Ars-h, Ars-i, Ars-s-f, Ars-s-r, Ars-t-s, Art-v, Arum-d, Arum-dru, Arum-i, Arum-m, Arund, Asaf, Asar, Asc-c, Astra-e, Astra-me, Atha-o, Atista, Aur, Aven,
^$ to enter in the search box in those instructions is just those two letters, no space before. Can't think how it can not be working...
Create a new document with all your words in and follow those instructions carefully...
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Re: Convert vertical word list to horizontal
Just for completeness:
A solution by user code based on the REGEX() function only available in LibreOffice V 6.2 or higher.
It seems to be really efficient.
With long lists the old limit of 65535 for the number of characters in a single paragraph may also come in sight. In LibO this limit is no longer in force. (Neither for paragraphs in text documents nor for cells in spreadsheets.)
You may want to play with the attachment.
A solution by user code based on the REGEX() function only available in LibreOffice V 6.2 or higher.
It seems to be really efficient.
With long lists the old limit of 65535 for the number of characters in a single paragraph may also come in sight. In LibO this limit is no longer in force. (Neither for paragraphs in text documents nor for cells in spreadsheets.)
You may want to play with the attachment.
On Windows 10: LibreOffice 24.2 (new numbering) and older versions, PortableOpenOffice 4.1.7 and older, StarOffice 5.2
---
Lupp from München
---
Lupp from München
Re: Convert vertical word list to horizontal
The spreadsheet ROTATE trick works fine.
Having seen the data the additional step is to sort the column to separate the empty lines. Paste Special > unformatted back into Writer. Do a regular expression search for /t (the tabs) and replace them all by ,sp (comma space).
Having seen the data the additional step is to sort the column to separate the empty lines. Paste Special > unformatted back into Writer. Do a regular expression search for /t (the tabs) and replace them all by ,sp (comma space).
Abrot, Abrot, Achy-a, Acon, Adel, Adlu, Aesc, Aeth, Agar, Agar-em, Agath-a, Aids, Alco, Alco-s, Alf, All-c, All-s, Aln, Aloe, Alum, Alum-met, Alumn, Am-c, Am-m, Ambr, Aml-n, Ammc, Amyg-am, Amyg-p, Anac, Anag, Anemps, Ang, Ango, Anh, Anil, Anis, Ant-c, Ant-o, Ant-s, Ant-t, Anth, Antho, Antipyrin, Ap-g, Aphis, Apis, Aq-pet, Aral, Aran, Arbu, Arec, Arg-m, Arg-n, Arge-p, Arn, Ars, Ars-br, Ars-h, Ars-i, Ars-s-f, Ars-s-r, Ars-t-s, Art-v, Arum-d, Arum-dru, Arum-i, Arum-m, Arund, Asaf, Asar, Asc-c, Astra-e, Astra-me, Atha-o, Atista, Aur, Aven
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
-
- Posts: 7
- Joined: Mon May 11, 2020 1:34 am
Re: Convert vertical word list to horizontal
I tried copy and pasted the vertical word list on a new doc and retried. I first clicked the Inverted P on the tool bar to verify that I had no more empty lines and checked OK. I then followed the instructions. In the "Search for" block I clicked on Shift 6 to get the ^ and then Shift s to get S. The Regular expressions block was already ticked. I clicked "Replace All". A pop-up titled Open Office 4.1.7 says "Search Key not found." I am wondering if maybe I don't have an extension that I never downloaded. It has to be something that my downloaded Open Office is lacking. I even tried re-installing it and it did the same. Something is lacking in my version since it works on yours. On the license agreement it says I must have Java for Open Office to work properly. I have 64bit Firefox browser and Java says that java will not work on that browser. So I don't know if that is the problem? So I didn't download Java.
I installed Open Off in C:\ProgramFiles, ...Maybe I should have installed it in C:\ProgramFiles(x86)
To John_Ha : I tried Special paste: unformatted....it didn't work. I tried an ordinary search for /t and it didn't find anything.
I installed Open Off in C:\ProgramFiles, ...Maybe I should have installed it in C:\ProgramFiles(x86)
To John_Ha : I tried Special paste: unformatted....it didn't work. I tried an ordinary search for /t and it didn't find anything.
OpenOffice 3.1 on Windows Vista
Re: Convert vertical word list to horizontal
Read the posts - they tell you what to do. Do not miss any steps.
You do not seem to understand regular expressions so
You do not seem to understand regular expressions so
Click Help or read the tutorial on regular expressions.
LO 6.4.4.2, Windows 10 Home 64 bit
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
See the Writer Guide, the Writer FAQ, the Writer Tutorials and Writer for students.
Remember: Always save your Writer files as .odt files. - see here for the many reasons why.
Re: Convert vertical word list to horizontal
That's why it doesn't work. You're inserting an upper case "S" but you should be inserting a dollar sign "$". That's Shift+4 on a US keyboard.jimhebert722 wrote:...then Shift s to get S.
AOO 4.1.14 on Ubuntu MATE 22.04
-
- Posts: 7
- Joined: Mon May 11, 2020 1:34 am
Re: Convert vertical word list to horizontal
I can't believe..haha...I kept thinking that maybe I am not entering something correctly which is why I decided to tell you exacty each key I was hitting. Just by looking at it quickly I thought it was an S. The $ on the key pad is a lot clearer looking . Maybe I need glasses....Thanks for the time and I will send a donation to the forum. Thanks Bill. Also JeJe, etc.
OpenOffice 3.1 on Windows Vista