• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Addressing a page in Microsoft Word (Christian Boyce)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Addressing a page in Microsoft Word (Christian Boyce)


  • Subject: Re: Addressing a page in Microsoft Word (Christian Boyce)
  • From: Christian Boyce via AppleScript-Users <email@hidden>
  • Date: Wed, 3 Feb 2021 21:36:03 -0800

Thanks for this! It gives me a way of working through the paragraphs. That’s
really fantastic.

I was doing something more like this:

Set theParagraphs to every paragraph of document 1
Set ParagraphCount to count of theParagraphs

But I can see that your method of settings something to COUNT the paragraphs is
way better. For one thing, it works at all, while my code crashes Word. For
another, your method is lickety-split (at least until I start looping through
3900 paragraphs). No need to know what every paragraph is in order to count
them. Just count them. Got it.

Really interesting technique. Thanks very much.

c
> On Feb 3, 2021, at 12:49 PM, Olof Hellman <email@hidden> wrote:
>
> Christian -
>
> If you are having issues with larger documents doing "every paragraph of
> document 1”, it may be a workaround to loop through the paragraphs one by one
> by index, rather than as a whole collection.  That is, first count the
> paragraphs, then loop getting paragraph n each time through the loop.
>
> For example, try this on a largish document:
>
> set wordCount to 0
> tell application "Microsoft Word"
>       set paragraphCount to count paragraphs of document 1
>       repeat with n from 1 to paragraphCount
>               set nthParagraph to paragraph n of document 1
>               -- do something with nthParagraph
>               set wc to count words of text object of nthParagraph
>               set wordCount to wordCount + wc
>       end repeat
> end tell
> wordCount
>
> One problem with addressing by page is that paragraphs are not neatly
> distributed into individual pages — a single paragraph can span multiple
> pages, so the document container hierarchy doesn’t really accommodate ‘page’
> as an object on its own very well.
>
> - Olof

—

 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Prev by Date: Addressing a page in Microsoft Word
  • Next by Date: Re: Man entry to pdf variant command
  • Previous by thread: Addressing a page in Microsoft Word
  • Next by thread: Re: Man entry to pdf variant command
  • Index(es):
    • Date
    • Thread