Skip to content

Unset text formatting? #5

Description

@awagner-mainz

I hope this is a proper place to ask this:

I am successfully producing a document, but to me it seems like once I set a text attribute, it stays put. And when I add more text, the formatting remains active.

d := rtfdoc.NewDocument()

d.SetOrientation(rtfdoc.OrientationPortrait)
d.SetFormat(rtfdoc.FormatA4)

p := d.AddParagraph()
txt := p.AddText("Test:", 48, rtfdoc.FontTimesNewRoman, rtfdoc.ColorBlack)
txt.SetBold().SetUnderlining()

txt2 := p.AddText(" Blabla", 48, rtfdoc.FontTimesNewRoman, rtfdoc.ColorBlack)
txt2.SetItalic()

p.AddNewLine()
p.AddText("Even more blabla", 48, rtfdoc.FontTimesNewRoman, rtfdoc.ColorBlack)

This results in everything being bold and underlined, whereas I would like (at least) the second line to be regular font weight and non-underlined. Also, starting after "Test:", everything is in italics, whereas the second line should not be.

What I get:

Test: Blabla
Even more blabla

What I'd want:

Test: Blabla
Even more blabla

(github markdown has no underlining.)

How do I achieve this?

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions