Cutting and Pasting Numberd lists

G

Guest

Hi

I have developed a COM-Addin with a function which inserts text in a
document from another document (a type of template document).
The Addin shows a form in which the user choose the text from choices in a
database. The database states the file path and the bookmark from where to
get the text.
This works fine until we added numbered lists in the templates. (the
templates are ordinary doc-files with more than 1 numbered list).
The problem occurs when we cut and paste the second list in the template
document. The first list from the template works fine.
In the target document, number 1 in the list is lost and number 2 from the
template becomes number 1.
We have tried every possible way to format the lists in the template with no
success.

We get the same problem when we try this manually so we belive the problem
is not in the code, rather than in the formatting och either the template
document or the target document.

Is there anybody who has a clue?
 
S

Stefan Blom

Have you considered pasting as unformatted text, which pastes autonumbers as
fixed numbers (as if they were typed in)?

--
Stefan Blom
Microsoft Word MVP


in message
news:[email protected]...
 
G

Guest

Hi Stefan

Yes we have, but the whole idea is that the people who administrate the
texts to use throughout the company can format the text as it should appear in
the final document, with format and all.

We have concider breaking up the template documents to several documents as
an escape route to the problem, but that makes the administration more
complicated, since we are talking about a severe number of texts.
The goal was to have one template document to each department.

Is this a known bug to Word?

Thanks in advance
--
Peter Karlström
Midrange AB
Sweden


Stefan Blom said:
Have you considered pasting as unformatted text, which pastes autonumbers as
fixed numbers (as if they were typed in)?

--
Stefan Blom
Microsoft Word MVP


in message
 
S

Stefan Blom

I wouldn't call it a bug, exactly... The problem with pasting numbered items
from different sources is that it might be difficult to control which
numbered items are part of the same list and which are not. Especially note
that if numbering is applied with paragraph styles (which is the most stable
way), items of the same style are definitely part of the same list.

Instead of pasting as unformatted text you could convert the numbering to
text in the source documents before pasting it. That would preserve the
numbers (as typed-in characters), but still leave any other formatting
intact.

To convert the auto numbers in a range to text, run this macro:

Selection.Range.ListFormat.ConvertNumbersToText

(Note that I used Selection.Range, but you can specify a different range
object if you want to.)

And to convert all numbers in a document, run this macro:

ActiveDocument.ConvertNumbersToText

--
Stefan Blom
Microsoft Word MVP


in message
Hi Stefan

Yes we have, but the whole idea is that the people who administrate the
texts to use throughout the company can format the text as it should
appear in
the final document, with format and all.

We have concider breaking up the template documents to several documents
as
an escape route to the problem, but that makes the administration more
complicated, since we are talking about a severe number of texts.
The goal was to have one template document to each department.

Is this a known bug to Word?

Thanks in advance
 
G

Guest

Hi Stefan

Thanks for your reply.

With your suggestion it seems we have three ways to solve this:
1. Use your suggestion and convert the numbered lists to text.
2. Breake up the template document to only consist of 1 numbered list per
template.
3. Hard code som reformating after the paste in the target document.

I will let the customer to deside.

Thanks again
 

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