DocIO - unable to set font size

Hey,

I'm trying to change font size in table and seems like it doesn't work
Did I miss something?

WTable table = new WTable(document);

var row = table.AddRow();

var cell = row.AddCell();

var p = cell.AddParagraph().AppendText("Наименование");

I'm using Blazor Server side app

Hey,

I'm trying to change font size in table and seems like it doesn't work
Did I miss something?

WTable table = new WTable(document);

var row = table.AddRow();

var cell = row.AddCell();

var p = cell.AddParagraph().AppendText("Наименование");

I'm using Blazor Server side app

 Syncfusion.Blazor Version="18.3.0.35"

 Syncfusion.DocIO.Net.Core Version="18.3.0.35"

Thanks in advance

Thanks in advance


3 Replies 1 reply marked as answer

HC Hemalatha Chiranjeevulu Syncfusion Team January 21, 2021 04:26 PM UTC

Hi Maksim,

Thank you for contacting Syncfusion support.

To achieve your requirement, please refer the below highlighted code example to change font size:

 
WordDocument document = new WordDocument(); 
WTable table = new WTable(document); 
var row = table.AddRow(); 
var cell = row.AddCell(); 
var p = cell.AddParagraph();
IWTextRange textRange = p.AppendText("Наименование"); 
//Change the font size
textRange.CharacterFormat.FontSize = 10;
 


Please refer the below UG links to know more about table and text:
https://help.syncfusion.com/file-formats/docio/working-with-tables
https://help.syncfusion.com/file-formats/docio/working-with-paragraph#working-with-text

If you are still facing issues means, we suspect that the problem might be due to code snippet and input document used at your end, Could you please share the complete code snippet and input Word document used at your end. Thereby, we will proceed further to reproduce the issue and provide you the appropriate solution.

Please let us know if you have any other questions.

Regards,
Hemalatha C




MA Maksim January 27, 2021 12:43 PM UTC

Hey, thanks a lot, but it still doesn't work.
I've attached a simple console app. Hope it will help.

Thanks in advance

Attachment: DocIOTableFontSize_134d75ec.zip


HC Hemalatha Chiranjeevulu Syncfusion Team January 28, 2021 11:58 AM UTC

Hi Maksim,

Thank you for your update.

To achieve your requirement, we suggest you to set the save formatting as false. Please find the modified code snippets to achieve requirement:

 
// Set up table 
WTable table = new WTable(document); 
var row = table.AddRow(); 
//row.IsHeader = true; 
var cell = row.AddCell(); 
//cell.Width = 96f; 
var p = cell.AddParagraph(); 
var textRange = p.AppendText("Наименование и краткая характеристика товара"); 
textRange.CharacterFormat.FontSize = 20; 
//Replaces the table placeholder text with a new table 
TextBodyPart bodyPart = new TextBodyPart(document); 
bodyPart.BodyItems.Add(table); 
document.Replace("{singleTable}", bodyPart, true, true,false); 

For your reference, we have attached the Word document which generated at our end using the above code snippets.
Output Word document: https://www.syncfusion.com/downloads/support/directtrac/161713/ze/Result665156200

Please let us know if you have any other questions.

Regards,
Hemalatha C


Marked as answer
Loader.
Up arrow icon