Spire.Doc is a professional Word .NET library specifically designed for developers to create, read, write, convert and print Word document files. Get free and professional technical support for Spire.Doc for .NET, Java, Android, C++, Python.

Thu Jan 27, 2022 9:24 am

Hello,

I have following problem: I create a paragraph with a tabstop. The text in the paragraph should be underlined, but when the text is inserted in the paragraph, the whole line is underlined, not only the inserted text. Is there a way to remove the underline under the tabulator?

Code:
Code: Select all
Paragraph paraInserted = new Paragraph(newDocument);
var tabs = paraInserted.Format.Tabs.AddTab(90);
tabs.Justification = TabJustification.Left;
tabs.TabLeader = TabLeader.NoLeader;
TextRange textRange1 = paraInserted.AppendText("\t" + txt);
textRange1.CharacterFormat.UnderlineStyle = UnderlineStyle.Single;
newDocument.Sections[0].Paragraphs.Insert(0, paraInserted);


Thanks!

y_schneider
 
Posts: 1
Joined: Thu Jan 27, 2022 9:12 am

Thu Jan 27, 2022 9:53 am

Hello,

Thanks for your inquiry!

Kindly note that the "\t" also is a tab, and if this is in the text range which you set underline on it, the tab also get underline too. Please refer to the following code, append "\t" and your text separately.

Code: Select all
            paraInserted.AppendText("\t");
            TextRange textRange1 = paraInserted.AppendText(text);
            textRange1.CharacterFormat.UnderlineStyle = UnderlineStyle.Single;
            document.Sections[0].Paragraphs.Insert(0, paraInserted);


If you have any other question, just feel free to contact us.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Wed Feb 09, 2022 8:46 am

Hello,

Hope you are doing well!

Has the issue been solved now? Could you please give us some feedback at your convenience?

Thanks in advance.

Sincerely,
Marcia
E-iceblue support team
User avatar

Marcia.Zhou
 
Posts: 858
Joined: Wed Nov 04, 2020 2:29 am

Return to Spire.Doc