From 590cf96ea0b6e4628b2656ae1d14f11156e8288a Mon Sep 17 00:00:00 2001 From: DharanyaSakthivel-SF4210 Date: Wed, 19 Mar 2025 15:19:37 +0530 Subject: [PATCH 1/3] ES-876611-Replace-list-restart-numbering-HTML-with-text --- ...-list-restart-numbering-HTML-with-text.sln | 25 +++++++++ .../Data/Template.docx | Bin 0 -> 13482 bytes .../Data/sample.html | 21 ++++++++ .../Output/.gitkeep | 1 + .../Program.cs | 49 ++++++++++++++++++ ...st-restart-numbering-HTML-with-text.csproj | 27 ++++++++++ 6 files changed, 123 insertions(+) create mode 100644 Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text.sln create mode 100644 Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/Template.docx create mode 100644 Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/sample.html create mode 100644 Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Output/.gitkeep create mode 100644 Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs create mode 100644 Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Replace-list-restart-numbering-HTML-with-text.csproj diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text.sln b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text.sln new file mode 100644 index 000000000..3dc72b15d --- /dev/null +++ b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.11.35327.3 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Replace-list-restart-numbering-HTML-with-text", "Replace-list-restart-numbering-HTML-with-text\Replace-list-restart-numbering-HTML-with-text.csproj", "{EA22BFD7-89F9-4F72-BECC-743931FBDFA6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EA22BFD7-89F9-4F72-BECC-743931FBDFA6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {EA22BFD7-89F9-4F72-BECC-743931FBDFA6}.Debug|Any CPU.Build.0 = Debug|Any CPU + {EA22BFD7-89F9-4F72-BECC-743931FBDFA6}.Release|Any CPU.ActiveCfg = Release|Any CPU + {EA22BFD7-89F9-4F72-BECC-743931FBDFA6}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {ADDC6FEE-8718-4B00-B091-6C4DC0CBF62A} + EndGlobalSection +EndGlobal diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/Template.docx b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/Template.docx new file mode 100644 index 0000000000000000000000000000000000000000..af20da1a9b12b58985e56e19fa45a78def72a350 GIT binary patch literal 13482 zcmeHuWmFw$*6zVANN@=d+}#d@V8PvkySqzpcXtWy8r2KY2 z@854~t@Ey`+V$)@Rkf|&{gkW(1SC2D8UPCb0Ehq^dD9kZU;w~-C;$Kr01K}E$=b@n z(8@tu(bdM#UX$L%(&Bv%BsgUj033Auf0zHocc3}I zCy`G65C+=~T=_Y6p!KC44O~tME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BHuiOG<_Hrh6Y~ewfFg=66MlkvW-qtR-7=)eB^XT zcuYefAj`Ur1!X7I41&8a0l#l=D$h+oRJv93$Jc?7*BGT)@Vnq!k?CPFB>{p+YF6+p z&7uJPIk^ov8h3;rsKJQz7P?ZHOc~q))k}`6)WsA*=BrdoVnkn=JuAO;!et(gl_;zO zv&Zv(yspB~N@!i{K4N*eT(WbQ3p|%2BNu5*klz{eto~dNN@VGT;YFUx^;Vnid2I^L z4ET=nyeV}(Ls`NAjNS4NAA;0O(cvc82}WG?G8P~xLN}+O2Ufu&`4{sM@;sOA7)x(9 z8a&+W1E-+A{rua8KJt~|wI3)9T!Ad@EreHCiGvy}o<$jj)}fI1}aA zI_6hCczCGztf?sz)G3xQ9f>>RPoE$76XEe7ymAV^^LcTyc{^ GM0^K9D@#UN;_9 z;8L%hiUWq^sZbSF_!6h>4@eqb7kxWlTtwYzX>H0Z>ZhZxHkB>!@a?#)u-g3!D#{$% zUE^IPebJP0t|t~tMPM@M8+#~TD>C7CEaTSpSMAo$b^4r>OCiv|USZ9#s{xB{oee(Y zGvyuH&OQ6Thv>-3(>^G^R%bm`e`jnK^SIEBo-kB>8kxu6prvj`u#1nkYkeUg6Z*^bGa*RJ#hIm{#Z;*+d z!g-~93wW9K&d`0Pc*&J$sC(BT z-D%bvzp7~PWmD(f7J1h$MWa+H=lUOO8mQmf2W}T2?YS+K*il(239SLKxc-Bw`z!q4 zNrHcZ0RU6@f5QI<%HXe>ekG3msVfuIL;qVE*{>>oZMy%dq5$oWzSm!h*I(hkHp>2l zGhzP$|5w}WSMaaZ@}FQ+%721?shxk-@M}5urv`ZHe`@%*;_g@czbEQH(ExxAEdcNz qY5Q0Bzemfz!l^;!=fB|pjGeL)P$2X8?Q;hNKo=;!&M^J9^?v|<`9O34 literal 0 HcmV?d00001 diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/sample.html b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/sample.html new file mode 100644 index 000000000..30766c18b --- /dev/null +++ b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/sample.html @@ -0,0 +1,21 @@ +

