EvotecIT / OfficeIMO

Fast and easy to use cross-platform .NET library that creates or modifies Microsoft Word (DocX) and later also Excel (XLSX) files without installing any software. Library is based on Open XML SDK
MIT License
280 stars 50 forks source link

Set special characters to the document's default font. #54

Closed eliseudev closed 1 year ago

eliseudev commented 1 year ago

Hello, I wanted to know if there's a way to set the default font for special characters for example, I put the default font in the "Segoe UI" document, but when it has a special character it stays with the "Calibri" font, how can I adjust it? Note, the font supports special characters. (follow the prints)

image


image

PrzemyslawKlys commented 1 year ago

Can you provide some "code" that will generate this, so I can do testing and provide options?

eliseudev commented 1 year ago

Can you provide some "code" that will generate this, so I can do testing and provide options?

using (WordDocument document = WordDocument.Create(filePath))
                {
                    document.Settings.Language = "pt-Br";

                    string title = "INSTRUMENTO PARTICULAR DE CONSTITUIÇÃO DE GARANTIA DE\r\nALIENAÇÃO FIDUCIÁRIA DE IMÓVEL\r\n";

 document.AddParagraph(title).SetBold().ParagraphAlignment = JustificationValues.Center;
document.Save();

that's just the title, I need to adjust it in every document.