Skip to content

Commit

Permalink
Merge pull request #221 from Yaminisrisf4389/main
Browse files Browse the repository at this point in the history
ES_907669-Modify DocIO GitHub examples repository for document processing playground
  • Loading branch information
MohanaselvamJothi authored Sep 5, 2024
2 parents f92d44f + 1b87844 commit ff01896
Show file tree
Hide file tree
Showing 167 changed files with 530 additions and 78 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ static void Main(string[] args)
//Appends Email hyperlink to the paragraph.
paragraph.AppendHyperlink("mailto:sales@syncfusion.com", "Sales", HyperlinkType.EMailLink);
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Result.docx"), FileMode.Create, FileAccess.ReadWrite))
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ static void Main(string[] args)
//Appends Bookmark hyperlink to the paragraph.
paragraph.AppendHyperlink("Introduction", "Bookmark", HyperlinkType.Bookmark);
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Result.docx"), FileMode.Create, FileAccess.ReadWrite))
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@
<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>
</ItemGroup>

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

Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ static void Main(string[] args)
paragraph.AppendText("File Hyperlinks: ");
paragraph = section.AddParagraph();
//Appends hyperlink field to the paragraph.
paragraph.AppendHyperlink(@"Template.docx", "File", HyperlinkType.FileLink);
paragraph.AppendHyperlink(@"Data/Template.docx", "File", HyperlinkType.FileLink);
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Result.docx"), FileMode.Create, FileAccess.ReadWrite))
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\google.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Data\yahoo.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

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

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static void Main(string[] args)
IWParagraph paragraph = section.AddParagraph();
paragraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center;
//Adds image to the paragraph.
FileStream imageStream = new FileStream(Path.GetFullPath(@"../../../Data/Google.png"), FileMode.Open, FileAccess.ReadWrite);
FileStream imageStream = new FileStream(Path.GetFullPath(@"Data/Google.png"), FileMode.Open, FileAccess.ReadWrite);
IWPicture picture = paragraph.AppendPicture(imageStream);
//Adds Image caption.
IWParagraph lastParagragh = picture.AddCaption("Figure", CaptionNumberingFormat.Roman, CaptionPosition.AfterImage);
Expand All @@ -33,7 +33,7 @@ static void Main(string[] args)
paragraph = section.AddParagraph();
paragraph.ParagraphFormat.HorizontalAlignment = HorizontalAlignment.Center;
//Adds image to the paragraph.
imageStream = new FileStream(Path.GetFullPath(@"../../../Data/Yahoo.png"), FileMode.Open, FileAccess.ReadWrite);
imageStream = new FileStream(Path.GetFullPath(@"Data/Yahoo.png"), FileMode.Open, FileAccess.ReadWrite);
picture = paragraph.AppendPicture(imageStream);
//Adds Image caption.
lastParagragh = picture.AddCaption("Figure", CaptionNumberingFormat.Roman, CaptionPosition.AfterImage);
Expand All @@ -44,7 +44,7 @@ static void Main(string[] args)
//Updates the fields in Word document.
document.UpdateDocumentFields();
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Result.docx"), FileMode.Create, FileAccess.ReadWrite))
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Mountain-200.jpg">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

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

Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@ static void Main(string[] args)
paragraph = section.AddParagraph();
//Creates a new image instance and load image.
WPicture picture = new WPicture(document);
FileStream imageStream = new FileStream(Path.GetFullPath(@"../../../Mountain-200.jpg"), FileMode.Open, FileAccess.ReadWrite);
FileStream imageStream = new FileStream(Path.GetFullPath(@"Data/Mountain-200.jpg"), FileMode.Open, FileAccess.ReadWrite);
picture.LoadImage(imageStream);
//Appends new image hyperlink to the paragraph.
paragraph.AppendHyperlink("http://www.syncfusion.com", picture, HyperlinkType.WebLink);
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Result.docx"), FileMode.Create, FileAccess.ReadWrite))
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);
Expand Down
9 changes: 9 additions & 0 deletions Paragraphs/Add-image/.NET/Add-image/Add-image.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Image.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

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

