#1
|
|||
|
|||
How to get rid of lots of unwanted indentations
I am working on a 3,000 page document. Unfortunately the document was converted from a PDF and in word (an RTF file) there are indentations throughout it. I don't want those. Can anyone describe how I can get rid of them, without having to do it for all of them manually? |
#2
|
||||
|
||||
The alignment of the content is easily fixed by applying your preferred style to the content and removing local paragraph formatting by selecting it and pressing Ctrl-Q
Based on what you are showing you would also want to remove some of the extra paragraph marks. For instance, I would use find replace with wildcards on to find: "^13([a-z])" replace " \1" Note there is a space in front of the \1 You will have special cases as shown in your sample where THE ACCUSED is the same paragraph as the following line and it shouldn't be. Also the Ayers Rock should be part of the same paragraph (a find replace process could fix cases like this)
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Converted documents will always have formatting anomalies. Note also the extra paragraph marks at the end of some lines. Find and replace can get rid of those as well.
|
#4
|
|||
|
|||
Thanks so much for both replies. I am working through it and hopeful I can get the document looking a lot better.
There are however some images that I have been unable to get rid of. I have done a few things to try and fix it. I did a replace ^g with nothing. I took Guessed's advice with find: "^13([a-z])" and replace with " \1". I also ran a macro that someone recommended to me: Sub Macro1() Dim oShape As Shape Dim i As Integer For i = ActiveDocument.Shapes.Count To 1 Step -1 Set oShape = ActiveDocument.Shapes(i) If oShape.Type = msoPicture Then oShape.Delete Else Debug.Print oShape.Type End If Next i Set oShape = nothing End Sub |
#5
|
||||
|
||||
The macro will delete shapes, including text boxes. Did the macro help?
Sometimes, a converted document may put text in text boxes (to imitate the layout of the original source). For example, this may happen with OCR (optical character recognition) software.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional Last edited by Stefan Blom; 02-26-2024 at 06:23 AM. |
#6
|
|||
|
|||
Nah, it seems to still leave some images. Take a look at the screenshot.
|
#7
|
|||
|
|||
I should perhaps add that I am making these edits in an RTF version of Word, so that the finished product isn't too huge. Could that be to blame for the Macro not working properly?
|
#8
|
||||
|
||||
The Shapes collection, which is used in the macro, will not remove shapes that are positioned "In line with text." For that, you'll need to reference InlineShapes.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
#9
|
||||
|
||||
Are you referring to the tiny shape or object which is repeated in my attached screen shot? I am not sure what it could be. It doesn't display clearly to me.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
#10
|
|||
|
|||
My practice, for important documents converted from another format that may have to undergo editing is to paste as plain text in a new document and then format using styles. This does not eliminate all problems but makes for a far cleaner document, less prone to curious anomalies.
|
#11
|
||||
|
||||
As Charles said, in many cases, starting fresh in plain text format will be safer, with converted documents. The process may be time-consuming, of course.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional |
#12
|
|||
|
|||
Yes, that mark on the document, and even the line that is next to it, which looks like a piece of text is actually an image that I need to remove.
|
#13
|
|||
|
|||
Quote:
|
#14
|
|||
|
|||
Quote:
I just don't know where to add that part. |
#15
|
||||
|
||||
At least in theory, you should be able to delete InlineShapes with a very similar macro:
Sub Macro1() Dim oShape As InlineShape Dim i As Integer For i = ActiveDocument.InlineShapes.Count To 1 Step -1 Set oShape = ActiveDocument.InlineShapes(i) If oShape.Type = msoPicture Then oShape.Delete Else Debug.Print oShape.Type End If Next i Set oShape = Nothing End Sub EDIT: The above code only acts on shape objects that are pictures. That is what the msoPicture is referring to. I initially overlooked this when I tried to customize the original macro. However, I am not sure that I remember correctly which objects are recognized as inline shapes, anymore. :-( Are you able to share a sample document with the forum? I am not referring to the entire 3000 page document, obviously, but a much shorter version with just the shapes/graphics and some dummy text.
__________________
Stefan Blom Microsoft Word MVP Microsoft 365 apps for business Windows 11 Professional Last edited by Stefan Blom; 03-01-2024 at 07:27 AM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Indentations in Mail and Calendar for Windows 10 | Mr M | Windows | 0 | 06-20-2018 07:01 AM |
Removing indentations at beginning of paragraphs and replacing with line spaces | captainamerica | Word | 2 | 10-27-2017 05:32 PM |
Interpreting special characters as bullets and indentations | burry01 | Word | 1 | 01-18-2016 12:24 AM |
Bullet indentations unexpected change | richard hans | Word | 2 | 01-15-2014 05:14 PM |
Word indentations | mepossem | Word | 2 | 10-07-2013 10:02 AM |