Skip to content

Commit d2b3fbb

Browse files
committed
support for paragraph's textruns in hyperlinks
1 parent 12ab4fb commit d2b3fbb

3 files changed

Lines changed: 5 additions & 1 deletion

File tree

lib/docx/containers/paragraph.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def to_s
4141

4242
# Array of text runs contained within paragraph
4343
def text_runs
44-
@node.xpath('w:r').map {|r_node| Containers::TextRun.new(r_node) }
44+
@node.xpath('w:r|w:hyperlink/w:r').map {|r_node| Containers::TextRun.new(r_node) }
4545
end
4646

4747
# Iterate over each text run within a paragraph

spec/docx/document_spec.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,10 @@
8383
@doc.tables[0].columns[0].cells[5].text.should eq "aphids"
8484
@doc.tables[0].columns[1].cells[5].text.should eq "puceron"
8585
end
86+
87+
it "should read embedded links" do
88+
@doc.tables[0].columns[1].cells[1].text.should =~ /^Directive/
89+
end
8690
end
8791

8892
describe 'editing' do

spec/fixtures/tables.docx

98 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)