-
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.
Merge pull request #22 from Amberg/workitems/FixInCollectionSeperator…
…Block fix in collection separator block
- Loading branch information
Showing
7 changed files
with
73 additions
and
26 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 |
---|---|---|
@@ -1,15 +1,15 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\DocxTemplater\DocxTemplater.csproj" /> | ||
</ItemGroup> | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
<PropertyGroup> | ||
<GeneratePackageOnBuild>True</GeneratePackageOnBuild> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="GitVersion.MsBuild" Version="5.12.0"> | ||
<PrivateAssets>all</PrivateAssets> | ||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> | ||
</PackageReference> | ||
<PackageReference Include="SixLabors.ImageSharp" Version="3.1.5" /> | ||
</ItemGroup> | ||
<ItemGroup> | ||
<ProjectReference Include="..\DocxTemplater\DocxTemplater.csproj" /> | ||
</ItemGroup> | ||
</Project> |
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
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