Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve settings for document with PT-BR and HighAnsi chars #56

Merged
merged 3 commits into from
Oct 30, 2022

Conversation

PrzemyslawKlys
Copy link
Member

@PrzemyslawKlys PrzemyslawKlys commented Oct 28, 2022

Fixes:

Adds:

  • FontFamilyHighAnsi for document.Settings which is required for special chars
public static void Example_BasicWordWithDefaultFontChange(string folderPath, bool openWord) {
    Console.WriteLine("[*] Creating standard document with different default style (PT/BR)");
    string filePath = System.IO.Path.Combine(folderPath, "BasicWordWithDefaultStyleChangeBR.docx");
    using (WordDocument document = WordDocument.Create(filePath)) {
        document.Settings.FontSize = 30;
        //document.Settings.FontSizeComplexScript = 30;
        document.Settings.FontFamily = "Calibri Light";
        document.Settings.FontFamilyHighAnsi = "Calibri Light";
        document.Settings.Language = "pt-Br";

        string title = "INSTRUMENTO PARTICULAR DE CONSTITUIÇÃO DE GARANTIA DE ALIENAÇÃO FIDUCIÁRIA DE IMÓVEL";

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

        document.Save(openWord);
    }
}

More information: http://officeopenxml.com/WPtextFonts.php

@PrzemyslawKlys PrzemyslawKlys changed the title Improve example showing PT-BR and HighAnsi Improve settings for document with PT-BR and HighAnsi chars Oct 28, 2022
@PrzemyslawKlys PrzemyslawKlys merged commit 2f98305 into master Oct 30, 2022
@PrzemyslawKlys PrzemyslawKlys deleted the WordSettingsImprovement branch October 30, 2022 22:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant