Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Create-ink-with-multipletraces/Create-ink-with-multipletraces.csproj" />
</Solution>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Create_ink_with_multipletraces</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\Result.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Drawing;
using Syncfusion.Office;

namespace Create_ink_with_multipletraces
{
class Program
{
static void Main(string[] args)
{
//Creates a new Word document.
using (WordDocument document = new WordDocument())
{
//Adds new section to the document.
IWSection section = document.AddSection();
//Adds new paragraph to the section.
WParagraph paragraph = section.AddParagraph() as WParagraph;
//Adds new ink to the document.
WInk ink = paragraph.AppendInk(450, 350);
// Sets the horizontal position of the ink object.
ink.HorizontalPosition = 30;
// Sets the Vertical position of the ink object.
ink.VerticalPosition = 50;
// Sets the text wrapping style for the ink object to be in front of text.
ink.WrapFormat.TextWrappingStyle = TextWrappingStyle.InFrontOfText;
// Gets the ink traces collection from the ink object.
IOfficeInkTraces traces = ink.Traces;
// Gets all trace point arrays from the helper method.
List<PointF[]> pointsCollection = GetPoints();
// Adds each trace to the ink object.
foreach (var points in pointsCollection)
{
// Adds the trace to the ink object.
IOfficeInkTrace trace = traces.Add(points);
// Sets the brush color for the trace to red.
trace.Brush.Color = Color.Red;
// Sets the brush size for the ink stroke.
trace.Brush.Size = new SizeF(5f, 5f);
}
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
{
//Saves the Word document to file stream.
document.Save(outputFileStream, FormatType.Docx);
}
}
}
/// <summary>
/// A collection where each <see cref="PointF"/> array represents a single stroke.
/// </summary>
static List<PointF[]> GetPoints()
{
return new List<PointF[]>
{
//Trace_i
new PointF[] {
new PointF(20f, 10f),
new PointF(20f, 140f),
},
//Trace_n
new PointF[]
{
new PointF(60f, 80f),
new PointF(60f, 100f),
new PointF(60f, 140f),
new PointF(60f, 92f),
new PointF(70f, 86f),
new PointF(88f, 84f),
new PointF(100f, 92f),
new PointF(106f, 108f),
new PointF(110f, 140f)
},
//Trace_k
new PointF[] {
new PointF(140f, 10f),
new PointF(140f, 140f),
new PointF(140f, 80f),
new PointF(180f, 20f),
new PointF(140f, 80f),
new PointF(180f, 140f)
}
};
}
}
}

3 changes: 3 additions & 0 deletions Paragraphs/Create-ink/.NET/Create-ink.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Create-ink/Create-ink.csproj" />
</Solution>
24 changes: 24 additions & 0 deletions Paragraphs/Create-ink/.NET/Create-ink/Create-ink.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Create_ink</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\Result.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
1 change: 1 addition & 0 deletions Paragraphs/Create-ink/.NET/Create-ink/Output/.gitkeep
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file not shown.
46 changes: 46 additions & 0 deletions Paragraphs/Create-ink/.NET/Create-ink/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Drawing;
using Syncfusion.Office;

namespace Create_ink
{
class Program
{
static void Main(string[] args)
{
//Creates a new Word document.
using (WordDocument document = new WordDocument())
{
//Adds new section to the document.
IWSection section = document.AddSection();
//Adds new paragraph to the section.
WParagraph paragraph = section.AddParagraph() as WParagraph;
//Adds new text to the paragraph
IWTextRange firstText = paragraph.AppendText("Created a triangle using Ink");
//Apply formatting for first text range
firstText.CharacterFormat.FontSize = 14;
firstText.CharacterFormat.Bold = true;
//Adds new ink to the document.
WInk ink = paragraph.AppendInk(400, 300);
// Gets the ink traces collection from the ink object.
IOfficeInkTraces traces = ink.Traces;
// Adds new ink stroke with required trace points
PointF[] triangle = new PointF[] { new PointF(0f, 300f), new PointF(200f, 0f), new PointF(400f, 300f), new PointF(0f, 300f) };
// Adds a new ink trace to the ink object using the triangle points.
IOfficeInkTrace trace = traces.Add(triangle);
// Modify the brush effects and size
IOfficeInkBrush brush = trace.Brush;
// Sets the brush size for the ink stroke.
brush.Size = new SizeF(5f, 5f);
// Sets the ink effect to 'Galaxy'.
brush.InkEffect = OfficeInkEffectType.Galaxy;
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
{
//Saves the Word document to file stream.
document.Save(outputFileStream, FormatType.Docx);
}
}
}
}
}
3 changes: 3 additions & 0 deletions Paragraphs/Modify-ink-color/.NET/Modify_ink_color.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Modify_ink_color/Modify_ink_color.csproj" />
</Solution>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Template.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\Result.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file not shown.
34 changes: 34 additions & 0 deletions Paragraphs/Modify-ink-color/.NET/Modify_ink_color/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Drawing;
using Syncfusion.Office;

namespace Modify_ink_color
{
class Program
{
static void Main(string[] args)
{
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
//Creates a new Word document.
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
{
// Gets the first section of the document.
WSection section = document.Sections[0];
// Access the ink and customize its color.
WInk ink = section.Paragraphs[0].ChildEntities[0] as WInk;
// Gets the ink trace from the ink object.
IOfficeInkTrace inkTrace = ink.Traces[0];
// Modify the brush color to Color.Red.
inkTrace.Brush.Color = Color.Red;
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
{
//Saves the Word document to file stream.
document.Save(outputFileStream, FormatType.Docx);
}
}
}
}
}
}
3 changes: 3 additions & 0 deletions Paragraphs/Modify-ink-effect/.NET/Modify-ink-effect.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Modify-ink-effect/Modify-ink-effect.csproj" />
</Solution>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Modify_ink_effect</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Template.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\Result.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file not shown.
34 changes: 34 additions & 0 deletions Paragraphs/Modify-ink-effect/.NET/Modify-ink-effect/Program.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
using Syncfusion.DocIO;
using Syncfusion.DocIO.DLS;
using Syncfusion.Office;

namespace Modify_ink_effect
{
class Program
{
static void Main(string[] args)
{
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
//Creates a new Word document.
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
{
// Gets the first section of the document.
WSection section = document.Sections[0];
// Access the ink and customize its effect.
WInk ink = section.Paragraphs[1].ChildEntities[0] as WInk;
// Gets the ink trace from the ink object.
IOfficeInkTrace inkTrace = ink.Traces[0];
// Modify the ink effect to 'Lava'.
inkTrace.Brush.InkEffect = OfficeInkEffectType.Lava;
// Creates a file stream to save the modified document.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Output/Result.docx"), FileMode.Create, FileAccess.ReadWrite))
{
//Saves the Word document to file stream.
document.Save(outputFileStream, FormatType.Docx);
}
}
}
}
}
}
3 changes: 3 additions & 0 deletions Paragraphs/Modify-ink-points/.NET/Modify-ink-Points.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Solution>
<Project Path="Modify-ink-Points/Modify-ink-Points.csproj" />
</Solution>
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<RootNamespace>Modify_ink_Points</RootNamespace>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Template.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\Result.docx">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Binary file not shown.
Loading
Loading