From d2b748014eb337a11ebb5b47d509894380e7bbd7 Mon Sep 17 00:00:00 2001 From: DharanyaSakthivel-SF4210 Date: Wed, 14 Aug 2024 18:26:08 +0530 Subject: [PATCH 1/3] Replace-field-with-table --- .../.NET/Replace-field-with-table.sln | 25 ++++ .../Data/InputDocument.docx | Bin 0 -> 16249 bytes .../.NET/Replace-field-with-table/Program.cs | 119 ++++++++++++++++++ .../Replace-field-with-table.csproj | 15 +++ 4 files changed, 159 insertions(+) create mode 100644 Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table.sln create mode 100644 Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Data/InputDocument.docx create mode 100644 Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Program.cs create mode 100644 Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj diff --git a/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table.sln b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table.sln new file mode 100644 index 000000000..537b63293 --- /dev/null +++ b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.9.34622.214 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Replace-field-with-table", "Replace-field-with-table\Replace-field-with-table.csproj", "{AD2A243A-F1F9-410E-BE4E-592839D52919}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {AD2A243A-F1F9-410E-BE4E-592839D52919}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {AD2A243A-F1F9-410E-BE4E-592839D52919}.Debug|Any CPU.Build.0 = Debug|Any CPU + {AD2A243A-F1F9-410E-BE4E-592839D52919}.Release|Any CPU.ActiveCfg = Release|Any CPU + {AD2A243A-F1F9-410E-BE4E-592839D52919}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {5A0B4C55-E8AA-4F27-BB36-8B562758FB60} + EndGlobalSection +EndGlobal diff --git a/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Data/InputDocument.docx b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Data/InputDocument.docx new file mode 100644 index 0000000000000000000000000000000000000000..69fb84c24839ad63e785db0769d3911bc4220f43 GIT binary patch literal 16249 zcmeHub97|e)^EkOZFcOWW257wW81cE+qP|V%#Pi$I#$PeIp^Y>d+vGTjraHW?HaYJ z_MYoESJmEgtu-kp1psXq&NrT3Ono^)bXE z-%e!M5Ey0iwPfk+!urAn#6Z&2A3v!GEt^@88Gxqx0Enheiup>)HH3vA=pBJ|`K*26 zCv}0`npmP}5n1@satc-yD)S!8vuGxYovUvU>} z>6x#U)7DcyiT$*vsKiwC2(#)gg1W1iz2hh>-RoDe$WYZlwGQXPs^5Oyn4|Vgd={V{ z%L*;?8#icN%t8!X1h8zrt>9{8D8|imM)ML@B|XH{-Fp;#J!G-YY+{Tk1mu7ISV<$FMcW~ghf^0kGrTbKG=G-*Kg++654G)NN9+B=~y!P){ z-q6N;bt%lWu`zuc^;!c;#|f=WQRY;)G}x95^kkWF`jybwmz^`m?gc$1gJD55Pc z^v|Bgn#k&Jhv5fUd~6p)YK=PEHaMAD0yiI<)PK*9F-DlzCMW=4gc|@r`nV}BHui?} zhBgLHRv&xVZ=2Vt#<=}%E82Pq^}FvZanhF+bgD3Sqf;uL&)SYHbLSE^^?v-~11u7? z0J-}5be~kdiIhF<%e<5Y>G8Y55_NTPQUP2|z+turkOJS^FT^0j(Ij-H?&>xbnW)QD z37vt6lhrALl9YAqncyK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ZoAaxg#pm(XeqfF<|TV^UGZ{k+})G8|SBM z*eXZKHRFVfii`%Q>_O5>Ry$OQebVzIx% z|1= 0; i--) + { + clonedParagraph.ChildEntities.RemoveAt(i); + } + + // Remove all entities from the SEQ field index onward in the original paragraph. + for (int j = paragraph.ChildEntities.Count - 1; j >= seqfieldIndex; j--) + { + paragraph.ChildEntities.RemoveAt(j); + } + + // Generate a sample table. + IWTable table = GetTable(); + + // Clone the generated table. + IWTable table1 = table.Clone() as IWTable; + + // Insert the cloned table after the paragraph containing the SEQ field. + paragraph.OwnerTextBody.ChildEntities.Insert(paraindex + 1, table1); + + // Insert the modified cloned paragraph after the inserted table. + paragraph.OwnerTextBody.ChildEntities.Insert(paraindex + 2, clonedParagraph); + + // Save the modified document to a new file. + using (FileStream docStream1 = new FileStream(Path.GetFullPath(@"../../../Data/ResultDocument.docx"), FileMode.Create, FileAccess.Write)) + { + document.Save(docStream1, FormatType.Docx); + } + } + } + } + + // Method to generate a sample table. + static IWTable GetTable() + { + // Creates a new Word document. + WordDocument document = new WordDocument(); + + // Adds a section into the Word document. + IWSection section = document.AddSection(); + + // Adds a paragraph with the text "Price Details" in bold and Arial font. + IWTextRange textRange = section.AddParagraph().AppendText("Price Details"); + textRange.CharacterFormat.FontName = "Arial"; + textRange.CharacterFormat.FontSize = 12; + textRange.CharacterFormat.Bold = true; + + // Adds an empty paragraph (for spacing). + section.AddParagraph(); + + // Adds a new table with 3 rows and 2 columns. + IWTable table = section.AddTable(); + table.ResetCells(3, 2); + + // Adds the column headers to the first row. + textRange = table[0, 0].AddParagraph().AppendText("Item"); + textRange.CharacterFormat.FontName = "Arial"; + textRange.CharacterFormat.FontSize = 12; + textRange.CharacterFormat.Bold = true; + + textRange = table[0, 1].AddParagraph().AppendText("Price($)"); + textRange.CharacterFormat.FontName = "Arial"; + textRange.CharacterFormat.FontSize = 12; + textRange.CharacterFormat.Bold = true; + + // Adds the first item and its price to the second row. + textRange = table[1, 0].AddParagraph().AppendText("Cycle 1"); + textRange.CharacterFormat.FontName = "Arial"; + textRange.CharacterFormat.FontSize = 10; + + textRange = table[1, 1].AddParagraph().AppendText("500"); + textRange.CharacterFormat.FontName = "Arial"; + textRange.CharacterFormat.FontSize = 10; + + // Adds the second item and its price to the third row. + textRange = table[2, 0].AddParagraph().AppendText("Cycle 2"); + textRange.CharacterFormat.FontName = "Arial"; + textRange.CharacterFormat.FontSize = 10; + + textRange = table[2, 1].AddParagraph().AppendText("300"); + textRange.CharacterFormat.FontName = "Arial"; + textRange.CharacterFormat.FontSize = 10; + + // Returns the generated table. + return table; + } + } +} diff --git a/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj new file mode 100644 index 000000000..a0f35b05b --- /dev/null +++ b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj @@ -0,0 +1,15 @@ + + + + Exe + net8.0 + Replace_field_with_table + enable + enable + + + + + + + From a480185fb488095cef8087bebe95bfac70787dc1 Mon Sep 17 00:00:00 2001 From: DharanyaSakthivel-SF4210 Date: Tue, 22 Oct 2024 19:04:02 +0530 Subject: [PATCH 2/3] Replace-field-with-table --- .../Replace-field-with-table/Replace-field-with-table.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj index a0f35b05b..f201506ee 100644 --- a/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj +++ b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj @@ -9,7 +9,7 @@ - + From 76be3fabbf15d4941043e46467a2e35f1473afce Mon Sep 17 00:00:00 2001 From: DharanyaSakthivel-SF4210 Date: Tue, 11 Feb 2025 22:13:12 +0530 Subject: [PATCH 3/3] Replace-field-with-table --- .../Replace-field-with-table/Output/.gitkeep | 1 + .../.NET/Replace-field-with-table/Program.cs | 80 +++---------------- .../Replace-field-with-table.csproj | 9 +++ 3 files changed, 22 insertions(+), 68 deletions(-) create mode 100644 Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Output/.gitkeep diff --git a/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Output/.gitkeep b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Program.cs b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Program.cs index 7422c973b..e40ba1954 100644 --- a/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Program.cs +++ b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Program.cs @@ -8,112 +8,56 @@ internal class Program static void Main(string[] args) { // Open the existing Word document using a FileStream. - using (FileStream docStream = new FileStream(Path.GetFullPath(@"../../../Data/InputDocument.docx"), FileMode.Open, FileAccess.Read)) + using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data/InputDocument.docx"), FileMode.Open, FileAccess.Read)) { // Load the existing Word document. using (WordDocument document = new WordDocument(docStream, FormatType.Docx)) { // Find the first sequence field (SEQ field) in the document. WSeqField seqField = document.FindItemByProperty(EntityType.SeqField, "", "") as WSeqField; - // Get the paragraph that contains the SEQ field. WParagraph paragraph = seqField.OwnerParagraph; - // Get the index of the paragraph within the text body. int paraindex = paragraph.OwnerTextBody.ChildEntities.IndexOf(paragraph); - // Get the index of the SEQ field within the paragraph. int seqfieldIndex = paragraph.ChildEntities.IndexOf(seqField); - // Clone the paragraph that contains the SEQ field. WParagraph clonedParagraph = seqField.OwnerParagraph.Clone() as WParagraph; - // Remove all entities before the SEQ field index in the cloned paragraph. for (int i = seqfieldIndex; i >= 0; i--) { clonedParagraph.ChildEntities.RemoveAt(i); } - // Remove all entities from the SEQ field index onward in the original paragraph. for (int j = paragraph.ChildEntities.Count - 1; j >= seqfieldIndex; j--) { paragraph.ChildEntities.RemoveAt(j); } - // Generate a sample table. - IWTable table = GetTable(); + //Create a new table + IWTable table = new WTable(document); + table.ResetCells(3, 2); + table.Rows[0].Cells[0].AddParagraph().AppendText("Sno"); + table.Rows[0].Cells[1].AddParagraph().AppendText("Product"); + table.Rows[0].IsHeader = true; + table.Rows[1].Cells[0].AddParagraph().AppendText("1."); + table.Rows[1].Cells[1].AddParagraph().AppendText("Essential DocIO"); + table.Rows[2].Cells[0].AddParagraph().AppendText("2."); + table.Rows[2].Cells[1].AddParagraph().AppendText("Essential Pdf"); // Clone the generated table. IWTable table1 = table.Clone() as IWTable; - // Insert the cloned table after the paragraph containing the SEQ field. paragraph.OwnerTextBody.ChildEntities.Insert(paraindex + 1, table1); - // Insert the modified cloned paragraph after the inserted table. paragraph.OwnerTextBody.ChildEntities.Insert(paraindex + 2, clonedParagraph); - // Save the modified document to a new file. - using (FileStream docStream1 = new FileStream(Path.GetFullPath(@"../../../Data/ResultDocument.docx"), FileMode.Create, FileAccess.Write)) + using (FileStream docStream1 = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.Write)) { document.Save(docStream1, FormatType.Docx); } } } } - - // Method to generate a sample table. - static IWTable GetTable() - { - // Creates a new Word document. - WordDocument document = new WordDocument(); - - // Adds a section into the Word document. - IWSection section = document.AddSection(); - - // Adds a paragraph with the text "Price Details" in bold and Arial font. - IWTextRange textRange = section.AddParagraph().AppendText("Price Details"); - textRange.CharacterFormat.FontName = "Arial"; - textRange.CharacterFormat.FontSize = 12; - textRange.CharacterFormat.Bold = true; - - // Adds an empty paragraph (for spacing). - section.AddParagraph(); - - // Adds a new table with 3 rows and 2 columns. - IWTable table = section.AddTable(); - table.ResetCells(3, 2); - - // Adds the column headers to the first row. - textRange = table[0, 0].AddParagraph().AppendText("Item"); - textRange.CharacterFormat.FontName = "Arial"; - textRange.CharacterFormat.FontSize = 12; - textRange.CharacterFormat.Bold = true; - - textRange = table[0, 1].AddParagraph().AppendText("Price($)"); - textRange.CharacterFormat.FontName = "Arial"; - textRange.CharacterFormat.FontSize = 12; - textRange.CharacterFormat.Bold = true; - - // Adds the first item and its price to the second row. - textRange = table[1, 0].AddParagraph().AppendText("Cycle 1"); - textRange.CharacterFormat.FontName = "Arial"; - textRange.CharacterFormat.FontSize = 10; - - textRange = table[1, 1].AddParagraph().AppendText("500"); - textRange.CharacterFormat.FontName = "Arial"; - textRange.CharacterFormat.FontSize = 10; - - // Adds the second item and its price to the third row. - textRange = table[2, 0].AddParagraph().AppendText("Cycle 2"); - textRange.CharacterFormat.FontName = "Arial"; - textRange.CharacterFormat.FontSize = 10; - - textRange = table[2, 1].AddParagraph().AppendText("300"); - textRange.CharacterFormat.FontName = "Arial"; - textRange.CharacterFormat.FontSize = 10; - - // Returns the generated table. - return table; - } } } diff --git a/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj index f201506ee..08f1890e8 100644 --- a/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj +++ b/Find-and-Replace/Replace-field-with-table/.NET/Replace-field-with-table/Replace-field-with-table.csproj @@ -12,4 +12,13 @@ + + + Always + + + Always + + +