# Writer: Replace Format, Find text by Indent

I have an RTF document without any Styles and I want to fix and organise the Styles. So I thought: great, Writer allows to find & replace text by Format!

I managed to find text by Format as bold, but not by Indent. Even writing the exact indent (left and right). I tried searching the exact text, empty text or a general RegEx ".+". Nothing found. Is it because Bold is a Font thing and Indent is a Paragraph thing?

How can I Find a text by its Indent? Is it possible to set a Style using Find & Replace by Format? Thanks

edit retag close merge delete

If you cut out the text and insert again as "unformatted", does the SEARCH hit the paragraph indents then? .

Background: I once copied text from the internet and SEARCH/REPLACE could not find. After inserting as unformatted all worked...

( 2018-06-04 12:04:39 +0200 )edit

Sort by » oldest newest most voted

"Indent" is not a character property -- it belongs to paragraph formatting, so it won't be found by regular regex.

I can think of two ways to attempt to deal with this on a search/replace basis...

(1) Use the Alternative dialog Find & Replace for Writer (also known as "AltSearch"). Using syntax like:

[:::ParaFirstLineIndent=1000::]


it ought to be possible to find paragraphs with that property. Do see the online help, though. You need to click the "Pick Properties" button in that dialog to get the settings for your file.

In my tests on an RTF file produced by WordPad, LibO Writer + AltSearch could find paragraphs with any indent set (with [:::ParaFirstLineIndent=::]) but not paragraphs with a specific indentation. Not sure why.

(2) The other possibility would be to save your RTF file as a "flat" ODT file = *.fodt. You can then edit this with a plain text editor, and find the paragraph styling you want to manipulate. In my test file, the indent paragraph had a style name of "P5", with a definition in the file header including fo:text-indent="1cm".

Ideally, of course you want to be able to assign all indent paragraphs of the same kind to a given Writer paragraph-style, I suppose (with "Find All"). If you could get the AltSearch option working, then you should be able to do that. I don't think the second option here helps you with that.

Perhaps someone else will come up with a better solution.

more

This post is a wiki. Anyone with karma >75 is welcome to improve it.

How can I use AltSearch to find text by indent?

The properties on search seem to be all about characters. Using "Pick Properties" I discovered that the property I'm looking for is ParaLeftMargin=1000 (paragraph indent "Before Text") where 1000 = 1cm, having ParaFirstLineIndent=0 (Indent of First Line) = 0cm.

How can I search by ParaLeftMargin?

Searching [:::ParaLeftMargin=1000::] gave no match, even changing the number with 0, 1, 10, 100. Searching [:::ParaLeftMargin=::] and [:::ParaLeftMargin=1cm::] matches all paragraphs with ParaLeftMargin = 0.

more

If you need to search by indent, your document has a design fault (unless you convert from someone else). The flaw is to mix significance (text contents) with appearance (formatting), which is called direct formatting in LO parlance. Appearance should be handled with styles (paragraph, character, …) bridging the gap between semantics and aspect.

Then you search by paragraph style. This needs some planning ahead in document organisation.

( 2018-10-14 12:44:42 +0200 )edit