+
+

+
    +
  1. +

    +Mountain 200 +

    +
  2. +
  3. +

    + +Mountain 300 +
    +
    +

    +
  4. +
+

+
+

diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Output/.gitkeep b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Output/.gitkeep new file mode 100644 index 000000000..5f282702b --- /dev/null +++ b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Output/.gitkeep @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs new file mode 100644 index 000000000..4f4acbbce --- /dev/null +++ b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs @@ -0,0 +1,49 @@ +using Syncfusion.DocIO; +using Syncfusion.DocIO.DLS; + +namespace Replace_list_restart_numbering_HTML_with_text +{ + internal class Program + { + static void Main(string[] args) + { + // Load the input Word document from file stream + using (FileStream docStream = new FileStream(Path.GetFullPath(@"Data/Template.docx"), FileMode.Open, FileAccess.Read)) + { + // Open the Word document + using (WordDocument document = new WordDocument(docStream, FormatType.Docx)) + { + // Load the input Word document from file stream + using (FileStream htmlStream = new FileStream(Path.GetFullPath(@"Data/sample.html"), FileMode.Open, FileAccess.Read)) + { + // Open the Word document + using (WordDocument replaceDoc = new WordDocument(htmlStream, FormatType.Html)) + { + //Replace the first word with HTML file content + document.Replace("Tag1", replaceDoc, true, true); + //Get the paragraph count + int oldcount = document.LastSection.Paragraphs.Count; + //Replace the second word with the HTML file content + document.Replace("Tag2", replaceDoc, true, true); + //Enable restart numbering for the HTML file first paragraph + document.LastSection.Paragraphs[oldcount].ListFormat.RestartNumbering = true; + //Iterate through the remaining paragraphs in the document + for (int i = oldcount + 1; i < document.LastSection.Paragraphs.Count; i++) + { + // If existing list style presents, then continue list numbering + if (document.LastSection.Paragraphs[i].ListFormat.CurrentListStyle != null) + document.LastSection.Paragraphs[i].ListFormat.ContinueListNumbering(); + } + + // Save the modified document to a new file + using (FileStream docStream1 = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.Write)) + { + document.Save(docStream1, FormatType.Docx); + } + } + } + } + } + } + } +} diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Replace-list-restart-numbering-HTML-with-text.csproj b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Replace-list-restart-numbering-HTML-with-text.csproj new file mode 100644 index 000000000..d00892241 --- /dev/null +++ b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Replace-list-restart-numbering-HTML-with-text.csproj @@ -0,0 +1,27 @@ + + + + Exe + net8.0 + Replace_list_restart_numbering_HTML_with_text + enable + enable + + + + + + + + + Always + + + Always + + + Always + + + + From b8f18988d46c3317bdf757685ede1f4a904285a4 Mon Sep 17 00:00:00 2001 From: DharanyaSakthivel-SF4210 <149999916+DharanyaSakthivel-SF4210@users.noreply.github.com> Date: Wed, 19 Mar 2025 16:17:32 +0530 Subject: [PATCH 2/3] Update Program.cs --- .../Program.cs | 156 ++++++++++++++++-- 1 file changed, 141 insertions(+), 15 deletions(-) diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs index 4f4acbbce..37d2702b2 100644 --- a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs +++ b/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs @@ -1,10 +1,12 @@ -using Syncfusion.DocIO; +using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; namespace Replace_list_restart_numbering_HTML_with_text { internal class Program { + // List to store the names of different list styles used in the document. + static List listStyleNames = new List(); static void Main(string[] args) { // Load the input Word document from file stream @@ -20,20 +22,9 @@ static void Main(string[] args) using (WordDocument replaceDoc = new WordDocument(htmlStream, FormatType.Html)) { //Replace the first word with HTML file content - document.Replace("Tag1", replaceDoc, true, true); - //Get the paragraph count - int oldcount = document.LastSection.Paragraphs.Count; - //Replace the second word with the HTML file content - document.Replace("Tag2", replaceDoc, true, true); - //Enable restart numbering for the HTML file first paragraph - document.LastSection.Paragraphs[oldcount].ListFormat.RestartNumbering = true; - //Iterate through the remaining paragraphs in the document - for (int i = oldcount + 1; i < document.LastSection.Paragraphs.Count; i++) - { - // If existing list style presents, then continue list numbering - if (document.LastSection.Paragraphs[i].ListFormat.CurrentListStyle != null) - document.LastSection.Paragraphs[i].ListFormat.ContinueListNumbering(); - } + ReplaceText(document, "Tag1", replaceDoc, true); + //Replace the second word with HTML file content + ReplaceText(document, "Tag2", replaceDoc, false); // Save the modified document to a new file using (FileStream docStream1 = new FileStream(Path.GetFullPath(@"Output/Result.docx"), FileMode.Create, FileAccess.Write)) @@ -45,5 +36,140 @@ static void Main(string[] args) } } } + private static void ReplaceText(WordDocument document, string findText, WordDocument replaceDoc, bool isFirstReplace) + { + TextSelection selection = document.Find(findText, true, true); + if (selection != null) + { + //Get the textrange + WTextRange textRange = selection.GetAsOneRange(); + //Get the owner paragraph + WParagraph ownerPara = textRange.OwnerParagraph; + + //For first time replacement alone. + if (isFirstReplace) + { + //Get the index of the textrange + int index = ownerPara.ChildEntities.IndexOf(textRange); + //Add the bookmark start before the textrange + BookmarkStart bookmarkStart = new BookmarkStart(document, "Bkmk"); + ownerPara.ChildEntities.Insert(index, bookmarkStart); + //Increment the index + index++; + //Add the bookmark end after the textrange + BookmarkEnd bookmarkEnd = new BookmarkEnd(document, "Bkmk"); + ownerPara.ChildEntities.Insert(index + 1, bookmarkEnd); + //Replace the text with HTML content + document.Replace(findText, replaceDoc, true, true); + //Navigate to the bookmark content + BookmarksNavigator navigator = new BookmarksNavigator(document); + navigator.MoveToBookmark("Bkmk"); + //Get the bookmark content + TextBodyPart bodyPart = navigator.GetBookmarkContent(); + //Get the list of list styles + GetListStyleName(bodyPart.BodyItems); + //Remove the bookmark + Bookmark bookmark = document.Bookmarks.FindByName("Bkmk"); + document.Bookmarks.Remove(bookmark); + } + else + { + //Get the next sibiling of the owner paragraph + IEntity nextSibiling = ownerPara.NextSibling; + //Get the owner paragraph index as start index + int startIndex = ownerPara.OwnerTextBody.ChildEntities.IndexOf(ownerPara); + //Replace the text with HTML content + document.Replace(findText, replaceDoc, true, true); + //Get the end index + //If the next sibiling is present then it is the end index, else the child entities count + int endIndex = nextSibiling != null ? ownerPara.OwnerTextBody.ChildEntities.IndexOf(nextSibiling) + : ownerPara.OwnerTextBody.ChildEntities.Count; + //Restart the numbering + RestartNumbering(startIndex, endIndex, document.Sections[0].Body.ChildEntities); + } + } + } + //Get the list style names from the collection + private static void GetListStyleName(EntityCollection collection) + { + //Iterate through the collection + foreach (Entity entity in collection) + { + switch (entity.EntityType) + { + //Entity is paragraph + case EntityType.Paragraph: + WParagraph wParagraph = (WParagraph)entity; + //Check whether the paragrah has list format with numbered type which is not in the collection list. + if (wParagraph.ListFormat.CurrentListLevel != null + && wParagraph.ListFormat.ListType == ListType.Numbered + && !listStyleNames.Contains(wParagraph.ListFormat.CurrentListStyle.Name)) + //Add the list style name to the collection list + listStyleNames.Add(wParagraph.ListFormat.CurrentListStyle.Name); + break; + //Entity is Table + case EntityType.Table: + WTable table = (WTable)entity; + //Iterate thorugh rows + foreach (WTableRow row in table.Rows) + { + //Iterate through cells + foreach (WTableCell cell in row.Cells) + { + //Get the list style name + GetListStyleName(cell.ChildEntities); + } + } + break; + } + } + } + //Restart the numbering for replaced items + private static void RestartNumbering(int startIndex, int endIndex, EntityCollection collection) + { + //Local value + string listName = string.Empty; + for (int i = startIndex; i < endIndex; i++) + { + Entity entity = collection[i]; + switch (entity.EntityType) + { + //Entity is Paragraph + case EntityType.Paragraph: + WParagraph wParagraph = (WParagraph)entity; + //Check whether the paragraph have current list level and the same list name in the collection list. + if (wParagraph.ListFormat.CurrentListLevel != null + && listStyleNames.Contains(wParagraph.ListFormat.CurrentListStyle.Name)) + { + //If the local name is not equal to current list name, then restart the numbering + if (listName != wParagraph.ListFormat.CurrentListStyle.Name) + { + //Set the current list name as local name + listName = wParagraph.ListFormat.CurrentListStyle.Name; + //Enable restart numbering + wParagraph.ListFormat.RestartNumbering = true; + } + //If the local name and current list name are equal then continue list numbering + else + wParagraph.ListFormat.ContinueListNumbering(); + } + break; + //Entity is table + case EntityType.Table: + WTable table = (WTable)entity; + //Iterate through rows + foreach (WTableRow row in table.Rows) + { + //Iterate thorugh cells + foreach (WTableCell cell in row.Cells) + { + //Restart numbering for child entities in the cell. + RestartNumbering(0, cell.ChildEntities.Count, cell.ChildEntities); + } + } + break; + } + } + } } } From aaf69d1f45f2279988bfd8a75b1b1ed3ab66a030 Mon Sep 17 00:00:00 2001 From: DharanyaSakthivel-SF4210 Date: Wed, 19 Mar 2025 16:42:51 +0530 Subject: [PATCH 3/3] Modified sample name Replace-text-with-HTML-list --- .../.NET/Replace-text-with-HTML-list.sln} | 2 +- .../Replace-text-with-HTML-list}/Data/Template.docx | Bin .../Replace-text-with-HTML-list}/Data/sample.html | 0 .../Replace-text-with-HTML-list}/Output/.gitkeep | 0 .../.NET/Replace-text-with-HTML-list}/Program.cs | 2 +- .../Replace-text-with-HTML-list.csproj} | 2 +- 6 files changed, 3 insertions(+), 3 deletions(-) rename Find-and-Replace/{Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text.sln => Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list.sln} (79%) rename Find-and-Replace/{Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text => Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list}/Data/Template.docx (100%) rename Find-and-Replace/{Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text => Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list}/Data/sample.html (100%) rename Find-and-Replace/{Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text => Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list}/Output/.gitkeep (100%) rename Find-and-Replace/{Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text => Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list}/Program.cs (99%) rename Find-and-Replace/{Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Replace-list-restart-numbering-HTML-with-text.csproj => Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Replace-text-with-HTML-list.csproj} (89%) diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text.sln b/Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list.sln similarity index 79% rename from Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text.sln rename to Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list.sln index 3dc72b15d..f01040a26 100644 --- a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text.sln +++ b/Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.11.35327.3 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Replace-list-restart-numbering-HTML-with-text", "Replace-list-restart-numbering-HTML-with-text\Replace-list-restart-numbering-HTML-with-text.csproj", "{EA22BFD7-89F9-4F72-BECC-743931FBDFA6}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Replace-text-with-HTML-list", "Replace-text-with-HTML-list\Replace-text-with-HTML-list.csproj", "{EA22BFD7-89F9-4F72-BECC-743931FBDFA6}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/Template.docx b/Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Data/Template.docx similarity index 100% rename from Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/Template.docx rename to Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Data/Template.docx diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/sample.html b/Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Data/sample.html similarity index 100% rename from Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Data/sample.html rename to Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Data/sample.html diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Output/.gitkeep b/Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Output/.gitkeep similarity index 100% rename from Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Output/.gitkeep rename to Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Output/.gitkeep diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs b/Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Program.cs similarity index 99% rename from Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs rename to Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Program.cs index 37d2702b2..c6e610479 100644 --- a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Program.cs +++ b/Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Program.cs @@ -1,7 +1,7 @@ using Syncfusion.DocIO; using Syncfusion.DocIO.DLS; -namespace Replace_list_restart_numbering_HTML_with_text +namespace Replace_text_with_HTML_list { internal class Program { diff --git a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Replace-list-restart-numbering-HTML-with-text.csproj b/Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Replace-text-with-HTML-list.csproj similarity index 89% rename from Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Replace-list-restart-numbering-HTML-with-text.csproj rename to Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Replace-text-with-HTML-list.csproj index d00892241..433ce2860 100644 --- a/Find-and-Replace/Replace-List-Restart-Numbering-HTML-with-text/.NET/Replace-list-restart-numbering-HTML-with-text/Replace-list-restart-numbering-HTML-with-text.csproj +++ b/Find-and-Replace/Replace-text-with-HTML-list/.NET/Replace-text-with-HTML-list/Replace-text-with-HTML-list.csproj @@ -3,7 +3,7 @@ Exe net8.0 - Replace_list_restart_numbering_HTML_with_text + Replace_text_with_HTML_list enable enable