Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Closed Thread
 
Thread Tools Display Modes
  #1  
Old 06-14-2011, 07:06 PM
fig000 fig000 is offline Get rid of leading spaces before paragraphs Windows Vista Get rid of leading spaces before paragraphs Office 2007
Novice
Get rid of leading spaces before paragraphs
 
Join Date: Jun 2011
Posts: 6
fig000 is on a distinguished road
Default Get rid of leading spaces before paragraphs

Hi,

I'm not much of a word expert. I'm a programmer and have considered using VBA but am not good at that either. I'm hoping there is a simpler approach.

More specifically this is a manuscript that I worked on years ago and am prettying up to present to someone.Not thinking about it I originally used three spaces manually entered as an indentation at the beginning of a paragraph in stead of tabs. I've tried a few things to clear out these soaces but nothing works. My goal is to force all the text be right up against the left hand margin, including the first line of the paragraph. That's how the agent wants it to be. I guess they must have some software that formats the text.

Any suggestions would be appreciated.



Fig000
  #2  
Old 06-14-2011, 10:07 PM
macropod's Avatar
macropod macropod is offline Get rid of leading spaces before paragraphs Windows 7 32bit Get rid of leading spaces before paragraphs Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Fig,

Try a wildcard Find/Replace, where:
Find =^13[ ]{1,}
Replace = ^p

An alternative is:
Find = [ ]{1,}([!^13]@^13)
Replace = \1

The first one replaces the spaces following a paragraph break - which is effectively the same as replacing spaces before a paragraph's text - except for the first paragraph in a Section or table cell. The second one replaces the spaces at the start of a paragraph, except for the last paragraph in a table cell. There is no Find/Replace formulation that will locate solitary 'paragraphs' within a table cell.

Your publisher probably also won't want multiple paragraph breaks (ie lines created by hitting the Enter key) between your 'real' paragraphs. You can clean those out with another wildcard Find/Replace, where:
Find = [^13]{1,}
Replace = ^p

Likewise, multiple spaces after periods, etc, for which you can use yet another wildcard Find/Replace, where:
Find = ( )[ ]{1,}
Replace = \1

Note: The correct way to apply the indented formatting you obtained via the spacebar is via first line indenting for the paragraph (eg Format|Paragraph), preferably by defining an appropriate paragraph Style and applying that to the paragraphs of interest. This is most likely what your publisher will do - along with specifying an appropriate before/after space setting for each paragraph.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
  #3  
Old 06-19-2011, 08:27 PM
fig000 fig000 is offline Get rid of leading spaces before paragraphs Windows Vista Get rid of leading spaces before paragraphs Office 2007
Novice
Get rid of leading spaces before paragraphs
 
Join Date: Jun 2011
Posts: 6
fig000 is on a distinguished road
Default

Macropod,

Thanks for responding. I'll admit these find/replace things are new to me. I will research it.

However I wanted to run something by you. I wrote a small .net program that brought in parts of the word doc one character at a time. I found a paragraph by looking at the doc in word and found that at the beginning of paragraph there were two leading "spaces" (I'm not sure what the characters were-I wanted to find the ascii codes of these two characters thinking that there might be some garbage or some Word formatting characters)

The odd thing is that I found the last few charactesrs of the previous paragraph then an ascii 13 (a carriage return). At the beginning of the new paragraph with the two spaces, I could only see the first visible letter in the document that was in the paragraph's. In other words the two "spaces" weren't in the file.

As a test I went into a copy of the word doc. I was able to get rid of the "spaces" by backspacing over them.

If there is something I don't know, such as the fact that some of the formatting characters are not directly in line with the text, please tell me. I could go through this by hand but I'd rather not.

Any help would be appreciated.

Thanks,
Fig000
  #4  
Old 06-20-2011, 12:17 AM
macropod's Avatar
macropod macropod is offline Get rid of leading spaces before paragraphs Windows 7 64bit Get rid of leading spaces before paragraphs Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Fig,

I don't understand what you mean by:
Quote:
program that brought in parts of the word doc one character at a time
From where? A Word document? If so, Word doesn't put anything at the start of a paragraph and, even if there was something there, you can get a whole paragraph via the paragraph range. As for your comment about ASCII 13, every Word paragraph is actually terminated by an ASCII 10/13 pair, though the ASCII 10 character is effectively inaccessible. Conversely, replacing a Word paragraph break with ASCII 13 doesn't actually create a new paragraph, even though the line break and the presence of the ¶ symbol might suggest otherwise.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
  #5  
Old 06-20-2011, 07:32 PM
fig000 fig000 is offline Get rid of leading spaces before paragraphs Windows Vista Get rid of leading spaces before paragraphs Office 2007
Novice
Get rid of leading spaces before paragraphs
 
Join Date: Jun 2011
Posts: 6
fig000 is on a distinguished road
Default

Macropod,

Yes, I wrote a .net program that read the same word file I'm working on to try to get rid of the "spaces" before the beginning of paragraphs. I thought that the formatting would be linear. In other words, there would be a sentence, a period, a ascii 13 for the end of the paragraph (I didn't see the ascii 10) and then I'd see the characters who occupied the two "spaces". There were no spaces there and in fact there were no two bytes at all. I saw the text that was shown in the word document after the "spaces". So I guess that word documents are not entirely "linear".

