I have a word template that has a header table which is set to font size 11, after populating the template the text came out to be font size 12. Besides the header, all the other font size in the template came out as it should be. What can the problem be, doesn’t it take the font size defined from the template? How can I set only the font size of the header to 11 if that has to be done?
Thanks in advance for your help.
Hi
Thanks for your inquiry. Could you please attach your template and provide me your code for testing? I will investigate this issue and provide you more information.
Best regards.
Hi
Thanks for additional information. This occurs because you are creating new run. The newly created Run has default formatting (font size: 12, font name: Times New Roman etc.). I think you should use the following code to populate header in your document:
'start of populating boe header here
'Get header table from the first section of document
Dim myTable As Aspose.Words.Tables.Table = doc.Sections(boe).HeadersFooters(Aspose.Words.HeaderFooterType.HeaderPrimary).Tables(0)
'Insert Classification Label
builder.MoveTo(myTable.Rows(0).Cells(1).FirstParagraph)
builder.Write(classification_label)
'Insert Company Label
builder.MoveTo(myTable.Rows(1).Cells(0).FirstParagraph)
builder.Write(company_lbl)
'Insert Prime ID #
builder.MoveTo(myTable.Rows(3).Cells(1).FirstParagraph)
builder.Write(prime_id)
'Insert Date
builder.MoveTo(myTable.Rows(3).Cells(3).FirstParagraph)
builder.Write(lastmod)
'Insert Assist ID #
builder.MoveTo(myTable.Rows(3).Cells(5).FirstParagraph)
builder.Write(assist_id)
'Insert Program Name
builder.MoveTo(myTable.Rows(4).Cells(1).FirstParagraph)
builder.Write(projtitle)
'Insert WBS
builder.MoveTo(myTable.Rows(4).Cells(3).FirstParagraph)
builder.Write(wbs)
'Insert Task Title
builder.MoveTo(myTable.Rows(5).Cells(1).FirstParagraph)
builder.Write(tasktitle)
'Insert Option
builder.MoveTo(myTable.Rows(5).Cells(3).FirstParagraph)
builder.Write(opt)
'Insert Clin/slin
builder.MoveTo(myTable.Rows(5).Cells(5).FirstParagraph)
builder.Write(clin)
'end of populating header
Hope this helps.
Best regards,