Skip to content

Commit

Permalink
Update examples
Browse files Browse the repository at this point in the history
  • Loading branch information
PrzemyslawKlys committed Jun 11, 2022
1 parent e5fd44c commit 1586a3c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 11 deletions.
4 changes: 2 additions & 2 deletions OfficeIMO.Examples/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ static void Main(string[] args) {
string folderPath = System.IO.Path.Combine(System.IO.Directory.GetCurrentDirectory(), "Documents");
Setup(folderPath);

BasicDocument.Example_BasicEmptyWord(folderPath, true);
BasicDocument.Example_BasicWord(folderPath, true);
BasicDocument.Example_BasicEmptyWord(folderPath, false);
BasicDocument.Example_BasicWord(folderPath, false);
BasicDocument.Example_BasicWord2(folderPath, true);

//BasicDocument.Example_BasicDocument(folderPath, true);
Expand Down
12 changes: 3 additions & 9 deletions OfficeIMO.Examples/Word/BasicDocument/BasicDocument.Example1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DocumentFormat.OpenXml.Wordprocessing;
using OfficeIMO.Word;

namespace OfficeIMO.Examples.Word {
Expand All @@ -17,37 +18,30 @@ public static void Example_BasicWord2(string folderPath, bool openWord) {

var section1 = document.AddSection();
section1.AddParagraph("Test Middle Section - 1");
//section1 = document.Sections[1];
// document.AddParagraph("Test 0");

var section2 = document.AddSection();
section2.AddParagraph("Test Last Section - 1");
section1.AddParagraph("Test Middle Section - 2").AddComment("Adam Kłys", "AK", "Another test");
var test = document.AddParagraph("Test 1 - to delete");
test.Remove();

section1.PageSettings.PageSize = WordPageSize.A5;
section2.PageOrientation = PageOrientationValues.Landscape;

document.Sections[2].AddParagraph("Test 0 - Section Last");
document.Sections[1].AddParagraph("Test 1").AddComment("Przemysław Kłys", "PK", " This is just a test");
//document.Sections[1].AddParagraph("Test 2");

// section2.AddParagraph("Test 1");
Console.WriteLine("----");
Console.WriteLine("Sections: " + document.Sections.Count);
Console.WriteLine("----");
Console.WriteLine(document.Sections[0].Paragraphs.Count);
Console.WriteLine(document.Sections[1].Paragraphs.Count);
Console.WriteLine(document.Sections[2].Paragraphs.Count);


Console.WriteLine(document.Comments.Count);

document.Comments[0].Text = "Lets change it";


document.Save(false);
}
filePath = @"C:\Support\GitHub\OfficeIMO\OfficeIMO.Examples\bin\Debug\net5.0\Documents\200procent1.docx";

using (WordDocument document = WordDocument.Load(filePath)) {
Console.WriteLine("----");
Expand Down

0 comments on commit 1586a3c

Please sign in to comment.