xlwings icon indicating copy to clipboard operation
xlwings copied to clipboard

Underlining a portion of the text in a cell

Open srob3 opened this issue 8 months ago • 1 comments

In Excel VBA, if I have text in the cell referenced by the range object r, I can do:

r.Characters(1, 10).Font.Underline = True

to underline just the first 10 characters of the text.

r.api.Characters(1, 10).Font.Underline = True

produces the error:

builtins.TypeError: 'Characters' object is not callable

I have tried many many different approaches but cannot figure out how to underline partial text with xlwings.

Can someone please explain how to do this.

srob3 avatar Aug 08 '25 02:08 srob3

Maybe trying r.characters[1:10].api.Font.Underline = True

gepcel avatar Aug 08 '25 04:08 gepcel