1

I'm meeting some problem : I wanna loop through all paragraphs in a MS word document and if there is some specific text in the paragraph, I want to copy the paragraph to another 'MS Word' file.

However, although the paragraph may contain images, formulas, I can only find text in the destination word file (even the 'underlines' are not found in the new Word file). Is there any way to acheive this?

Is there any way to know the object I selected with my mouse and then show its object name.(I'm not familiar with MS objects hierarchy).

As you can see in this image, the red shape I selected should be formulas or images? enter image description here

for i in range(countParagraphs): 

  para = src_doc.Paragraphs[i]
  if "the specific text appears"
    rng = dst_doc.Range()
    rng.InsertAfter(Paragraphs[i])
    rng.InsertAfter(src_doc.Shapes[i].TextFrame.TextRange.Text)
4

0 回答 0