You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Here's a way to do it using Nokogiri (which is what docx uses under the hood)
require'docx'require'nokogiri'definsert_colored_text_after(bookmark,text,hex_color)color=Nokogiri::XML::Node.new("w:color",bookmark.node)color['w:val']=hex_colortext_run=bookmark.get_run_aftertext_run.text="#{text}#{text_run.text}"text_run.node.children.eachdo |child|
#Find the node for formattingifchild.name == "rPr"child<<color end endend
Hi, is there anyway to set the color of the text that is inserted using insert_text_after?
If not, I can try to add it, but can someone give me a hint of where to look or generally what to do? (I don't know anything about docx format).
thanks
Joel
The text was updated successfully, but these errors were encountered: