| View previous topic :: View next topic |
| Author |
Message |
nrubdarb Power User

Joined: 03 Jan 2006 Posts: 52
|
Posted: Tue Jan 03, 2006 3:01 am Post subject: Character Styles and Fields? Does anyone have a macro? |
|
|
Hello!
My problem: I have defined many User Fields for my document, and now I would like to give them all a certain character style.
However, OpenOffice Writer does not search Fields, which means that I cannot automatically search and replace character styles for these Fields.
Does anyone have a macro to hand for searching User Fields, basic functionality would be, in pseudocode:
| Code: |
BEGIN
- ask for name of style to give to the field text
LOOP
- find next user field
- mark all text in field
- replace current character style of this text with new character style
END LOOP
END
|
Alternatively, does anyone have a solution to link variable text with character styles? Note that my variable text is variable up until the point of publication of the document, which means that AutoText is no solution.
I think this is a bit of a weakness in Writer, to be honest, since fields often by their nature contain text which needs to be shown in a different way to the main text.
I suppose another way would be to somehow link AutoText with User Fields by using the Assign Macro feature of AutoText (the macro would then apply the correct style to the field just entered), but I have not been able to get this feature to work: macros simply do not assign to any AutoText entries.
Thanks for your time! |
|
| Back to top |
|
 |
jeanweber Moderator


Joined: 30 Dec 2005 Posts: 674 Location: Queensland, Australia
|
Posted: Sat Jan 07, 2006 2:52 pm Post subject: Re: Character Styles and Fields? Does anyone have a macro? |
|
|
| nrubdarb wrote: |
My problem: I have defined many User Fields for my document, and now I would like to give them all a certain character style.
<snip>
Alternatively, does anyone have a solution to link variable text with character styles? Note that my variable text is variable up until the point of publication of the document, which means that AutoText is no solution.
<snip>
I suppose another way would be to somehow link AutoText with User Fields ... but I have not been able to get this feature to work: macros simply do not assign to any AutoText entries.
|
You can use AutoText to insert fields (and keep them as fields), but I haven't tested whether you can automatically apply styles to the results. Perhaps you have tried that already and found it didn't work?
See the section "Using AutoText to insert often-used fields" in Chapter 14 of the Writer Guide, "Working with Fields".
http://documentation.openoffice.org/manuals/oooauthors2/0214WG-WorkingWithFields.pdf _________________ Regards, Jean Hollis Weber
Get free PDFs of OOo user guides from http://wiki.services.openoffice.org/wiki/Documentation/
Printed copies http://www.lulu.com/opendocument |
|
| Back to top |
|
 |
nrubdarb Power User

Joined: 03 Jan 2006 Posts: 52
|
Posted: Tue Jan 10, 2006 8:42 am Post subject: |
|
|
Hi Jean,
Thanks for the help! Some more research results from my efforts...
AutoText does retain style information, which is in itself a very useful feature. This even seems to apply if you style an AutoText entry with a style which is only present in the current template and then use it somewhere else.
By which I mean, that the following works (somewhat surprisingly perhaps):
1. Open a document or template and make a new, custom style.
2. Mark some text and give this text your new style.
3. Make an AutoText entry from this (making sure that you do *not* check the 'text only' box!)
3. Close document.
4. Open a new document, *not* based on this template if the document in 1. was a template.
5. Open your AutoText with Ctrl-F3 and insert your AutoText entry made in 3.
6. Writer inserts the text, and also inserts the style with it. This also seems to mean that it inserts parent styles if required, which is quite interesting!
I have only tried it with paragraph styles, so YMMV. I inserted a second-level head style, which was based on a first-level head, and ended up with the text styled correctly and with two new styles in the target document.
However, styles aren't my only problem with AutoText.
I am working with networked authors, and need to create AutoText entries based on text sourced from outside Writer, for example from a terminology database. As I have written in another post, I therefore need to be able to *generate* AutoText, and without knowing how the AutoText file (one of those '*.bau' files) is put together, I currently cannot do this. I have given up with User Fields, since these cannot be 'networked', and anyway, it's an unnecessary step. If I could generate AutoText files, then I could have my text and styles as I needed them, in one go.
And of course, being able to generate AutoText from one of our online resources here at work would be very very useful indeed, meaning I could get some real interoperability with these systems.
The only thing I have found which works is exporting the entries I need as a Writer index concordance file and then using that to create the Glossary I require. I might post that on the Forum in a day or so once I have got it working as desired. It doesn't of course solve my problem with *entering* the entries, but it does let me locate what I already have in the document! _________________ OOo usage is v.2.0, mostly Writer. At work I'm evaluating OOo as a solution for publishing product manuals. OS is Windows XP. At home I use OOo for all kinds of text processing. My partner will be writing her thesis using Writer. OS is Debian Linux |
|
| Back to top |
|
 |
|
|
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
|
Powered by phpBB © 2001, 2005 phpBB Group
|