Welcome to NeoOffice developer notes and announcements
NeoOffice
Developer notes and announcements
 
 

Problems after upgrading to Sierra or High Sierra? Try these steps
Problems after upgrading to NeoOffice 2017? Try these steps
Download or installation problems? Try these steps


Support
· NeoOffice Support
· NeoWiki


Announcements
· Twitter @NeoOffice


Downloads
· Download NeoOffice
· Download latest patch
· User Guide
· User Guide Volume 2


RSS Feeds
· Announcements Only
· All Posts


  
NeoOffice :: View topic - Reformatting files
 SearchSearch   ProfileProfile   Log inLog in 

Reformatting files
 
Post new topic   Reply to topic    NeoOffice Forum Index -> NeoOffice Releases
View previous topic :: View next topic  
Author Message
Guest






PostPosted: Sat Jan 22, 2005 4:23 am    Post subject: Reformatting files Reply with quote

If I edit a file with Word I can find, and replace, special characters like newline and tab. I can't find a facility to do this in NeoOffice. Is it there, or am I going to have to hang on to Word merely so that I can reformat files?

Dave
Back to top
OPENSTEP
The One
The One


Joined: May 25, 2003
Posts: 4752
Location: Santa Barbara, CA

PostPosted: Sat Jan 22, 2005 10:16 am    Post subject: Reply with quote

That's really unfortunately not a neo-specific question but rather functionality that would be general to OOo. Offhand, the one that comes to my mind first would be to use the Find and Replace tools with "Regular Expressions" enabled. Within the regular expression you should be able to escape special characters like tabs (\t), but I'm not really sure of the extent to which they support regular expressions within OOo as I've never used it.

Some good places to look would be:

http://www.oooforum.org
(search or ask in the "Writer" forums)

http://docs.sun.com/app/docs/coll/so7en
(documentation for StarOffice 7, which is mostly applicable to OOo 1.1.x and NeoJ 1.1)

http://www.hmug.org/man/1/egrep.html
(or "man grep" in a terminal...explains more about what regular expressions are and why they are so cool. you can actually decrypt a dvd with a single regular expression)

ed
Back to top
View user's profile Send private message Visit poster's website AIM Address
MrGruff
Operator


Joined: Jul 01, 2004
Posts: 45
Location: Newcastle upon Tyne, UK

PostPosted: Mon Jan 24, 2005 5:00 am    Post subject: Find and replace Reply with quote

Regular expressions will do the trick. I was experimenting last week to re-purpose a document for import into Quark Xpress and used them to get rid of tabs and unwanted lines.

However, the set up seems strange, as \t will find a tab, but \ followed by any other letter will find that letter: so how do you find the letter t? I'd better go and look at those fora myself.

Huw
Back to top
View user's profile Send private message
owenkc
Pure-blooded Human


Joined: Sep 02, 2004
Posts: 31

PostPosted: Fri Jan 28, 2005 3:58 pm    Post subject: Reformatting files Reply with quote

I asked about finding newlines when doing a search and replace with NeoOffice/J. Someone said that regular expressions work. Sorry, but they don't. I searched through a long text document for \n (newline) and got no hits at all.

I'm still trying to find a way to reformat these files - I bring them in from email and want to reformat them so they make sense on my PDA. That isn't difficult in Word, but seems impossible in NeoOffice - so I have to keep Word around just to do reformatting.

Why bother with NeoOffice if it can't do everything I want to do?

Owen
Back to top
View user's profile Send private message
pluby
The Architect
The Architect


Joined: Jun 16, 2003
Posts: 11692
Location: California, USA

PostPosted: Fri Jan 28, 2005 4:50 pm    Post subject: Re: Reformatting files Reply with quote

owenkc wrote:
I asked about finding newlines when doing a search and replace with NeoOffice/J. Someone said that regular expressions work. Sorry, but they don't. I searched through a long text document for \n (newline) and got no hits at all.


'\n' is not a regular expression symbol for newline but a C/Java/shell symbol for newline. In regular expressions, '$' is the symbol for the end of a line.

So, if you put the '$' character in the find field and check regular expressions, all lines will be merged into a single line when you click the "Replace All" button.

Patrick
Back to top
View user's profile Send private message Visit poster's website
yoxi
Cipher


Joined: Sep 07, 2004
Posts: 1799
Location: Dawlish, Devon

PostPosted: Sat Jan 29, 2005 1:46 am    Post subject: Reply with quote

Patrick, do you know of a definitive 'regular expressions' webpage you could point us to that would have a list of regex's as they work in Neo/J?

I've been looking it up on the net, and there's loads of conflicting information (some mention $, but in very differing contexts, for example). It'd be really handy to have a reference point that fit Neo/J. By the way, your piece of info about using $ for carriage returns is a real gem, thanks...

- yoxi
Back to top
View user's profile Send private message
sardisson
Town Crier
Town Crier


Joined: Feb 01, 2004
Posts: 4588

PostPosted: Sat Jan 29, 2005 2:15 am    Post subject: Reply with quote

yoxi wrote:
Patrick, do you know of a definitive 'regular expressions' webpage you could point us to that would have a list of regex's as they work in Neo/J?


