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

Allow to set default font, size, and other settings for the whole document #48

Closed PrzemyslawKlys closed 1 year ago

PrzemyslawKlys commented 1 year ago

This PR will address:

        public static void Example_BasicWordWithDefaultStyleChange(string folderPath, bool openWord) {
            Console.WriteLine("[*] Creating standard document with different default style");
            string filePath = System.IO.Path.Combine(folderPath, "BasicWordWithDefaultStyleChange.docx");
            using (WordDocument document = WordDocument.Create(filePath)) {
                document.Settings.FontSize = 30;
                document.Settings.FontFamily = "Calibri Light";
                document.Settings.Language = "pl-PL";

                var paragraph1 = document.AddParagraph("To jest po polsku");

                var paragraph2 = document.AddParagraph("Adding paragraph1 with some text and pressing ENTER");
                paragraph2.FontSize = 15;
                paragraph2.FontFamily = "Courier New";

                document.Save(openWord);
            }
        }