Results 1 to 5 of 5
  1. #1
    mat_tob
    Guest

    Properties of a paragraph in Word 2000

    I need to be able to compare the properties of a paragraph in a document with the properties of the paragraph for the underlying style of the same paragraph. Is this possible ?, if so, do I have to compare each property in turn or is there a faster way.

  2. #2
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Properties of a paragraph in Word 2000

    Matt,

    Do you need to compare "paragraph" properties of the paragraph only, or do you also need to flag any font properties (applied to any character in the paragraph, which might differ from the font properties in the underlying style)?

    If the former, there might be a trick to do this test quickly; if the latter, you might have to examine each character in the entire paragraph, which would be quite a bit more laborious.

    Gary

  3. #3
    Super Moderator
    Join Date
    Dec 2000
    Location
    New York, NY
    Posts
    2,970
    Thanks
    3
    Thanked 29 Times in 27 Posts

    Re: Properties of a paragraph in Word 2000

    Hi again,

    Here's a macro which will compare the paragraph properties of the selected paragraph, against the paragraph properties of the underlying style.

    This uses a trick: save the document, then temporarily reset the paragraph to the underlying style (equivalent to Ctl+Q), then test to see if the document is 'dirty' (and lastly undo the reset if it has changed anything).

    Based on a quick test, this same method can't be used to test for font properties, as the .Font.Reset statement appears to register as a change to the document, whether it has actually changed anything or not.

    Sub TestParaPropsVsStyle()
    Dim objDoc As Document
    Set objDoc = ActiveDocument
    objDoc.Save
    Selection.Paragraphs(1).Reset
    If objDoc.Saved Then
    MsgBox "The selected paragraph conforms to the paragraph properties of the underlying style"
    Else
    MsgBox "The selected paragraph does not conform to the paragraph properties of the underlying style"
    objDoc.Undo
    Selection.Collapse
    End If
    End Sub

    Gary

  4. #4
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: Properties of a paragraph in Word 2000

    This vaguely reminds me of our discussion of how to test for changed typeface in a paragraph. My suggestion was <A target="_blank" HREF=http://www.wopr.com/cgi-bin/w3t/showthreaded.pl?Cat=&Board=wrd&Number=16107>here</A>. What fun!

  5. #5
    mat_tob
    Guest

    Re: Properties of a paragraph in Word 2000

    For now I am only interested in the format of the paragraphs and not fonts in a paragraph, so the code supplied is very useful. thanks alot for the help.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •