none
Word parser RRS feed

  • Question

  • Hi,

      I have a requirement like reading word content. I am able to read normal content properly, but unable to read below parts.

    - Image Parts

    - Header Parts

    - Footer Parts

    - Tables

    I am confused in

    1. How to identify Image section from the Document

    2. How to get Perticular Image Stream and How to display in HTML. (Using IMG Attribute)

    3. How to identify Header and Footer Section of the Document

    4. How to Indentify Table Section of the Document

    Please revert to me with the solution as I required this at the highest priority.

    Thanks,

    Dileep 

    Monday, April 7, 2014 12:33 PM

Answers

  • Hi,

    >>1. How to identify Image section from the Document. 2. How to get Particular Image Stream and How to display in HTML. (Using IMG Attribute)<<

    In Word Object Model, Shape Object represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, ActiveX control, or picture.

    You could refer to the code below to access to the particular picture.

    ActiveDocument.Shapes("Rectangle 1").Fill.ForeColor.

    >>3. How to identify Header and Footer Section of the Document<<

    HeadersFooter Object represents a single header or footer.

    >>4. How to Identify Table Section of the Document<<

    Table Object represents a single table.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, April 8, 2014 6:53 AM
    Moderator
  • Hi,

    Find.Execute Method of range object is used to run the specified find operation. We could use it to get a range with a specified text or format and so on. For example, we can find all strings "Mobile" with Find.Execute method.

    But if you want to get text before or after the found range "Mobile" directly, I'm afraid there is no method of Range Object in Word Object Model can do that.

    If the "Mobile" information is in a single paragraph or a single line of the document, we could resort to Range.EndOf method as a workaround to select all Mobile information. Here is a sample of your reference. If you just want to find the string "1111", I'm afraid it's hard to do that.

    Sub FindInfor()
    
    Dim range As range
    
    Set range = ActiveDocument.range
    
    With range.Find
    .Text = "Mobile"
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    
    Do While .Execute(Forward:=True) = True
    
            range.Select
            'Selection.EndOf Unit:=wdLine, Extend:=wdExtend
            Selection.EndOf Unit:=wdParagraph, Extend:=wdExtend
            MsgBox Selection.Text
    
    Loop
    
    End With
    End Sub

    By the way, since the original question has been resolved, in order to involve more partners of this community to share their knowledge or learn from your interaction with us, for more questions, I suggest you posting a new thread in the forum.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 11, 2014 3:32 AM
    Moderator

All replies

  • Hello Dileep,

    Please take a look at the Word Object Model Overview article in MSDN. It describes core classes from the object model.

    Pay special attention to the following articles:

    How to: Programmatically Add Pictures and Word Art to Documents

    How to: Programmatically Add Headers and Footers to Documents

    How to: Programmatically Create Word Tables

    Monday, April 7, 2014 9:09 PM
  • Hi,

    >>1. How to identify Image section from the Document. 2. How to get Particular Image Stream and How to display in HTML. (Using IMG Attribute)<<

    In Word Object Model, Shape Object represents an object in the drawing layer, such as an AutoShape, freeform, OLE object, ActiveX control, or picture.

    You could refer to the code below to access to the particular picture.

    ActiveDocument.Shapes("Rectangle 1").Fill.ForeColor.

    >>3. How to identify Header and Footer Section of the Document<<

    HeadersFooter Object represents a single header or footer.

    >>4. How to Identify Table Section of the Document<<

    Table Object represents a single table.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Tuesday, April 8, 2014 6:53 AM
    Moderator
  • Hi,

    That is fine, but how to identify mobile number in word document. 

    I can find the word "mobile" by using find.execute() method, after that i want to get mobile number beside that text("mobile").

    Not only that, I want to find mail id, address... etc. 

    Target is after using find.execute() method, how can I get text before or after that occurrence.

    Thanks,

    Dileep kumar

    Thursday, April 10, 2014 11:18 AM
  • Hi,

    Find.Execute Method of range object is used to run the specified find operation. We could use it to get a range with a specified text or format and so on. For example, we can find all strings "Mobile" with Find.Execute method.

    But if you want to get text before or after the found range "Mobile" directly, I'm afraid there is no method of Range Object in Word Object Model can do that.

    If the "Mobile" information is in a single paragraph or a single line of the document, we could resort to Range.EndOf method as a workaround to select all Mobile information. Here is a sample of your reference. If you just want to find the string "1111", I'm afraid it's hard to do that.

    Sub FindInfor()
    
    Dim range As range
    
    Set range = ActiveDocument.range
    
    With range.Find
    .Text = "Mobile"
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    
    Do While .Execute(Forward:=True) = True
    
            range.Select
            'Selection.EndOf Unit:=wdLine, Extend:=wdExtend
            Selection.EndOf Unit:=wdParagraph, Extend:=wdExtend
            MsgBox Selection.Text
    
    Loop
    
    End With
    End Sub

    By the way, since the original question has been resolved, in order to involve more partners of this community to share their knowledge or learn from your interaction with us, for more questions, I suggest you posting a new thread in the forum.


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, April 11, 2014 3:32 AM
    Moderator