-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug in Nested CollectionSeparatorBlock
- Loading branch information
Showing
4 changed files
with
54 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
namespace DocxTemplater.Test | ||
{ | ||
internal class CollectionInTableTest | ||
{ | ||
[Test] | ||
public void CollectionInTableTestRender() | ||
{ | ||
|
||
using var fileStream = File.OpenRead("Resources/CollectionInTableCell.docx"); | ||
var docTemplate = new DocxTemplate(fileStream); | ||
var data = new MyLessonsReportModel(); | ||
var lesson1 = new LessonReportModel | ||
{ | ||
Date = DateTime.Now, | ||
CourseDisplayName = "Course 1", | ||
ParticipantsCount = 10, | ||
Resources = new List<string> { "Resource 1", "Resource 2" } | ||
}; | ||
var lesson2 = new LessonReportModel | ||
{ | ||
Date = DateTime.Now.AddDays(1), | ||
CourseDisplayName = "Course 2", | ||
ParticipantsCount = 20, | ||
Resources = new List<string> { "Resource 3", "Resource 4" } | ||
}; | ||
data.Lessons = new List<LessonReportModel> { lesson1 }; | ||
docTemplate.BindModel("ds", data); | ||
var result = docTemplate.Process(); | ||
docTemplate.Validate(); | ||
result.SaveAsFileAndOpenInWord(); | ||
} | ||
|
||
public class MyLessonsReportModel | ||
{ | ||
public IReadOnlyCollection<LessonReportModel> Lessons { get; set; } = new List<LessonReportModel>(); | ||
} | ||
|
||
public class LessonReportModel | ||
{ | ||
public DateTime Date { get; set; } | ||
|
||
public string CourseDisplayName { get; set; } | ||
|
||
public ICollection<string> Resources { get; set; } = new List<string>(); | ||
|
||
public int ParticipantsCount { get; set; } | ||
} | ||
} | ||
} |
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
Binary file not shown.
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