Scribus > Beginner Talk

Replace carriage returns with blank spaces

(1/2) > >>

Hello everyone,

I copied a pdf text into my scribus file so it has a lot of carriage returns. I want to replace those carriage returns with blank spaces. Normally, when I use InDesign I make use of GREP. I have explored the 'Search/Replace' settings but I see no options for what I need. Can anyone help me? Thank you very much!

Hello everyone.
I am in a similar situation to Clara.
Does anyone know of a way to solve it?

ok, I just found a possible solution using a script.
It is based on this one:
with a small modification.
Copy the following code and save it as a .PY file.
Then run the script from Scribus with the selected text frame.

--- Code: ---#!/usr/bin/env python
# -*- coding: utf-8 -*-


adapted from


import sys
import re

    import scribus
except ImportError,err:
    print 'This Python script is written for the Scribus scripting interface. It can only be run from within Scribus.'

if not scribus.haveDoc():
    scribus.messageBox('Warning', 'You should open a document.', scribus.ICON_WARNING, scribus.BUTTON_OK)
if scribus.selectionCount() == 0:
    scribus.messageBox('Warning', 'You should select a text frame.', scribus.ICON_WARNING, scribus.BUTTON_OK)
if scribus.selectionCount() > 1:
    scribus.messageBox('Warning', 'You should select one text frame.', scribus.ICON_WARNING, scribus.BUTTON_OK)

replacements = (
    # double carriage return to carriage return

d = scribus.getSelectedObject()

if scribus.getObjectType(d) != 'TextFrame':
    scribus.messageBox('Warning', 'You should select a text frame.', scribus.ICON_WARNING, scribus.BUTTON_OK)
    for item in replacements:
        content = unicode(scribus.getAllText(d))
        p = re.compile(item[0])
        r = re.finditer(p, content)
        for i in reversed(tuple(r)):
            count = i.end()-i.start()
            scribus.selectText(i.start(), count, d)
            scribus.insertText(item[1], i.start(), d)
    scribus.messageBox('Info', 'Script finished successfully.', scribus.ICON_INFORMATION, scribus.BUTTON_OK)

--- End code ---

Not what the original poster was asking for, but there is another work around for those not wanting to run a script might be helpful here. I cut and pasted the pdf text into a word processor, then saved the file in an old word doc format -which Scribus can import- and the extra carriage returns were removed. I happen to use home version of Word Perfect, but for the Linux world there are a variety of free word processors.

You probably know this already, but many word processors also allow for making all the tab and carriage returns visible characters so that you can run "find and replace" to get rid of extra spaces, tabs, and carriage returns. To the extent I can, I like to do all the writing and story editing (grammar, spelling, revisions, etc.)  in a word processor, then pull that into Scribus.

hi all

'search and replace' works in scribus, but you can't insert the carriage return direct in the search field. you need to copy it from your text and paste it into the search field. (you won't see see it either - but it works…)



[0] Message Index

[#] Next page

Go to full version