-
-
Notifications
You must be signed in to change notification settings - Fork 47
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #48 from EvotecIT/DefaultStyleChanges
Allow to set default font, size, and other settings for the whole document
- Loading branch information
Showing
5 changed files
with
208 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
OfficeIMO.Examples/Word/BasicDocument/BasicDocument.Create03.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
using DocumentFormat.OpenXml.Wordprocessing; | ||
using OfficeIMO.Word; | ||
|
||
namespace OfficeIMO.Examples.Word { | ||
internal static partial class BasicDocument { | ||
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); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
using System; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.IO; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters