Uniform first line indents

P

Purnima

Hi,

I am trying to code a macro which will determine the first line indents of
all paragraphs in a document, and use the indent value that occurs the most
often. All the first line indents should be set to this indent value.

I have declared an integer array to store all the first line indents. Now I
have to determine the indent value which occurs the maximum in this array.
But I just cannot figure out how to do this. Sorting the array won't help,
because it will give me the highest indent value and not the value which
occurs maximum no. of times.

I'm not sure if this logic is the best. And even if it is, I don't know how
to move further with the macro.

Can anyone please direct me?
Any help will be appreciated.

Purnima.
 
J

John McGhie [MVP - Word and Word Macintosh]

1) Create a Style. Let's call it "NormalFirstIndent"

2) Apply that style to all indented paragraphs in the document

3) Use format>Styles and Formatting>Modify... To set the value of the first
line indent for the style NormalFirstIndent.

Regardless of WHAT indent the paragraphs in the document had, they now ALL
have exactly the indent you just set.

That's what styles are for: to instantly apply uniform formatting properties
to all of the paragraphs of a specified type in the document.

You do not need (and should not use) any coding to do this one :)

Cheers

Hi,

I am trying to code a macro which will determine the first line indents of
all paragraphs in a document, and use the indent value that occurs the most
often. All the first line indents should be set to this indent value.

I have declared an integer array to store all the first line indents. Now I
have to determine the indent value which occurs the maximum in this array.
But I just cannot figure out how to do this. Sorting the array won't help,
because it will give me the highest indent value and not the value which
occurs maximum no. of times.

I'm not sure if this logic is the best. And even if it is, I don't know how
to move further with the macro.

Can anyone please direct me?
Any help will be appreciated.

Purnima.

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410
 
P

Purnima

Hi John,

Thanks for replying.
Yes. I'm aware that it's not necessary to code a macro to do such simple
stuff.

The reason:
We are into editing word documents. We have to retain the formatting in the
original document while editing. Now, sometimes we notice that the indent is
not uniform throughout the document and so we have to find the indent value
used most in the document and format the document according to that indent
value.

So a macro can prove to be really helpful for long documents.

Purnima.

John McGhie [MVP - Word and Word Macinto said:
1) Create a Style. Let's call it "NormalFirstIndent"

2) Apply that style to all indented paragraphs in the document

3) Use format>Styles and Formatting>Modify... To set the value of the first
line indent for the style NormalFirstIndent.

Regardless of WHAT indent the paragraphs in the document had, they now ALL
have exactly the indent you just set.

That's what styles are for: to instantly apply uniform formatting properties
to all of the paragraphs of a specified type in the document.

You do not need (and should not use) any coding to do this one :)

Cheers

Hi,

I am trying to code a macro which will determine the first line indents of
all paragraphs in a document, and use the indent value that occurs the most
often. All the first line indents should be set to this indent value.

I have declared an integer array to store all the first line indents. Now I
have to determine the indent value which occurs the maximum in this array.
But I just cannot figure out how to do this. Sorting the array won't help,
because it will give me the highest indent value and not the value which
occurs maximum no. of times.

I'm not sure if this logic is the best. And even if it is, I don't know how
to move further with the macro.

Can anyone please direct me?
Any help will be appreciated.

Purnima.

--

Please reply to the newsgroup to maintain the thread. Please do not email
me unless I ask you to.

John McGhie <[email protected]>
Microsoft MVP, Word and Word for Macintosh. Consultant Technical Writer
Sydney, Australia +61 (0) 4 1209 1410
 

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