There's a little bit in help, but it's not very helpful. For instance, it doesn't seem to explain how to replace, say, only two blank lines. Repeating $ (or ^$ for only getting blank lines, or a combo thereof) doesn't work.

Smokey

_________________
"[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki
Back to top
View user's profile Send private message Visit poster's website
yoxi
Cipher


Joined: Sep 07, 2004
Posts: 1799
Location: Dawlish, Devon

PostPosted: Sat Jan 29, 2005 3:38 am    Post subject: Reply with quote

sardisson wrote:
There's a little bit in help, but it's not very helpful.

How true - you'd never know from the Help chart that you could use $ to search for paragraph breaks on their own, for example (someone has already flagged this as a documentation bug) - I didn't have a solution to this until Patrick explained it above.
Quote:
For instance, it doesn't seem to explain how to replace, say, only two blank lines. Repeating $ (or ^$ for only getting blank lines, or a combo thereof) doesn't work.

Some research on oooforum.org shows that Ooo simply has no built-in way to replace multiple paragraph breaks - but there's a macro by Iannz here that provides an alternative Find/Replace dialog. You just open the .sxw doc and follow the instructions on the last page for installing the macro. Two important corrections to his instructions though, at least for use on NeoJ/X11. The first for installation - in his notes on adding IannzFindReplace to the Edit menu, he writes:
Quote:
In the category list box: Click the + next to “OpenOffice.org BASIC Macros” (towards bottom of list), the plus next to “IannzFindReplace”, then click “IannzFindReplace”.

but as the last item, you need to click "modIannzFindReplace" in the Category list in order to get the actual macro item coming up in the Function list. (This applies equally to adding the macro as a keyboard shortcut.) And as to usage, he writes:
Quote:
The end of a paragraph is denoted by $. So, for example, to find two blank paragraphs the expression would be ^$$.

This doesn't work in NeoJ/X11, but I found that just putting in $$ does it instead.

Note that the Replace is pretty sloooow... for what it's worth, if you've got large numbers of find/replace of this sort to do, and you've got Ooo X11 installed too, use this macro in X11 instead - it works 3x as fast compared to in Neo/J - I'm guessing it's something to do with screen refreshes when adding each replacement character, because the longer the replacement string is, the more the time lag in Neo/J.

- yoxi
Back to top
View user's profile Send private message
yoxi
Cipher


Joined: Sep 07, 2004
Posts: 1799
Location: Dawlish, Devon

PostPosted: Mon Nov 07, 2005 3:57 am    Post subject: Re: Reformatting files Reply with quote

pluby wrote:
In regular expressions, '$' is the symbol for the end of a line.

An interesting addendum to this - OOo/NeoJ's Find cannot find a carriage return followed by a tab using regular expressions. If you put $\t in the Find dialogue, it comes back saying none found. This has not been fixed in OOo v2, incidentally, so I'm going to raise it as a bug if somone hasn't already done so.

- yoxi
Back to top
View user's profile Send private message
sardisson
Town Crier
Town Crier


Joined: Feb 01, 2004
Posts: 4588

PostPosted: Mon Nov 07, 2005 4:10 am    Post subject: Reply with quote

Just as a reminder to anyone who might find this thread: we have a partial layman's guide to the intricacies of Find-and-Replace in the wiki. Thanks to all our find-and-replace gurus who've contributed!

Smokey

_________________
"[...] whether the duck drinks hot chocolate or coffee is irrelevant." -- ovvldc and sardisson in the NeoWiki
Back to top
View user's profile Send private message Visit poster's website
yoxi
Cipher


Joined: Sep 07, 2004
Posts: 1799
Location: Dawlish, Devon

PostPosted: Mon Nov 07, 2005 5:04 am    Post subject: Reply with quote

Note: neither the built-in Find/replace nor Iannz's one is capable at the moment of finding a result for any regular expression that has a carriage return followed by anything at all, e.g. $Q will not find anything even if there is a para break followed by a Q.

Please update your wiki accordingly...

- yoxi

UPDATE - okay, I jumped the gun there, and Iannz has kindly set me straight. As OOo's doc format has a kind of 'paragraph as separate entity' paridigm thing going on, what you have to do to find a carriage return followed by something else is e.g. ^\t for start-of-para-followed-by-tab, for example.

Now I'm trying to find out if there's a way to replace the para break itself when it's part of a longer expression: no problem replacing, say, $ with a space to clean up an email message that's been broken into lines, but is there a way to replace para-break-followed-by-tab with a space and no para break? Watch this space for further details...
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    NeoOffice Forum Index -> NeoOffice Releases All times are GMT - 7 Hours
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Powered by phpBB © 2001, 2005 phpBB Group

All logos and trademarks in this site are property of their respective owner. The comments are property of their posters, all the rest © Planamesa Inc.
NeoOffice is a registered trademark of Planamesa Inc. and may not be used without permission.
PHP-Nuke Copyright © 2005 by Francisco Burzi. This is free software, and you may redistribute it under the GPL. PHP-Nuke comes with absolutely no warranty, for details, see the license.
Page Generation: 0.02 Seconds