It seems I can't write a program to fix this automatically. I am not interested in learning the ins and outs of how a word document is structured since it will take a while to figure it out.

The "spaces" are still there. I tried the ctrl-a, cntl-e, ctrl-l trick after clearing out all the tabs. I'm not sure what is causing this. Any help would be appreciated. Sorry this is confusing. I'm a programmer, not an office expert damn it!!! :-).

Fig000
  #6  
Old 06-21-2011, 12:26 AM
macropod's Avatar
macropod macropod is offline Get rid of leading spaces before paragraphs Windows 7 64bit Get rid of leading spaces before paragraphs Office 2007
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Fig,
Quote:
I am not interested in learning the ins and outs of how a word document is structured
Without wanting to place too fine a point on it, had you taken the time for this, you wouldn't be in the predicament you're now in.

Even without knowing what the 'spaces' are, it's possible to delete them via an ordinary Find/Replace, where:
Find = ^p^w
Replace = ^p
This will delete ordinary spaces, non-breaking spaces & tabs following a paragraph break (i.e. at the start of the following paragraph).

Alternatively, as a variation of the solution suggested in the first post, you could use a wildcard Find/Replace, where:
Find = [ ^s^t]{1,}([!^13]@^13)
Replace = \1
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
  #7  
Old 06-22-2011, 08:56 PM
fig000 fig000 is offline Get rid of leading spaces before paragraphs Windows Vista Get rid of leading spaces before paragraphs Office 2007
Novice
Get rid of leading spaces before paragraphs
 
Join Date: Jun 2011
Posts: 6
fig000 is on a distinguished road
Default

Macropod,

I will learn more about the replaces and maybe they will help me. As for understanding the structure of a word document, I'll point out that I've been deailing with this document from the Word UI and not with a program. Somehow something was inserted before the beginning of some paragraphs, not all of them. My attempts to remove tabs got rid of some of them but not all.

I will say two things:
1. I don't think that in the ui of any word processing software I should be able to insert "something" that I can't find and get rid of. If that is a possibility with a UI, then there is something wrong. The most I could have done was to either enter a tab or hand enter spaces. If there is some other effect that occurs that shouldn't be happening I don't know what it is. If you have any ideas I'd like to hear them.
2 Understanding the structure of a word document to the level I've been looking is not something that most people would undertake. Obviously I shouldn't need to know how a doc is structured; that's something that is obviously handled behind the scenes. I would think that with proprietary format this information would be something Microsoft would not want me to know. As I said, the UI would handle everything and any odd structuring that goes on behind the scenes should be transparent to me. I'm sure I could learn VBA and spend weeks finding out how the file is structured so I could use a program to fix it but that defeats the purpose of having a UI that does the work for you. I doubt that many people have tried this.
I have exposed the word tags and have seen nothing to give me any idea of why this is happening. So I guess I'll just have to keep hacking until I find the answer.
I have considered posting a small fragment of my doc where the mysterious spaces are but I can't see how that would be done.Would that be helpful and is it possible?

I will try your find replace suggestions. Thanks for those Maybe they will help.

