vb.net - MS vb 2008 richtectbox1.text and display in Words underlined -
i have richtextbox accept user input. when 'cetak' (print) button clicked input go ms words.
i want display input in words input fontstyle change underline.
for example user input : jessica
output @ words : jessica (with underline)
public class form1 private sub btnprint_click(byval sender system.object, byval e system.eventargs) handles btnprint.click dim ps new pagesettings dim oword word.application dim odoc word.document dim opara1 word.paragraph 'start word , open document template. oword = createobject("word.application") oword.visible = false odoc = oword.documents.add odoc.pagesetup.orientation = word.wdorientation.wdorientportrait dim rng word.range = odoc.paragraphs(1).range rng.font.size = 10 odoc.paragraphs.linespacingrule = word.wdlinespacing.wdlinespacesingle richtextbox1.text = richtextbox1.text.toupper opara1 = odoc.content.paragraphs.add opara1.range.font.colorindex = word.wdcolorindex.wdblack opara1.range.text = "try: " & richtextbox1.text opara1.range.insertparagraphafter() oword.visible = true odoc.printpreview() end sub end class
from comment :
if put coding opara1.range.font.underline = word.wdunderline.wdunderlinesingle whole paragraph underline including 'try: '. want input underline
yes text underlined because setting paragraph "try: " , richtextbox1 content
your code :
opara1.range.text = "try: " & richtextbox1.text
so in order accomplish goal , ie. :
to underline content in richtextbox use code below , export word:
richtextbox1.selectionfont = new font(richtextbox1.font, fontstyle.underline)
and export same word application.
Comments
Post a Comment