Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions js/docx/smoke/api_paragraph/set_font_family.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
builder.CreateFile("docx");
var oDocument = Api.GetDocument();
var oParagraph = oDocument.GetElement(0);
oParagraph.AddText("This is a paragraph with the font family set to ");
oParagraph.AddText('Consolas')
oParagraph.SetFontFamily("Consolas");
builder.SaveFile("docx", "SetFontFamily.docx");
builder.CloseFile();
5 changes: 5 additions & 0 deletions spec/docx/smoke/api_paragraph_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -261,4 +261,9 @@
docx = builder.build_and_parse('js/docx/smoke/api_paragraph/set_widow_control.js')
expect(docx.elements[5].orphan_control).to be_truthy
end

it 'ApiParagraph | SetFontFamily method' do
docx = builder.build_and_parse('js/docx/smoke/api_paragraph/set_font_family.js')
expect(docx.elements[0].nonempty_runs[0].font).to eq(docx.elements[0].nonempty_runs[1].text)
end
end