Skip to content

Commit 54eb831

Browse files
Add sample for set fill pattern
1 parent 1ffe70f commit 54eb831

File tree

5 files changed

+78
-0
lines changed

5 files changed

+78
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.12.35417.141 d17.12
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Set-fill-pattern", "Set-fill-pattern\Set-fill-pattern.csproj", "{F22DD422-C9C8-4420-B8DD-F89A96BABBEF}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{F22DD422-C9C8-4420-B8DD-F89A96BABBEF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{F22DD422-C9C8-4420-B8DD-F89A96BABBEF}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{F22DD422-C9C8-4420-B8DD-F89A96BABBEF}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{F22DD422-C9C8-4420-B8DD-F89A96BABBEF}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
EndGlobal
Binary file not shown.
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
using Syncfusion.DocIO;
2+
using Syncfusion.DocIO.DLS;
3+
using Syncfusion.OfficeChart;
4+
5+
using (FileStream fileStreamPath = new FileStream(@"Data/Template.docx", FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
6+
{
7+
//Open the template Word document
8+
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
9+
{
10+
//Gets the last paragraph
11+
WParagraph paragraph = document.LastParagraph;
12+
//Gets the chart entity from the paragraph items
13+
WChart chart = paragraph.ChildEntities[0] as WChart;
14+
15+
// Set the fill pattern for the series in the chart.
16+
chart.Series[0].SerieFormat.Fill.Pattern = OfficeGradientPattern.Pat_Diagonal_Brick;
17+
chart.Series[1].SerieFormat.Fill.Pattern = OfficeGradientPattern.Pat_Dashed_Vertical;
18+
chart.Series[2].SerieFormat.Fill.Pattern = OfficeGradientPattern.Pat_Sphere;
19+
20+
using (FileStream stream = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.Write))
21+
{
22+
//Save the Word document.
23+
document.Save(stream, FormatType.Docx);
24+
}
25+
}
26+
27+
}
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<OutputType>Exe</OutputType>
5+
<TargetFramework>net8.0</TargetFramework>
6+
<RootNamespace>Set_fill_pattern</RootNamespace>
7+
<ImplicitUsings>enable</ImplicitUsings>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
11+
<ItemGroup>
12+
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
13+
</ItemGroup>
14+
15+
<ItemGroup>
16+
<Folder Include="Data\" />
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<None Update="Data\Template.docx">
21+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
22+
</None>
23+
<None Update="Output\.gitkeep">
24+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
25+
</None>
26+
</ItemGroup>
27+
28+
</Project>

0 commit comments

Comments
 (0)