Replacing indents with tabs

Continuing the discussion from Writer: Replace Format, Find text by Indent:

I’m trying to copy a list of bookmark folders from Brave.
Saved to html
Opened in Writer
I selected all bookmarks using Find and Replace (Ctrl+H) > Paragraph Styles
deleted bookmarks leaving only folders and a lot of gaps

I’m trying to find a quick way to get rid of the gaps
I can’t copy and paste to Calc as the folders and subfolders are only indicated by being indented.

I tried using your suggestion to safe ad *.fodt but can’t seem to figure out how even to save as .fodt let alone then open it.

I could be barking up the wrong tree but your suggestion seems sensible and applicable.
Any tips please?

Are you trying to remove the empty paragraphs? If so the using Find and Replace (Ctrl+H):

  1. Select the text (not required if it is the only text, or you want to remove all empty paragraphs)
  2. Open Find & Replace
  3. In the dialogue:
    In Find enter ^$
    In Replace leave it blank
    under Options
    Tick Current selection only (if required)
    Tick Regular expressions
  4. Click Replace All

See List of Regular Expressions

Thanks. Beautiful. Much appreciated.

Simple now you say it but I’m still getting used to L.O.
That’s 90% of what I was trying to figure out along the way.

I am also interested in how I can copy and paste the list to a notes app so I’d still like to replace the indents with tabs or spaces.

In Word Shift (or Alt?) + select: hold-click and drag with mouse allows to select what text it is dragged across.

I could try dajare’s AltSearch suggestion but the save-to flat and open to find the indents replaced with plaintext spaces/tabs seems like a fairly clean way of getting a result I can throw to plain text, markdown, Writer or Calc.

Maybe you have a small sample of a dozen lines that you can share? Click the Upload icon (7th from left) to upload. You might need to zip it or add a .odt extension after the .htm extension otherwise you might not be allowed to upload it.

[Edit]
I tried exporting bookmarks from Firefox to HTML. To remove the indent, select everything (Ctrl+A) and click Format > Clear direct formatting (Ctrl+M)

Example: Bookmarks indents test.odt (13.4 KB)

Maybe there’s another way to get from HTML to .odt in the first place which wouldn’t be rendered as indent levels - or I could try a find and replace on the html code but this is an experiment which seems simple but is evading a straightforward method.

I confess I’m not 100% clear on what you’re attempting to achieve. If it’s simply to copy this list into a notes app (which one? could make a difference), then have you tried a simply copy-paste? I downloaded your sample file, opened it in LibO Writer, did CTRL-A to select all, CTRL-C to copy. Then I opened a plain text editor and hit CTRL-V to paste, and … all the “gaps” are gone:

But perhaps you’re actually trying to do something else? Maybe try re-phrasing your question if I’ve missed the point completely. :)

same :expressionless:

try to export to pdf, then
pdftotext -layout Bookmarks.pdf

example (with dots for clarity)

Bookmarks
Bookmarks bar
. 2025
.....Health
.......Food Recipe
.....Family
.......Holiday
.....Apps
.......Google
......... Google Calendar
.......Sync

I do wonder whether involving Writer in this is your best option. You could convert your bookmarks file with a script, converting it to text. You can try out this bash script (you haven’t said what platform you’re on, but I think this one is fairly portable) to see whether it works for you.

It takes as input an *.html file of this type:

<DL><p>
  <DT><H3>Folder 1</H3>
  <DL><p>
    <DT><A HREF="http://example.com">Example</A>
  </DL><p>
</DL><p>

And converts into a plain text file of this type, preserving the nesting-indent of folders:

  [Folder] Folder 1
    Example - http://example.com

Hope that helps!

  1. Open the Find and Replace dialog (Ctrl+H).
  2. In the Find field type ^..
  3. In the Replace field type \t& (or “ &” without the quotes, if do you want spaces instead of tabs).
  4. Open the Format dialog, and
  5. Choose the Indents & Spacing tab.
  6. In the field Before text type 10 mm (the first indent value), and
  7. Accept (OK).
  8. In the Find and Replace dialog choose Replace All.

    Repeat the procedure but with \t\t& for 20 mm (like in the screenshot), and with \t\t\t& for 30 mm.
    After that, you can select all (Ctrl+A), and clear the direct formatting (Ctrl+M) to reset the indent value.
1 Like