4 changes: 2 additions & 2 deletions Paragraphs/Add-image/.NET/Add-image/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@ static void Main(string[] args)
//Adds new paragraph to the section.
IWParagraph firstParagraph = section.AddParagraph();
//Adds image to the paragraph.
FileStream imageStream = new FileStream(Path.GetFullPath(@"../../../Image.png"), FileMode.Open, FileAccess.ReadWrite);
FileStream imageStream = new FileStream(Path.GetFullPath(@"Data/Image.png"), FileMode.Open, FileAccess.ReadWrite);
IWPicture picture = firstParagraph.AppendPicture(imageStream);
//Sets height and width for the image.
picture.Height = 100;
picture.Width = 200;
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Result.docx"), FileMode.Create, FileAccess.ReadWrite))
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,13 @@
<PackageReference Include="Syncfusion.DocIORenderer.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Input.rtf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

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

Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
using Syncfusion.Pdf;
using System.Reflection.Metadata;

using (FileStream docStream = new FileStream(@"../../../Data/Input.rtf", FileMode.Open, FileAccess.Read))
using (FileStream docStream = new FileStream(@"Data/Input.rtf", FileMode.Open, FileAccess.Read))
{
//Loads file stream into Word document
using (WordDocument wordDocument = new WordDocument(docStream, Syncfusion.DocIO.FormatType.Automatic))
Expand All @@ -17,7 +17,7 @@
render.Dispose();
wordDocument.Dispose();
//Saves the PDF file
using (FileStream outputStream = new FileStream(@"../../../Data/Output.pdf", FileMode.Create, FileAccess.Write))
using (FileStream outputStream = new FileStream(@"Data/Output.pdf", FileMode.Create, FileAccess.Write))
{
pdfDocument.Save(outputStream);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<None Update="Data\Input.rtf">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="Output\.gitkeep">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>

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

Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class Program
static void Main(string[] args)
{
//Loads an existing Word document into DocIO instance.
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"../../../Input.rtf"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Input.rtf"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Rtf))
{
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../RtfToWord.docx"), FileMode.Create, FileAccess.ReadWrite))
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/RtfToWord.docx"), FileMode.Create, FileAccess.ReadWrite))
{
//Saves the Word document to file stream.
document.Save(outputFileStream, FormatType.Docx);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,13 @@
<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>
</ItemGroup>

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

Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ class Program
static void Main(string[] args)
{
//Loads an existing Word document into DocIO instance.
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"../../../Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Docx))
{
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../WordToRtf.rtf"), FileMode.Create, FileAccess.ReadWrite))
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"Output/WordToRtf.rtf"), FileMode.Create, FileAccess.ReadWrite))
{
//Saves the Word document to file stream.
document.Save(outputFileStream, FormatType.Rtf);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

<ItemGroup>
<Compile Update="Program.cs">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Compile>
</ItemGroup>

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static void Main(string[] args)
//Opens the template document from the MemoryStream.
document.Open(ms, FormatType.Doc);
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Result.docx"), FileMode.Create, FileAccess.ReadWrite))
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

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

</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ class Program
static void Main(string[] args)
{
//Open the file as a stream.
using (FileStream inputFileStream = new FileStream(Path.GetFullPath(@"../../../Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (FileStream inputFileStream = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
//Load the file stream into a Word document.
using (WordDocument document = new WordDocument(inputFileStream, FormatType.Automatic))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,16 @@
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class Program
{
static void Main(string[] args)
{
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"../../../Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
using (FileStream fileStreamPath = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
{
//Opens the Word document.
using (WordDocument document = new WordDocument(fileStreamPath, FormatType.Automatic))
Expand All @@ -28,7 +28,7 @@ static void Main(string[] args)
sec.HeadersFooters.Footer.Paragraphs.Add(footerParagraph);
}
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Result.docx"), FileMode.Create, FileAccess.ReadWrite))
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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,10 @@
<PackageReference Include="Syncfusion.DocIO.Net.Core" Version="*" />
</ItemGroup>

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

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

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ static void Main(string[] args)
//Appends the text to the created paragraph.
paragraph.AppendText(paraText);
//Creates file stream.
using (FileStream outputFileStream = new FileStream(Path.GetFullPath(@"../../../Result.docx"), FileMode.Create, FileAccess.ReadWrite))
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);
Expand Down
Loading

0 comments on commit ff01896

Please sign in to comment.