Click here to Skip to main content
15,884,975 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have in Microsoft Word 5 lines od text with auto numbering. All lines have it's own formatting like bold, italic, etc.

1. Line 1
2. Line 2
3. Line 3
4. Line 4
5. Line 5

When I copy to clipboard selected lines 2-4 and paste it into TextBox control in VB.NET Windows Form Application I get same text without formating (auto numbers are 2/3/4)

When I copy to clipboard selected lines 2-4 and paste it into RichTextBox control I get same text with formating but auto numbers are counted from 1, so I have 1/2/3 instead of 2/3/4

I need a way to copy-paste text into richtextbox with preserved formating an exact auto numbering but no luck so far.

What I have tried:

comparing letter by letter (textbox and rchtextbox) but with no luck
using Interop.Word to somehow retrive this informatiom but with no luck

I Would prefer to use pure VB soulution without Word Interop
Posted
Updated 21-Dec-18 7:28am
Comments
mehr.ah 20-Dec-18 15:13pm    
Take it as a html in pre tag

1 solution

Here is a (lengthy) discussion about the same problem, which seems to be solved:
[RESOLVED] How to copy Auto-Numbering and Pure-Text from RichTextBox or MS Word ?-VBForums[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900