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.

Sun Jun 07, 2020 2:11 pm

Hi Team,

When we are trying to apply bold and Font Family it is not applying. Can you please check and confirm? what is issues and why we are unable to apply Font Family and Bold.

foreach (DocumentObject childObj in section.Paragraphs[i].ChildObjects)
{

if (childObj is TextRange)
{
TextRange tr = childObj as TextRange;

tr.CharacterFormat.FontName = "Verdana";

tr.CharacterFormat.Bold = true;

tr.CharacterFormat.Italic = true;


}
}
}

for (int i = 0; i < section.Tables.Count; i++)
{

foreach (TableRow row in section.Tables[i].Rows)
{
foreach (TableCell cell in row.Cells)
{
for (int j = 0; j < cell.Paragraphs.Count; j++)
{
foreach (DocumentObject childObj in cell.Paragraphs[j].ChildObjects)
{
if (childObj is TextRange)
{
TextRange tr = childObj as TextRange;


tr.CharacterFormat.FontName = "Verdana";


tr.CharacterFormat.Bold = true;

tr.CharacterFormat.Italic = true;
}
}
}


}


}
}

Regards,
Ravi

ravikumarh99
 
Posts: 10
Joined: Thu May 14, 2020 2:58 am

Mon Jun 08, 2020 7:00 am

Hello,

Thanks for your inquiry.
I tested your case but didn't encounter the issue you mentioned. The following is my test project, you can run it directly on your side.
http://www.e-iceblue.com/downloads/demo/21792Demo.zip

Have you done anything else with the document? To help us investigate further, please share a sample runnable project that could reproduce your issue. You could upload it to the DropBox or OneDrive and then share the download link with us. Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Wed Jun 17, 2020 3:41 am

Hello,

Greetings from E-iceblue!
How is your issue now? Could you please give us some feedback at your convenience?
Thanks in advance.

Sincerely,
Rachel
E-iceblue support team
User avatar

rachel.lei
 
Posts: 1571
Joined: Tue Jul 09, 2019 2:22 am

Return to Spire.Doc