Fig000
  #8  
Old 06-23-2011, 12:43 AM
macropod's Avatar
macropod macropod is offline Get rid of leading spaces before paragraphs Windows 7 64bit Get rid of leading spaces before paragraphs Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Fig,
Quote:
I've been deailing with this document from the Word UI and not with a program
Fair enough - I gained the impression from your previous posts that the document was constructed progrmatically. Presumably, then, you've used copy/cut and paste to import material from one or more other documents. However, I've never before seen (or heard of) a case where such a process resulted in Word inserting something that wasn't already there. As for:
Quote:
I don't think that in the ui of any word processing software I should be able to insert "something" that I can't find and get rid of.
I very much doubt that this has occurred. Rather, the issue is one of identifying what has been inserted that you don't want, so that it can be deleted. To that end, by all means do post a stripped-down copy of the document with a representative sample of problem paragraphs (the first couple of words from each should suffice).

BTW: Word 2007 does not use a proprietary format for its native docx/docm files; they're nothing more than a zipped collection of xml files. Change any such file's extension to .zip and you can access the contents with programs like WinZip.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
  #9  
Old 06-23-2011, 06:36 PM
fig000 fig000 is offline Get rid of leading spaces before paragraphs Windows Vista Get rid of leading spaces before paragraphs Office 2007
Novice
Get rid of leading spaces before paragraphs
 
Join Date: Jun 2011
Posts: 6
fig000 is on a distinguished road
Default

Macropod,

Thanks you for all your help. No never manipulated the doc with a program. I had the mistaken notion that the two "spaces", whatever they were, would show up in a stream of the document. However there is nothing there so it must have something to do with some unknown formatting character somewhere in the vicinity of the "spaces". I doubt I'll find these though I'll keep looking.

I did try your find replace and it didn't really seem to recognize the find value you suggested (^13??). So I'll ask how I can post a smal snippet of the document. I didn't see any buttons on this forum that would allow that. Let me know how I can do that. I can only hope that it will something small and obvious to you.

Thanks again,
Fig000
  #10  
Old 06-23-2011, 07:01 PM
macropod's Avatar
macropod macropod is offline Get rid of leading spaces before paragraphs Windows 7 64bit Get rid of leading spaces before paragraphs Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Fig000,

If there really is nothing there, perhaps they're paragraph indents, not spaces, etc.

To attach a document to a post, click on the 'Go Advanced' button, then on the paperclip symbol. The rest is fairly straightforward.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
  #11  
Old 03-14-2016, 08:45 AM
Csaba Csaba is offline Get rid of leading spaces before paragraphs Windows 8 Get rid of leading spaces before paragraphs Office 2010 64bit
Novice
 
Join Date: Mar 2016
Posts: 1
Csaba is on a distinguished road
Default

Hi,

I would like to have an answer to the original question.

All the find/replace answers were useful if you want to change leading spaces "after" the paragraph mark. But the real question (at least mine) is how to find the beginning of a paragraph.

The two things are not the same. Ie. when you replace something in a selection, the first paragraph in the selection would not be found. If you have multiple selections there might be several "first" paragraphs which would not be found.

Also the last paragraph mark would replace something which is NOT in the selection.

Is there any solution for the original question?

Csaba
  #12  
Old 03-14-2016, 01:59 PM
macropod's Avatar
macropod macropod is offline Get rid of leading spaces before paragraphs Windows 7 64bit Get rid of leading spaces before paragraphs Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

The original question has been answered. If you have a different question, start your own thread instead of trying to resurrect one whose discussion concluded years ago.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Closed Thread



Similar Threads
Thread Thread Starter Forum Replies Last Post
Get rid of leading spaces before paragraphs HELP - problem with disappearing spaces klanch Word 3 02-11-2011 10:32 AM
changing font size without changing leading carolns Word 1 09-14-2009 12:30 PM
Get rid of leading spaces before paragraphs Eliminate blanc spaces at the beginnig row Il_Fabietto Word VBA 9 06-26-2009 05:04 AM
Spaces After Each Word jnutella Word 0 03-04-2009 02:00 PM
Word to Excel hyperlinks and spaces gak Word 1 09-14-2008 08:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:04 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft