frank10 Posted December 9, 2021 Posted December 9, 2021 (edited) I want to make a listed text into a single paragraph, but the replace of text fails with styles... I have this code: $oRangeFound = _Word_DocFind($oDoc, "Nutrition:" , 0, $oSearchRange, Default, Default, $wdParagraph) $oRangeFound = _Word_DocRangeSet($oDoc, $oRangeFound, $WdWord, 1, $wdParagraph, 1) $oRangeFound = _Word_DocRangeSet($oDoc, $oRangeFound, Default, 1, $wdCharacter, -1) if $arrangeNutrition then local $oRange1 = $oDoc.Range($oRangeFound.Start, $oRangeFound.End) $oRange1 = _Word_DocFindEX($oDoc, Default, Default, $oRange1, Default, Default, Default, Default, Default, Default, "Heading 2") $oRange1 = _Word_DocRangeSet($oDoc, $oRange1, Default, Default, $wdParagraph, -1) $oRangeFound.End = $oRange1.Start endif $resultTextNutrition = Stringreplace($oRangeFound.Text, @cr , " | ") Consolewrite( "###" & $resultTextNutrition & @crlf) $oRangeFound.Text = $resultTextNutrition & @crlf From this: I want this (Nutrition style Normal with "Nutrition:" remains bold, and the rest of the text all in Normal without bold): instead it becomes like ("Nutrition:" Heading 2, so it becomes part of the numbered list and New Title becomes 2 ...😞 testMe.docx Edited December 9, 2021 by frank10
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now