![]() |
|
#1
|
|||
|
|||
|
Hi to all, I am trying to copy and paste texts from pdf but the text contains many paragraph breaks that need to be removed if it is before a full stop. Or, we can replace all paragraph breaks from the selection and add paragraph breaks before starting of next sentences like (a., b., c.) followed by the first letter capital letter. Below is the sample text. Plz have a look. Looking forward to a solution.
|
|
#2
|
||||
|
||||
|
See the Cleaning up Text Pasted from Websites, E-mails, PDFs etc. 'Sticky' post at the top of the Word forum: https://www.msofficeforums.com/word/...-pdfs-etc.html
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
#3
|
|||
|
|||
|
Thank you sir. It did a great job. But it removed all paragraph breaks what i need to do now is find full stop "." followed by "[a-z]." and insert a paragraphbreak before the text.
Code:
Sub Insertpara()
Dim str As String
Dim sbstr As String
Dim ix As Long
Dim times As Variant
Dim sblen As Long
Dim i As Integer
Set rng = Selection.Range
str = Selection.Range.Text
sbstr = "." ' I checked the code using a full stop but i want to find "?." to find any character followed by full stop
sublen = Len(sbstr)
ix = 1
occurences = -1
Do
times = times + 1
idx = InStr(ix, str, substr, vbBinaryCompare) + sblen
Selection.Range.Characters(ix).InsertAfter (Chr(13))
Loop While ix > sblen
End Sub
|
|
#4
|
||||
|
||||
|
Please read the comments in the thread...
Quote:
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
|
| Thread Tools | |
| Display Modes | |
|
|