Saving formatting

A

Alex

Hello,

How can do the following programmatically (in a macro or add-in):

1. Go to given position in the document
2. save the current formatting used (character, paragraph, etc.)
3. Inset several lines of text, formatted with a given style.
4. Restore the saved formatting and add some more text.


Best wishes,
Alex.
 
K

Klaus Linke

Hi Alex,

I don't think you need to save/restore anything.
3. Inset several lines of text, formatted with a given style.

I guess you mean "paragraphs", not "lines" (since you talk of applying a [paragraph?] style to the new text)?
In that case, you need to insert a paragraph mark anyway.
You can insert text at the end of the old paragraph, or below it, and format it any way you want.

Anything you insert at the start of the new paragraph will get all the character and paragraph formatting that was used at that point.

Greetings,
Klaus



Hello,

How can do the following programmatically (in a macro or add-in):

1. Go to given position in the document
2. save the current formatting used (character, paragraph, etc.)
3. Inset several lines of text, formatted with a given style.
4. Restore the saved formatting and add some more text.


Best wishes,
Alex.
 
A

Alex

Thanks Klaus.

Hi Alex,

I don't think you need to save/restore anything.
3. Inset several lines of text, formatted with a given style.

I guess you mean "paragraphs", not "lines" (since you talk of applying a [paragraph?] style to the new text)?
In that case, you need to insert a paragraph mark anyway.
You can insert text at the end of the old paragraph, or below it, and format it any way you want.

Anything you insert at the start of the new paragraph will get all the character and paragraph formatting that was used at that point.

Greetings,
Klaus



Hello,

How can do the following programmatically (in a macro or add-in):

1. Go to given position in the document
2. save the current formatting used (character, paragraph, etc.)
3. Inset several lines of text, formatted with a given style.
4. Restore the saved formatting and add some more text.


Best wishes,
Alex.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top